Public report of balena-os/balena-engine, published 17 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 17 November 2026, 20:51 UTC · Survey ID cd_09a21ef8126b4193bbad9909c86ae22e
balena-os/balena-engine
Measured 17 November 2026, 20:49 UTC, at code version 6853744
Test reliability is not measured: The suite could not be re-run, but the repository declares tests of its own unreliable.
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A large codebase: 149,424 lines of product code, tests not counted · Estimated rebuild effort: about 2.6 person-years · Weakest lens: Security and Compliance, 46.0
Findings by how serious they are
155 critical1875 serious605 minor
20 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 20:49 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
56of 56 dimensions measured by tools.
2621of 2635 findings point to an exact file and line, so you can open each one in the code. The other 14 concern the repository as a whole, such as missing documentation.
56dimensions across 7 lenses, read from 149,424 lines of product code.
balena-os/balena-engine falls short of our standard for production, in part because it has pipeline tools referenced by a changeable name. It scores 54.1 out of 100 and is rated Adequate, and 152 of its 155 critical findings are security problems.
Security and Compliance, at 46.0, is the weakest lens and counts most in the score. The best first step is planning backups and recovery, worth about 4.5 points. Recording design decisions comes next, worth about 1.5 points. Raising Security and Compliance to 70 would lift the score to about 59.9.
110 pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Fourteen secrets can leak from the build pipeline, and twelve settings leave the servers or containers unsafe. Pinning each tool to an exact version, limiting each secret to its own step and correcting the unsafe settings would close these risks. Passing outside input through environment variables would fix the four pipeline steps that put outside input straight into a shell command, and the five passwords or keys in the code's history need replacing, with the old ones switched off. The two tests the project itself marks as unreliable need fixing or deleting.
The product code is 149,424 lines, about €380,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Security and Compliance rose from 46.0 to 70, the lowest score rated Strong, the score would rise from 54.1 to about 59.9.
Code composition: what the lines of code are
Product code 56%Tests 44%
Rebuild cost: about €380,000 · Estimate
Cost to rebuild
€130,000 to €640,000, for 2,111 to 6,696 hours of work, about 2.6 person-years for 1 to 5 engineers
Difficulty of the problem
High, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.8 at a score of 54. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Large: 149,424 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Resolve the 1 finding(s) in DR & Backup.
Raises the score by about 4.5 points · Medium effort · DR & Backup
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with main.go.
Raises the score by about 1.5 points · Low effort · ADR Quality
3
Resolve the 5 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED, REDACTED.
Raises the score by about 1.3 points · Low effort · Secrets (history)
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Where the investment is most exposed · Value at risk
This code would cost about €380,000 to build again, about 2.6 person-years of work. Its weakest lens is Security and Compliance, at 46.0 (Weak). Security and Compliance is about how well the product is protected, and how it handles personal data. Because the weakest lens counts most in the score, work on Security and Compliance also moves the score most.
Based on: the rebuild estimate · the Security and Compliance grade · how much each lens counts
What to do: Start with the Security and Compliance actions in Top priorities.
If you do one thing first · First action
Resolve the 1 finding(s) in DR & Backup. Of all the actions in this report, it raises the score most for the work it takes: about 4.5 points for medium effort, because it clears the 1 DR & Backup findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 6.1 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 5% to 11% on every change. The history of the code shows how much it changes: about 31 lines over the last 90 days, which is about 126 lines a year. At that pace, the extra work comes to an estimated 0 to 0.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
291 modules, with 53 dependencies between them. One loop runs through 2 of the modules, marked above the diagonal.
The table shows the 40 modules with the most connections; 251 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
local/repository/api/server/backend/build uses local/repository/api/server/router/build, so a change to local/repository/api/server/router/build can break local/repository/api/server/backend/build, while a change to local/repository/api/server/backend/build can't break local/repository/api/server/router/build.
Position
Below the diagonal: local/repository/api/server/backend/build uses a module listed above it, which is the healthy direction.
local/repository/builder/builder-next/adapters/containerimage uses local/repository/distribution/xfer, so a change to local/repository/distribution/xfer can break local/repository/builder/builder-next/adapters/containerimage, while a change to local/repository/builder/builder-next/adapters/containerimage can't break local/repository/distribution/xfer.
Position
Below the diagonal: local/repository/builder/builder-next/adapters/containerimage uses a module listed above it, which is the healthy direction.
local/repository/builder/builder-next/worker uses local/repository/distribution/xfer, so a change to local/repository/distribution/xfer can break local/repository/builder/builder-next/worker, while a change to local/repository/builder/builder-next/worker can't break local/repository/distribution/xfer.
Position
Below the diagonal: local/repository/builder/builder-next/worker uses a module listed above it, which is the healthy direction.
local/repository/builder/remotecontext uses local/repository/builder, so a change to local/repository/builder can break local/repository/builder/remotecontext, while a change to local/repository/builder/remotecontext can't break local/repository/builder.
Position
Below the diagonal: local/repository/builder/remotecontext uses a module listed above it, which is the healthy direction.
local/repository/daemon/graphdriver/fuse-overlayfs uses local/repository/daemon/graphdriver, so a change to local/repository/daemon/graphdriver can break local/repository/daemon/graphdriver/fuse-overlayfs, while a change to local/repository/daemon/graphdriver/fuse-overlayfs can't break local/repository/daemon/graphdriver.
Position
Below the diagonal: local/repository/daemon/graphdriver/fuse-overlayfs uses a module listed above it, which is the healthy direction.
local/repository/daemon/graphdriver/overlay2 uses local/repository/daemon/graphdriver, so a change to local/repository/daemon/graphdriver can break local/repository/daemon/graphdriver/overlay2, while a change to local/repository/daemon/graphdriver/overlay2 can't break local/repository/daemon/graphdriver.
Position
Below the diagonal: local/repository/daemon/graphdriver/overlay2 uses a module listed above it, which is the healthy direction.
local/repository/daemon/graphdriver/windows uses local/repository/daemon/graphdriver, so a change to local/repository/daemon/graphdriver can break local/repository/daemon/graphdriver/windows, while a change to local/repository/daemon/graphdriver/windows can't break local/repository/daemon/graphdriver.
Position
Below the diagonal: local/repository/daemon/graphdriver/windows uses a module listed above it, which is the healthy direction.
local/repository/distribution uses local/repository/distribution/xfer, so a change to local/repository/distribution/xfer can break local/repository/distribution, while a change to local/repository/distribution can't break local/repository/distribution/xfer.
Position
Below the diagonal: local/repository/distribution uses a module listed above it, which is the healthy direction.
local/repository/image uses local/repository/builder, so a change to local/repository/builder can break local/repository/image, while a change to local/repository/image can't break local/repository/builder.
Position
Below the diagonal: local/repository/image uses a module listed above it, which is the healthy direction.
local/repository/libnetwork uses local/repository/api/types/network, so a change to local/repository/api/types/network can break local/repository/libnetwork, while a change to local/repository/libnetwork can't break local/repository/api/types/network.
Position
Below the diagonal: local/repository/libnetwork uses a module listed above it, which is the healthy direction.
local/repository/libnetwork uses local/repository/libnetwork/driverapi, so a change to local/repository/libnetwork/driverapi can break local/repository/libnetwork, while a change to local/repository/libnetwork can't break local/repository/libnetwork/driverapi.
Position
Below the diagonal: local/repository/libnetwork uses a module listed above it, which is the healthy direction.
local/repository/libnetwork/ipams/remote uses local/repository/libnetwork/ipamapi, so a change to local/repository/libnetwork/ipamapi can break local/repository/libnetwork/ipams/remote, while a change to local/repository/libnetwork/ipams/remote can't break local/repository/libnetwork/ipamapi.
Position
Below the diagonal: local/repository/libnetwork/ipams/remote uses a module listed above it, which is the healthy direction.
29→34 local/repository/pkg/ioutils uses local/repository/daemon/logger/loggerutilspart of a loop✕
Connections
1 pair of types, where a type in local/repository/pkg/ioutils uses a type in local/repository/daemon/logger/loggerutils.
local/repository/pkg/ioutils uses local/repository/daemon/logger/loggerutils, so a change to local/repository/daemon/logger/loggerutils can break local/repository/pkg/ioutils, while a change to local/repository/pkg/ioutils can't break local/repository/daemon/logger/loggerutils.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
local/repository/volume/testutils uses local/repository/pkg/plugingetter, so a change to local/repository/pkg/plugingetter can break local/repository/volume/testutils, while a change to local/repository/volume/testutils can't break local/repository/pkg/plugingetter.
Position
Below the diagonal: local/repository/volume/testutils uses a module listed above it, which is the healthy direction.
local/repository/volume/testutils uses local/repository/volume, so a change to local/repository/volume can break local/repository/volume/testutils, while a change to local/repository/volume/testutils can't break local/repository/volume.
Position
Below the diagonal: local/repository/volume/testutils uses a module listed above it, which is the healthy direction.
local/repository/builder/builder-next/adapters/snapshot uses local/repository/builder/builder-next/worker, so a change to local/repository/builder/builder-next/worker can break local/repository/builder/builder-next/adapters/snapshot, while a change to local/repository/builder/builder-next/adapters/snapshot can't break local/repository/builder/builder-next/worker.
Position
Below the diagonal: local/repository/builder/builder-next/adapters/snapshot uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/api/server/router/checkpoint, so a change to local/repository/api/server/router/checkpoint can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/api/server/router/checkpoint.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/api/server/router/container, so a change to local/repository/api/server/router/container can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/api/server/router/container.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/api/server/router/image, so a change to local/repository/api/server/router/image can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/api/server/router/image.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/api/server/router/network, so a change to local/repository/api/server/router/network can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/api/server/router/network.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/builder, so a change to local/repository/builder can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/builder.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/volume, so a change to local/repository/volume can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/volume.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/api/server/backend/build, so a change to local/repository/api/server/backend/build can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/api/server/backend/build.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon uses local/repository/distribution, so a change to local/repository/distribution can break local/repository/daemon, while a change to local/repository/daemon can't break local/repository/distribution.
Position
Below the diagonal: local/repository/daemon uses a module listed above it, which is the healthy direction.
local/repository/daemon/images uses local/repository/api/server/router/image, so a change to local/repository/api/server/router/image can break local/repository/daemon/images, while a change to local/repository/daemon/images can't break local/repository/api/server/router/image.
Position
Below the diagonal: local/repository/daemon/images uses a module listed above it, which is the healthy direction.
local/repository/daemon/images uses local/repository/api/server/backend/build, so a change to local/repository/api/server/backend/build can break local/repository/daemon/images, while a change to local/repository/daemon/images can't break local/repository/api/server/backend/build.
Position
Below the diagonal: local/repository/daemon/images uses a module listed above it, which is the healthy direction.
local/repository/daemon/logger/loggerutils uses local/repository/pkg/ioutils, so a change to local/repository/pkg/ioutils can break local/repository/daemon/logger/loggerutils, while a change to local/repository/daemon/logger/loggerutils can't break local/repository/pkg/ioutils.
Position
Below the diagonal: local/repository/daemon/logger/loggerutils uses a module listed above it, which is the healthy direction.
local/repository/image/tarexport uses local/repository/image, so a change to local/repository/image can break local/repository/image/tarexport, while a change to local/repository/image/tarexport can't break local/repository/image.
Position
Below the diagonal: local/repository/image/tarexport uses a module listed above it, which is the healthy direction.
local/repository/daemon/containerd uses local/repository/api/server/router/image, so a change to local/repository/api/server/router/image can break local/repository/daemon/containerd, while a change to local/repository/daemon/containerd can't break local/repository/api/server/router/image.
Position
Below the diagonal: local/repository/daemon/containerd uses a module listed above it, which is the healthy direction.
local/repository/daemon/containerd uses local/repository/api/server/backend/build, so a change to local/repository/api/server/backend/build can break local/repository/daemon/containerd, while a change to local/repository/daemon/containerd can't break local/repository/api/server/backend/build.
Position
Below the diagonal: local/repository/daemon/containerd uses a module listed above it, which is the healthy direction.
local/repository/daemon/containerd uses local/repository/distribution, so a change to local/repository/distribution can break local/repository/daemon/containerd, while a change to local/repository/daemon/containerd can't break local/repository/distribution.
Position
Below the diagonal: local/repository/daemon/containerd uses a module listed above it, which is the healthy direction.
local/repository/daemon/containerd uses local/repository/daemon, so a change to local/repository/daemon can break local/repository/daemon/containerd, while a change to local/repository/daemon/containerd can't break local/repository/daemon.
Position
Below the diagonal: local/repository/daemon/containerd uses a module listed above it, which is the healthy direction.
local/repository/daemon/logger/jsonfilelog uses local/repository/daemon/logger/loggerutils, so a change to local/repository/daemon/logger/loggerutils can break local/repository/daemon/logger/jsonfilelog, while a change to local/repository/daemon/logger/jsonfilelog can't break local/repository/daemon/logger/loggerutils.
Position
Below the diagonal: local/repository/daemon/logger/jsonfilelog uses a module listed above it, which is the healthy direction.
local/repository/daemon/logger/local uses local/repository/daemon/logger/loggerutils, so a change to local/repository/daemon/logger/loggerutils can break local/repository/daemon/logger/local, while a change to local/repository/daemon/logger/local can't break local/repository/daemon/logger/loggerutils.
Position
Below the diagonal: local/repository/daemon/logger/local uses a module listed above it, which is the healthy direction.
local/repository/pkg/archive uses local/repository/pkg/ioutils, so a change to local/repository/pkg/ioutils can break local/repository/pkg/archive, while a change to local/repository/pkg/archive can't break local/repository/pkg/ioutils.
Position
Below the diagonal: local/repository/pkg/archive uses a module listed above it, which is the healthy direction.
local/repository/pkg/archive uses local/repository/daemon/logger/loggerutils, so a change to local/repository/daemon/logger/loggerutils can break local/repository/pkg/archive, while a change to local/repository/pkg/archive can't break local/repository/daemon/logger/loggerutils.
Position
Below the diagonal: local/repository/pkg/archive uses a module listed above it, which is the healthy direction.
local/repository/volume/service uses local/repository/api/server/router/volume, so a change to local/repository/api/server/router/volume can break local/repository/volume/service, while a change to local/repository/volume/service can't break local/repository/api/server/router/volume.
Position
Below the diagonal: local/repository/volume/service uses a module listed above it, which is the healthy direction.
local/repository/volume/service uses local/repository/daemon, so a change to local/repository/daemon can break local/repository/volume/service, while a change to local/repository/volume/service can't break local/repository/daemon.
Position
Below the diagonal: local/repository/volume/service uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 65.9 · 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
A05:2025 — Injection
211
High / Critical
A02:2025 — Security Misconfiguration
46
High / Critical
A07:2025 — Authentication Failures
9
High / Critical
A03:2025 — Software Supply Chain Failures
6
Medium
Roadmap
Top priorities: Resolve the 1 finding(s) in DR & Backup; Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail; Resolve the 31 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (26), REDACTED, REDACTED.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 155
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 1875
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 605
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 20
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 56 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 56 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, 2621 of 2635 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D5 Coupling — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D8 Code Coverage — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: test source is present (.go) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This repository declares 2 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.go), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D26 Project Cohesion — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Project size and spread are measured over build units (a .NET project, a Maven or Gradle module, an npm, Deno or JSR package, a Go module, a Cargo crate, a Python, Composer, Bundler, RubyGems, Mix, rebar3, sbt, SwiftPM or pub package, an OTP application, an Xcode project or XcodeGen spec, or a checkout that declares no build at all) whose source a code model reads. This repository's production source is in a language no model reads, or in units whose build tool D26 does not recognise. That is a gap in this analyzer's language reach — not a finding that the repository's projects are cohesive.
D31 IaC & Container Security — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Checkov ran but its report could not be read (checkov produced no output — not a clean result). Every misconfiguration only checkov reports — most of its Terraform, CloudFormation, Bicep and Ansible policies — is absent from this card, so its absence here is not evidence those resources are configured correctly.
D31 IaC & Container Security — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Contrib/syntax/nano/REDACTED.nanorc, contrib/syntax/textmate/Docker.tmbundle/Preferences/REDACTED.tmPreferences, contrib/syntax/textmate/Docker.tmbundle/Syntaxes/REDACTED.tmLanguage carries no `FROM` instruction, so it declares no build stage and every REDACTED rule this engine owns — the runtime-hardening, key-material, mutable-clone, no-op-shim, build-context, trust-anchor, install-guard, setuid and world-writable-path rules — is outside its own premise there and returned nothing. That silence is deliberate and correct: with no base image there is no image to reason about. It is reported here because it is NOT the same fact as a clean file, and coverage is stated as 30 of 33 Infrastructure-as-Code manifest(s) fully judged rather than as 100%. The vendor scanners (trivy, checkov) do read these files and their findings above stand; only this engine's own stage-keyed rules are absent. No owner action: a build file with no FROM is a legitimate include fragment.
AX3 Project dependency cycles — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which project references which. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj/.fsproj/.vbproj, Gradle, Maven, Cargo, npm/pnpm/yarn, Go module (and dep/glide/godep), Python pyproject.toml/setup.cfg/setup.py, SwiftPM, sbt, Mill, RubyGems, Composer, Mix/rebar3, pub, Unity assembly-definition, Deno/JSR, Tuist, CMake, Bazel, Xcode and XcodeGen builds and uni-app uni_modules plugins, or — when none declares a module — from the imports between a JavaScript/TypeScript, Python, Ruby, loose Rust, build-less C# or manifest-less Go tree's top-level directories, or as one module when all of a tree's source is one directory, and this repository offers none of them — so there was no graph to read, and re-running the same commit reads the same nothing. No module manifest of any ecosystem this engine recognises was found either, and the source's own imports could not stand in: they are read for JavaScript/TypeScript, Python and Ruby only, and only when those languages are the product — in any other language a tree is read only when its whole source is one directory, which this one's is not. The collector owed is an import reader for this repository's languages. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
AX8 Test isolation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over which projects are test projects, and what they reference. That is a language-neutral question, but the project-reference graph is collected from MSBuild .csproj/.fsproj/.vbproj, Gradle, Maven, Cargo, npm/pnpm/yarn, Go module (and dep/glide/godep), Python pyproject.toml/setup.cfg/setup.py, SwiftPM, sbt, Mill, RubyGems, Composer, Mix/rebar3, pub, Unity assembly-definition, Deno/JSR, Tuist, CMake, Bazel, Xcode and XcodeGen builds and uni-app uni_modules plugins, or — when none declares a module — from the imports between a JavaScript/TypeScript, Python, Ruby, loose Rust, build-less C# or manifest-less Go tree's top-level directories, or as one module when all of a tree's source is one directory, and this repository offers none of them — so there was no graph to read, and re-running the same commit reads the same nothing. No module manifest of any ecosystem this engine recognises was found either, and the source's own imports could not stand in: they are read for JavaScript/TypeScript, Python and Ruby only, and only when those languages are the product — in any other language a tree is read only when its whole source is one directory, which this one's is not. The collector owed is an import reader for this repository's languages. That is a COLLECTOR gap in this analyzer — no change to the scan image closes it — and not a finding that the repository is free of what this check looks for.
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
ED5 Idempotency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Java was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust was found, and this repository's Go, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust and Elixir source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust or Elixir was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 252 further occurrence(s) are not listed individually; the score already reflects all 292.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations: 2 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
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
D22 Internal API Consistency: API consistency compares the call shapes of members that play the same role on the exposed C# surface: whether the API suits its callers is not measured, and surfaces in other languages are not measured.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
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.
218 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was daemon.verifyPlatformContainerResources at 83. A further 4 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 Container.UpdateContainer at 34 — they are counted neither in the figure above nor in this dimension's score. 2 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: container/container_unix.go (Container.UpdateContainer at 34), daemon/logger/syslog/syslog.go (syslog.ValidateLogOpt at 17). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 211 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 5 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with daemon.verifyPlatformContainerResources (cyclomatic 83), Daemon.restore (cyclomatic 70), daemon.NewDaemon (cyclomatic 67). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 5 together lifts Cyclomatic Complexity from 5.6 to about 6.0/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 386 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 3 bodies over 120 down to 120 or less in Cognitive Complexity — start with Daemon.restore (cognitive 147), ImageService.Images (cognitive 136), daemon.withMounts (cognitive 131). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 3 together lifts Cognitive Complexity from 2.1 to about 2.7/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes8.3 / 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.
TooManyFields: Info · ×8api/types/system/info.go:11
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 23 FileTooLong finding(s) in God Classes — start with daemon.go (3), network.go (2), REDACTED (2). — One of this dimension's main actionable groups (23 warning-level).
Resolve the 18 MethodTooLong finding(s) in God Classes — start with daemon.go (3), logreader.go, builder.go. — One of this dimension's main actionable groups (18 warning-level).
Resolve the 16 TooManyMethods finding(s) in God Classes — start with daemon.go (2), service.go (2), container.go (2). — One of this dimension's main actionable groups (16 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
241 duplicated block group(s) detected. 7.0 % of the production lines (10,489 of 149,424) are in a reported copy. A further 176 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 22 of the 417 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.
+ 118 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 21 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with REDACTED (3), cluster_routes.go (2), pull.go. — One of this dimension's main actionable groups (21 warning-level).
Resolve the 18 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with cluster_routes.go (2), bridge_linux.go (2), networkdbdiagnostic.go (2). — One of this dimension's main actionable groups (18 warning-level).
Resolve the 16 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with ipvlan_store.go (3), graphbench_unix.go (2), container_prune.go. — One of this dimension's main actionable groups (16 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
Resolve the 15 Low cohesion finding(s) in Cohesion (LCOM4) — start with daemon.go (3), REDACTED (2), bridge_linux.go (2). — One of this dimension's main actionable groups (15 warning-level).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
1 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.
Outdated: github.com/cpuguy83/go-md2man/v2
✓ On the Gold path — maintain.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 2 required Go module(s) use a banned license. Licences were read per module version from the licence files pkg.go.dev detects (via api.deps.dev), over every module this repository's REDACTED requires, direct and indirect, at the version the build uses. Go records no test-only scope at module level, so modules only this repository's own tests import are included.
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.
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.
9 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is REDACTED. Counted over 511 of the 1263 production source files in this repository: 730 are under the ~2,400-byte size floor this dimension measures over, and the remaining 22 have no attributable history left to measure.
Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
623 deducted task-comment markers across 149424 LoC (0.4/KLoC) → score 9.2. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
FixmeComment repeated across 28 filestestutil/helpers.go:1
What to do
Resolve the 475 TodoComment finding(s) in Explicit Debt — start with docker_cli_run_test.go (36), daemon.go (11), service.go (10). — One of this dimension's main actionable groups (475 warning-level).
Resolve the 112 FixmeComment finding(s) in Explicit Debt — start with docker_cli_build_test.go (32), daemon.go (5), request.go (3). — One of this dimension's main actionable groups (112 warning-level).
Resolve the 5 HackComment finding(s) in Explicit Debt — start with layer_test.go, docker_cli_daemon_test.go, docker_cli_external_volume_driver_test.go. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 46 document(s) read across 2 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.
4 naming inconsistencies among 70 declarations measured against a convention their peers follow.
`blockMAX` spells `MAX` where 21 names in the project spell it `Max`libnetwork/bitmap/sequence.go:16
`setDefaultVLAN` spells `VLAN` where 12 names in the project spell it `Vlan`libnetwork/drivers/overlay/ov_network.go:490
`defaultIPv4Dns` spells `Dns` where 33 names in the project spell it `DNS`libnetwork/resolvconf/resolvconf.go:77
`defaultIPv6Dns` spells `Dns` where 33 names in the project spell it `DNS`libnetwork/resolvconf/resolvconf.go:78
What to do
Resolve the 1 `blockMAX` spells `MAX` where 21 names in the project spell it `Max` finding(s) in Naming Consistency — start with sequence.go. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `setDefaultVLAN` spells `VLAN` where 12 names in the project spell it… finding(s) in Naming Consistency — start with ov_network.go. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 `defaultIPv4Dns` spells `Dns` where 33 names in the project spell it… finding(s) in Naming Consistency — start with resolvconf.go. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d21_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D22 · Internal API Consistency9.2 / 10Stronggated by 6 serious findings✓ Tool-verified
What it measures: Whether the internal API surface is consistent and coherent.
Method: Call-shape rules (A1-A9) over the structured code model of the intentionally exposed C# surface: members of one type, overloads of one name and the same slot across sibling types are compared, and a member that makes a caller use a different convention for the same kind of operation is flagged. Deterministic, no model. Advisory.
6 API inconsistencies among 738 exposed members measured against a convention their peers follow.
`Worker.Labels` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`)builder/builder-next/worker/worker.go:150
`Daemon.Features` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`)daemon/daemon.go:200
`distribution.DeltaBaseImageFromConfig` takes no context.Context; its 4 sibling operations take onedistribution/pull_v2.go:1017
`Store.Map` returns a map (`map[K]V`) where its 3 siblings return a slice (`[]T`)layer/layer.go:180
`Endpoint.DriverInfo` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`)libnetwork/endpoint_info_unix.go:8
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 `Worker.Labels` returns a map (`map[K]V`) where its 4 siblings return a… finding(s) in Internal API Consistency — start with worker.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 `Daemon.Features` returns a map (`map[K]V`) where its 4 siblings return… finding(s) in Internal API Consistency — start with daemon.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 `distribution.DeltaBaseImageFromConfig` takes no context.Context; its 4… finding(s) in Internal API Consistency — start with pull_v2.go. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d22_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
7 finding(s): 0 critical, 5 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
REDACTED
What to do
Resolve the 5 REDACTED finding(s) in Secrets (history) — start with REDACTED (2), REDACTED, REDACTED. — One of this dimension's main actionable groups (5 issue-level).
Resolve the 2 REDACTED finding(s) in Secrets (history) — start with REDACTED (2). — One of this dimension's main actionable groups (2 recommendation-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
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).
214 finding(s): 0 critical, 135 high, 39 medium, 40 low. 110 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 19 file(s) — `REDACTED`, `REDACTED` (line 12), `contrib/check-config.sh` (line 71), `contrib/dockerd-rootless-setuptool.sh` (line 16, line 20), `contrib/dockerize-disk.sh` (line 5), … (+14 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 9 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 23 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 11 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4), REDACTED (3), REDACTED (2). — One of this dimension's main actionable groups (11 issue-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
No action in Static Analysis (SAST) — all 110 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (110 issue-level, 0 of them charged here).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 1 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d30_recommendation.md · top locations in Appendix A, every location in findings.md.
Resolve the 31 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (26), REDACTED, REDACTED. — One of this dimension's main actionable groups (31 warning-level).
Resolve the 12 High IaC finding(s) in IaC & Container Security — start with REDACTED (9), REDACTED, REDACTED.client. — One of this dimension's main actionable groups (12 issue-level).
Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with REDACTED (3). — 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.
513 of 533 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is libnetwork/network.go. Counted over 533 of the 1263 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Most significant orphaned file · ×3libnetwork/network.go:1
Concentrated knowledge decay
What to do
Resolve the 510 Orphaned file finding(s) in Knowledge Freshness — start with service.go (8), REDACTED (6), store.go (6). — One of this dimension's main actionable groups (510 recommendation-level).
Resolve the 3 Most significant orphaned file finding(s) in Knowledge Freshness — start with network.go, REDACTED, bridge_linux.go. — One of this dimension's main actionable groups (3 recommendation-level).
Resolve the 1 Concentrated knowledge decay finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
Resolve the 1 Boundary-crossing change coupling finding(s) in Change Coupling — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Change coupling finding(s) in Change Coupling — start with backend.go. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d35_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
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 any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
Package `dummyclient` serves requests (request-handler function literals run on a goroutine per request, and every one sees the same package variables and captured values) but writes that shared state outside any lock (clientWatchTable; e.g. `clientWatchTable` in `watchTable` at line 51). Unsynchronised concurrent writes are a data race in Go: an update is lost or a value tears, and a concurrent map write aborts the process. — libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go:51
`Ctx` serves requests (net/http handlers run on a goroutine per request, and every one shares the single `Ctx` value the router holds) but writes its fields outside any lock (authReq; e.g. `authReq` in `AuthZRequest` at line 87). Unsynchronised concurrent writes are a data race in Go: an update is lost or a value tears, and a concurrent map write aborts the process. — pkg/authorization/authz.go:48
What to do
Go: guard the state handlers share with a sync.Mutex held for the whole update (`mu.Lock(); defer mu.Unlock()`), make counters sync/atomic types (atomic.Int64) and caches a sync.Map, or keep per-request data in locals and the request context. `go test -race` over a handler test confirms the race and then its fix.
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 · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
`Backend` declares 29 methods: `Init`, `Join`, `Leave`, `Inspect`, `Update`, `GetUnlockKey`, `UnlockSwarm`, `GetServices`, `GetService`, `CreateService`, `UpdateService`, `RemoveService`, `ServiceLogs`, `GetNodes`, `GetNode`, `UpdateNode`, `RemoveNode`, `GetTasks`, `GetTask`, `GetSecrets`, `CreateSecret`, `RemoveSecret`, `GetSecret`, `UpdateSecret`, `GetConfigs`, `CreateConfig`, `RemoveConfig`, `GetConfig`, `UpdateConfig`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — api/server/router/swarm/backend.go:13
`ContainerAPIClient` declares 32 methods: `ContainerAttach`, `ContainerCommit`, `ContainerCreate`, `ContainerDiff`, `ContainerExecAttach`, `ContainerExecCreate`, `ContainerExecInspect`, `ContainerExecResize`, `ContainerExecStart`, `ContainerExport`, `ContainerInspect`, `ContainerInspectWithRaw`, `ContainerKill`, `ContainerList`, `ContainerLogs`, `ContainerPause`, `ContainerRemove`, `ContainerRename`, `ContainerResize`, `ContainerRestart`, `ContainerStatPath`, `ContainerStats`, `ContainerStatsOneShot`, `ContainerStart`, `ContainerStop`, `ContainerTop`, `ContainerUnpause`, `ContainerUpdate`, `ContainerWait`, `CopyFromContainer`, `CopyToContainer`, `ContainersPrune`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — client/interface.go:48
`ImageAPIClient` declares 17 methods: `ImageBuild`, `BuildCachePrune`, `BuildCancel`, `ImageCreate`, `ImageHistory`, `ImageDelta`, `ImageImport`, `ImageInspectWithRaw`, `ImageList`, `ImageLoad`, `ImagePull`, `ImagePush`, `ImageRemove`, `ImageSearch`, `ImageSave`, `ImageTag`, `ImagesPrune`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — client/interface.go:89
`ImageService` declares 38 methods: `PullImage`, `PushImage`, `CreateImage`, `ImageDelete`, `ExportImage`, `PerformWithBaseFS`, `LoadImage`, `Images`, `LogImageEvent`, `CountImages`, `ImagesPrune`, `ImportImage`, `TagImage`, `GetImage`, `ImageHistory`, `CommitImage`, `SquashImage`, `PrepareSnapshot`, `GetImageManifest`, `GetImageAndReleasableLayer`, `CreateLayer`, `LayerStoreStatus`, `GetLayerMountID`, `ReleaseLayer`, `LayerDiskUsage`, `GetContainerLayerSize`, `Mount`, `Unmount`, `Changes`, `GetLayerFolders`, `MakeImageCache`, `CommitBuildStep`, `DeltaCreate`, `DistributionServices`, `Children`, `Cleanup`, `StorageDriver`, `UpdateConfig`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces. — daemon/image_service.go:27
What to do
Split fat interfaces into focused role-interfaces so clients depend only on what they use.
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.
`EventCreate` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — plugin/events.go:22
`EventRemove` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — plugin/events.go:48
`EventDisable` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — plugin/events.go:62
`EventEnable` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe. — plugin/events.go:76
What to do
Name new events in the past tense: they record facts that already happened. Do not rename an event that is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it.
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 repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
Add a build/run (quick start) section to the root README — the first thing a newcomer needs.
Explain in the README how to run the tests. Add a section called Testing to the README in the repository's top folder, saying how to run the test suite.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
`vendor/github.com/containerd/containerd/runtime/v2/README.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `containerd-shim-runc-v2`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape. — vendor/github.com/containerd/containerd/runtime/v2/README.md:206
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Update vendor/github.com/containerd/containerd/runtime/v2/README.md so it draws the parts the code has today: add containerd-shim-runc-v2.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
project/README.md links to `./RELEASE-CHECKLIST.md`, but `project/RELEASE-CHECKLIST.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — project/README.md:14
What to do
Reconcile the README with reality: project/README.md links to `./RELEASE-CHECKLIST.md`, but `project/RELEASE-CHECKLIST.md` does not exist.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability7.5 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
`REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — REDACTED:5
What to do
Your ecosystem's static analyzer is declared as a dependency but is not wired into CI — run it as a required step on push/PR (e.g. `composer phpstan` / `mix sobelow` / `bundle exec brakeman` / the spotbugs Gradle task / `sbt scalafixAll --check` / `golangci-lint run` / `rebar3 lint`) so a regression fails the build instead of relying on someone running it locally.
Enable Dependabot/Renovate or a dependency-review gate.
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Do you agree with this assessment?
P5 · DR & Backup0.0 / 10Critical✓ 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.
A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
`http.Head(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — builder/remotecontext/git/gitutils.go:150
`http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×9) — builder/remotecontext/git/gitutils.go:152, builder/remotecontext/remote.go:47, libnetwork/cmd/diagnostic/main.go:63, …
`http.Client{` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. — testutil/request/request.go:165
What to do
Give every `http.Client` an explicit `Timeout` (never call `http.Get`/`http.Post` or `http.DefaultClient`, which have none), or build each request with `http.NewRequestWithContext` under a `context.WithTimeout`; add retry with back-off (`hashicorp/go-retryablehttp`) and a breaker (`sony/gobreaker`) around dependencies that fail.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.
Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged
Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.
Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 2/14 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`loginV2` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — registry/auth.go:69
`PingV2Registry` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — registry/auth.go:175
`ping` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — registry/search_endpoint_v1.go:112
`searchRepositories` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — registry/search_session.go:187
`pluginPostStart` calls `net.Dial(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — plugin/manager_linux.go:74
`dialExtDNS` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — REDACTED:456
`setExternalKey` calls `net.Dial(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — libnetwork/sandbox_externalkey_unix.go:72
`fetchNodePeers` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — libnetwork/cmd/diagnostic/main.go:106
`fetchTable` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — libnetwork/cmd/diagnostic/main.go:145
`verifySplunkConnection` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — REDACTED:622
`GetWithStatusError` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — builder/remotecontext/remote.go:46
`supportsShallowClone` calls `http.Head(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — builder/remotecontext/git/gitutils.go:142
What to do
Thread a context.Context through functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
`restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 325. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`. — daemon/daemon.go:325
`restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 582. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`. — daemon/daemon.go:582
`restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 635. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`. — daemon/daemon.go:635
`restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 666. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`. — daemon/daemon.go:666
What to do
In Go, hand values from a goroutine to the body waiting on it over a channel the body receives from, rather than through a map or slice beside a `sync.WaitGroup` or a signal channel — or hold one `sync.Mutex` over every access to the shared map or slice on both sides. The wait orders the signal; it takes no exclusion over the map's or slice's own state.
Do you agree with this assessment?
X27 · Collection changed while being enumerated7.8 / 10Strong✓ Tool-verified
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen. Whether a `for … range` leaves the slice or map it is walking alone — Go raises nothing, but the walk and the collection part: a range evaluates its slice once, so an element appended in the body is never visited and a removal by reslicing (`s = append(s[:i], s[i+1:]...)`, `slices.Delete`) shifts the next element under the index, which is then skipped while the last is read twice; a reslice, a reassignment or a sort leaves every later `s[i]` naming another element; and a map's order is unspecified, so deleting another key (or clearing the map) changes from run to run which entries the loop still sees.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
`s.Mounts` is walked by the `for … range` at line 100, and line 103 removes from (or inserts into) `s.Mounts` by shifting its elements in the backing array the loop is still reading: the element after each change moves under the index the loop has already passed, so it is skipped, and the last ones are read twice. — REDACTED:100
`ts.sums` is walked by the `for … range` at line 14, and line 16 removes from (or inserts into) `ts.sums` by shifting its elements in the backing array the loop is still reading: the element after each change moves under the index the loop has already passed, so it is skipped, and the last ones are read twice. — REDACTED:14
`realmark.keys()` is a live view over `realmark` by the `for` on line 110, and line 113 calls `del realmark[…]` inside the loop body — a change to the size of a dict this file builds. The loop's next step raises `RuntimeError: dictionary changed size during iteration`, so every pass that reaches this call ends the loop by exception and the remaining items are never seen. — REDACTED:110
`stasks.keys()` is a live view over `stasks` by the `for` on line 115, and line 118 calls `del stasks[…]` inside the loop body — a change to the size of a dict this file builds. The loop's next step raises `RuntimeError: dictionary changed size during iteration`, so every pass that reaches this call ends the loop by exception and the remaining items are never seen. — REDACTED:115
What to do
Each finding names the two lines that cannot both stand — the `for` over the collection (or its `keys()`/`values()`/`items()` view), and the call inside the body that changes its size. Confirm from those two, then pick one: walk a snapshot (`for k in list(d):`, `for x in s.copy():`); build the result instead of editing in place (`d = {k: v for k, v in d.items() if keep(v)}`); collect what needs removing and remove it after the loop; or — where only the first match was ever meant — `break` straight after the change, which is the one shape that is already safe. In Go: Each finding names the two lines that cannot both stand — the `for … range` over the collection, and the change to it in the body. Confirm from those two, then pick one: build the result instead of editing the walked collection (`var kept []T` … `kept = append(kept, v)`, or `kept := s[:0]` and assign `s = kept` after the loop; `slices.DeleteFunc(s, drop)` in one call); for a worklist that must visit what it adds, loop `for len(queue) > 0` or by index (`for i := 0; i < len(s); i++`); walk a copy (`range slices.Clone(s)`, `range slices.Collect(maps.Keys(m))`) and change the original; delete only the CURRENT key (`delete(m, k)`), which the specification allows; or — where only the first match was ever meant — `break` straight after the change.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard7.1 / 10Strong✓ Tool-verified
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
`index` is the result of a search that answers -1 when nothing is found, and `e[:index]` uses it as a bound with no test of `index` in between. When the search misses, the bound is -1 and the access panics with `slice bounds out of range`. Test `index < 0` (or use `strings.Cut`) before using it. — container/env.go:13
This condition tests `requested` for emptiness and then indexes it on a branch that test does not reach. `requested[0]` is evaluated whenever the guarded half is false — which includes the case the guard exists to anticipate, `requested` being empty — so an empty `requested` indexes position 0 of nothing and throws. This same condition already shows the intended bracketing at line 88: `requested[1]` sits INSIDE the guard. Either the guard is load-bearing, in which case this access escapes it and crashes, or `requested` cannot be empty here, in which case the guard beside it is dead code — the condition is wrong under both readings. Move the parenthesis so the emptiness test brackets every access to `requested`. — builder/dockerfile/dispatchers_windows.go:87
What to do
Each finding names the index access that escapes the guard and the line of the correctly bracketed access beside it. Compare the two: they differ only in where one parenthesis sits. Move it so the emptiness test brackets every access to that symbol — and if the value provably cannot be empty at this point, delete the test rather than leave a condition that guards one access and not its neighbour.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`createdAt, _ := v.CreatedAt()` writes the call's error to `_` and then uses `createdAt` as if the call succeeded. When `v.CreatedAt` fails, `createdAt` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `createdAt` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — volume/service/convert.go:84
`s.purge(ctx, name)` returns an error, and the statement drops it: when `s.purge` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := s.purge(ctx, name); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — volume/service/store.go:723
`exists, isDir, _ := p.fi.fileInfo(matchgroups["destination"])` writes the call's error to `_` and then uses `exists` as if the call succeeded. When `p.fi.fileInfo` fails, `exists` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `exists` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — volume/mounts/windows_parser.go:127
`mountpoint, _ := a.proxy.Path(a.name)` writes the call's error to `_` and then uses `mountpoint` as if the call succeeded. When `a.proxy.Path` fails, `mountpoint` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `mountpoint` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — volume/drivers/adapter.go:142
`if err := validateDriver(d); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — volume/drivers/extpoint.go:139
`f.ctx.Close()` returns an error, and the statement drops it: when `f.ctx.Close` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := f.ctx.Close(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — testutil/fakestorage/storage.go:112
`g.server.Close()` returns an error, and the statement drops it: when `g.server.Close` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := g.server.Close(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — testutil/fakegit/fakegit.go:43
`if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×16) — testutil/environment/environment.go:132, registry/config.go:364, quota/testhelpers.go:20, …
`if val, err := strconv.ParseBool(env); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — testutil/daemon/daemon.go:124
`ev, _ := windows.UTF16PtrFromString("Global\\docker-daemon-" + strconv.Itoa(pid))` writes the call's error to `_` and then uses `ev` as if the call succeeded. When `windows.UTF16PtrFromString` fails, `ev` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `ev` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — testutil/daemon/daemon_windows.go:15
`if err := unix.Uname(&uts); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — profiles/seccomp/kernel_linux.go:20
`out.WriteProgress(progress.Progress{ID: id, Action: "Already exists", LastUpdate: true})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Already exists", LastUpdate: true}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — plugin/fetch_linux.go:224
`out.WriteProgress(progress.Progress{ID: id, Action: "Download complete", Current: s.Offset, LastUpdate: true})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Download complete", Current: s.Offset, LastUpdate: true}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — plugin/fetch_linux.go:281
`out.WriteProgress(progress.Progress{ID: id, Action: "Downloading", Current: s.Offset, Total: s.Total})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Downloading", Current: s.Offset, Total: s.Total}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — plugin/fetch_linux.go:285
`pm.enable(p, c, true)` returns an error, and the statement drops it: when `pm.enable` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := pm.enable(p, c, true); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — plugin/manager.go:151
`pm.save(p)` returns an error, and the statement drops it: when `pm.save` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := pm.save(p); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — plugin/manager.go:240
`ts.writer.Flush()` returns an error, and the statement drops it: when `ts.writer.Flush` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := ts.writer.Flush(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. (×2) — pkg/tarsum/tarsum.go:257, pkg/tarsum/tarsum.go:278
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. — pkg/progress/progress.go:44
`out.WriteProgress(Progress{ID: id, Action: action})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{ID: id, Action: action}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — pkg/progress/progress.go:69
`out.WriteProgress(Progress{ID: id, Message: message})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{ID: id, Message: message}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — pkg/progress/progress.go:80
`out.WriteProgress(Progress{Aux: a})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{Aux: a}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — pkg/progress/progress.go:92
`p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.size, LastUpdate: last})` returns an error, and the statement drops it: when `p.out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.size, LastUpdate: last}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — pkg/progress/progressreader.go:64
`p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.Size, LastUpdate: p.current == p.Size})` returns an error, and the statement drops it: when `p.out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.Size, LastUpdate: p.current == p.Size}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter. — pkg/progress/progresssink.go:48
`if err == nil` reports `err` on the one path where it is nil, and the path where the call failed goes on without ever reading it: the comparison is inverted. The real failure is lost and a nil error (or a panic on `err.Error()`) is reported in its place. Test `err != nil` here. — pkg/process/process_windows.go:38
What to do
Discarded error (assigned to `_`, then its result used)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 2 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
D11 Test Reliability — 2 observation(s) recorded · This repository declares 2 of its own test(s) unreliable. The built-in reliability runner does not support this repository's ecosystem (.go), so the suite was not re-run and no reliability score is given — these are the repository's own declarations, not our measurement.
X10 Duplicated predicate — 21 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 60 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — Not applicable: this repository's Go imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
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 commits no project file of a kind this check models. 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)
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 commits no project file of a kind this check models. 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.
AXR1 Runtime accessibility — compose up failed (exit 17 — an image could not be built) — failed to solve: process "/bin/sh -c go get -tags 'mysql postgres file' github.com/golang-migrate/migrate/v4/cli@${MIGRATE_VER} && mv /go/bin/cli /go/bin/migrate" did not complete successfully: exit code: 1; likely cause (the repository): a RUN step of the repository's REDACTED exited with code 1 (`/bin/sh -c go get -tags 'mysql postgres file' github.com/golang-migrate/migrate/v4/cli@${MIGRATE_VER} && mv /go/bin/cli …`): the build's own command failed, for example a compile or test error; runtime evidence skipped The cause is in the repository, not in our sandbox: a RUN step of the repository's REDACTED exited with code 1 (`/bin/sh -c go get -tags 'mysql postgres file' github.com/golang-migrate/migrate/v4/cli@${MIGRATE_VER} && mv /go/bin/cli …`): the build's own command failed, for example a compile or test error. Nothing here says the surface is inaccessible, only that it was never rendered.
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.
D10 Test Quality — ~117476 lines of test source are present (.go) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. 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.
D24 Comment Value — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .go, .py, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — D26 measured no build unit over this repository's .c, .go source. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D27 Navigability — symbol resolution incomplete — navigability not assessed
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
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 — D5 reads a .NET project-reference graph only — this repository's production source is .go, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
D8 Code Coverage — Coverage not included — suite not readable by the collector
DM1 Domain Modelling — applicable but not scored (3 signals for this style, 2 needed — the count is met but a required primary signal is absent): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 2 strongly-typed id(s); 4 domain event(s); its domain events are published by services or handlers — no domain entity raises one
ED1 Handler temporal coupling — no event handlers detected — temporal-coupling check not applicable
ED5 Idempotency — Not assessed, and this one is on us: 1 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (3 Go aggregate(s) recording domain events (own events-slice append / raise-record))
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
PF3 Async & latency hygiene — Not applicable: Go has no async/await function colour, so there is no asynchronous code for a blocking call to stall.
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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X12 Unreachable branch — X12 reached only 0% of this repository's production lines — go (149,256 lines), c (183 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — 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
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern 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
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — 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
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
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
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X7 Silent fallback defaults — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
D11 · Test Reliability· Test declared unreliable · ×2
Test declared unreliable: TestBuildWCOWSandboxSize integration/build/build_test.go:521— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "FLAKY_TEST that needs to be fixed; see https://github.com/moby/moby/issues/42743". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Test declared unreliable: TestServiceRemoveKeepsIngressNetwork integration/network/service_test.go:253— This test is disabled or skipped with a reason naming unreliability — the repository's own words: "FLAKY_TEST". A test that is skipped for flakiness is neither passing nor protecting the code it covers; either stabilise it or delete it, but do not leave it disabled indefinitely. (Found by reading the repository's own test source — the suite itself was not re-run, since the reliability runner does not support this ecosystem.)
Boundary-crossing change coupling: REDACTED ↔ containerfs.go builder/dockerfile/copy.go:1— `builder/dockerfile/copy.go` (context builder) and `pkg/containerfs/containerfs.go` (context pkg) sit in DIFFERENT parts of the tree yet change together 55% of the time (6 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `b8f2caa8` pkg/containerfs: deprecate ResolveScopedPath; `9ce2b30b` pkg/containerfs: drop ContainerFS type alias; `7014c0d6` pkg/containerfs: drop PathDriver abstraction — run `git show` on any of them.
TodoComment volume/service/store.go:274— // TODO(@cpuguy83): It would be nice to optimize this by looking at the list — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/service/store.go:403— // TODO(@cpuguy83): plumb context through — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/service/store.go:521— // TODO(cpuguy83): With v2 plugins this shouldn't be a problem. Could also potentially — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/service/store.go:604— // TODO: there could be some inconsistent details such as labels here — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/service/store.go:765— // TODO(@cpuguy83): plumb through the context to lower level components — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/mounts/mounts.go:88— // TODO: Remove once the real bug is fixed: https://github.com/moby/moby/issues/46508
TodoComment volume/local/local.go:339— // TODO: Remove once the real bug is fixed: https://github.com/moby/moby/issues/46508
TodoComment volume/mounts/windows_parser.go:140— // TODO should windows mounts produce an error if any mode was provided (they're a no-op on windows) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment volume/local/local.go:205— // TODO(thaJeztah) is there a reason we're evaluating the data-path here, and not the volume's rootPath? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment testutil/request/request.go:147— // TODO: Share more code with client.defaultHTTPClient — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment testutil/fixtures/load/frozen.go:28— // TODO: This loads whatever is in the frozen image dir, regardless of what — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment testutil/fakestorage/storage.go:36— // TODO: decouple this package from environment — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment integration-cli/cli/cli.go:19— // TODO: decouple this package from environment — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment testutil/environment/environment.go:139— // TODO: print everything — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/auth.go:101— // TODO(dmcgowan): Attempt to further interpret result, status code and error code string — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/config.go:26— // TODO(thaJeztah) both the "index.docker.io" and "registry-1.docker.io" domains — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/config.go:347— // TODO: upstream this to check to reference package — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment REDACTED:133— // TODO(dmcgowan): Call close idle connections when complete and use keep alive — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment distribution/registry.go:96— // TODO(dmcgowan): Call close idle connections when complete and use keep alive — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/search.go:30— // TODO(thaJeztah): the "is-automated" field is deprecated; reset the field for the next release (v26.0.0). Return early when using "is-automated=true", and ignore "is-automated=false". — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/search.go:54— // TODO(thaJeztah): the "is-automated" field is deprecated. Reset the field for the next release (v26.0.0) if any "true" values are present. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/search.go:84— // TODO Use ctx when searching for repositories — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/service.go:56— // TODO Use ctx when searching for repositories — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/search.go:119— // TODO(thaJeztah); is there a reason not to include other headers here? (originally added in 19d48f0b8ba59eea9f2cac4ad1c7977712a6b7ac) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
TodoComment registry/search.go:156— // TODO(thaJeztah) this function is only used by the CLI, and used to get — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment testutil/request/request.go:149— // FIXME(vdemeester) 10*time.Second timeout of SockRequest… ? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment REDACTED:104— // FIXME(vdemeester) use a defer/clean func — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment REDACTED:119— // FIXME(vdemeester) use a defer/clean func — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment REDACTED:212— // FIXME(vdemeester) use a defer/clean func — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment testutil/daemon/daemon.go:92— // FIXME(vdemeester) should probably not be exported — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment profiles/seccomp/seccomp_test.go:215— // FIXME: try to fix omitempty for this — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/progress/progress.go:42— // FIXME: workaround for panic in #37735
FixmeComment pkg/authorization/middleware.go:66— // FIXME: Non trivial authorization mechanisms (such as advanced certificate validations, kerberos support — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment REDACTED:1243— // FIXME: specify behavior when target path exists vs. doesn't exist. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/archive_test.go:504— // FIXME Check the content — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/archive_test.go:533— // FIXME Check the content (the file inside) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/archive_test.go:577— // FIXME Test the src file and content — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/diff_unix.go:15— // FIXME(thaJeztah): we should get rid of these hacks if possible. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/wrap.go:23— // FIXME: stream content instead of buffering — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment pkg/archive/wrap.go:24— // FIXME: specify permissions and other archive metadata — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/controller.go:101— // FIXME(thaJeztah): defOsSbox is always nil on non-Linux: move these fields to Linux-only files. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/controller.go:347— // FIXME: every driver instance constructs a new DataStore — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/network.go:1534— // FIXME(thaJeztah): why are we ignoring invalid pools here? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/sandbox_store.go:270— // FIXME(thaJeztah): osSbox (and thus defOsSbox) is always nil on non-Linux: move this code to Linux-only files. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/store.go:80— // FIXME: unify with c.getNetworks() — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/store_linux_test.go:53— // FIXME(thaJeztah): GetObject uses the given key for lookups if no cache-store is present, but the KvObject's Key() to look up in cache.... — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/store_test.go:39— // FIXME(thaJeztah): GetObject uses the given key for lookups if no cache-store is present, but the KvObject's Key() to look up in cache.... — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/portmapper/mapper.go:178— // FIXME(thaJeztah): both stopping the proxy and deleting iptables rules can produce an error, and both are not currently handled. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/config/config.go:33— // FIXME(thaJeztah): ExecRoot is only used for Controller.startExternalKeyListener(), but "libnetwork-setkey" is only implemented on Linux. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FixmeComment libnetwork/config/config_freebsd.go:3— // FIXME(thaJeztah): ExecRoot is only used for Controller.startExternalKeyListener(), but "libnetwork-setkey" is only implemented on Linux. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
FileTooLong: libnetwork/network.go libnetwork/network.go— FileTooLong — 1270 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: Network (74 blocks, 172-2215). The bar is 500 significant lines; this is 770 over it, 2.54× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: daemon/daemon.go daemon/daemon.go— FileTooLong — 927 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 427 over it, 1.85× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: bridge/bridge_linux.go libnetwork/drivers/bridge/bridge_linux.go— FileTooLong — 921 significant lines (blank, comment-only and punctuation-only lines excluded), about 63% of them inside a single declaration: driver (23 blocks, 138-1536). The bar is 500 significant lines; this is 421 over it, 1.84× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 848 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 348 over it, 1.70× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 800 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 300 over it, 1.60× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: local/local_windows.go libcontainerd/local/local_windows.go— FileTooLong — 712 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 212 over it, 1.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 700 significant lines (blank, comment-only and punctuation-only lines excluded), about 84% of them inside a single declaration: Endpoint (39 blocks, 29-1131). The bar is 500 significant lines; this is 200 over it, 1.40× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: daemon/oci_linux.go daemon/oci_linux.go— FileTooLong — 683 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 183 over it, 1.37× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: distribution/pull_v2.go distribution/pull_v2.go— FileTooLong — 646 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 146 over it, 1.29× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: daemon/container_operations.go daemon/container_operations.go— FileTooLong — 626 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: Daemon (20 blocks, 45-1085). The bar is 500 significant lines; this is 126 over it, 1.25× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: daemon/daemon.go testutil/daemon/daemon.go— FileTooLong — 620 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: Daemon (38 blocks, 64-962). The bar is 500 significant lines; this is 120 over it, 1.24× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: libnetwork/agent.go libnetwork/agent.go— FileTooLong — 618 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 118 over it, 1.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: libnetwork/controller.go libnetwork/controller.go— FileTooLong — 609 significant lines (blank, comment-only and punctuation-only lines excluded), about 87% of them inside a single declaration: Controller (41 blocks, 82-1130). The bar is 500 significant lines; this is 109 over it, 1.22× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: containerimage/pull.go builder/builder-next/adapters/containerimage/pull.go— FileTooLong — 574 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 74 over it, 1.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: layer/layer_store.go layer/layer_store.go— FileTooLong — 573 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: layerStore (28 blocks, 33-917). The bar is 500 significant lines; this is 73 over it, 1.15× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: dockerd/daemon.go cmd/dockerd/daemon.go— FileTooLong — 563 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 63 over it, 1.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 540 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: Driver (25 blocks, 86-928). The bar is 500 significant lines; this is 40 over it, 1.08× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED libnetwork/drivers/windows/windows.go— FileTooLong — 540 significant lines (blank, comment-only and punctuation-only lines excluded), about 64% of them inside a single declaration: driver (17 blocks, 101-899). The bar is 500 significant lines; this is 40 over it, 1.08× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: container/container_routes.go api/server/router/container/container_routes.go— FileTooLong — 536 significant lines (blank, comment-only and punctuation-only lines excluded), about 88% of them inside a single declaration: containerRouter (22 blocks, 33-943). The bar is 500 significant lines; this is 36 over it, 1.07× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: daemon/network.go daemon/network.go— FileTooLong — 532 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 32 over it, 1.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: service/store.go volume/service/store.go— FileTooLong — 532 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: VolumeStore (19 blocks, 138-891). The bar is 500 significant lines; this is 32 over it, 1.06× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: awslogs/cloudwatchlogs.go daemon/logger/awslogs/cloudwatchlogs.go— FileTooLong — 517 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 17 over it, 1.03× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 517 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: Manager (13 blocks, 51-739). The bar is 500 significant lines; this is 17 over it, 1.03× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
Duplicated block (9 lines × 2) builder/builder-next/adapters/containerimage/pull.go:366— builder/builder-next/adapters/containerimage/pull.go:366-374 | builder/builder-next/worker/worker.go:343-351 — 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 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 × 2) daemon/container_operations.go:138— daemon/container_operations.go:138-146 | daemon/network.go:756-764 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/container_operations.go:138` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (9 lines × 2) daemon/containerd/image_import.go:239— daemon/containerd/image_import.go:239-247 | daemon/containerd/image_import.go:278-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. 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) daemon/containerd/image_list.go:363— daemon/containerd/image_list.go:363-371 | daemon/images/image_list.go:65-73 — 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) daemon/debugtrap_unix.go:20— daemon/debugtrap_unix.go:20-28 | REDACTED:38-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/debugtrap_unix.go:20` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:450— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:450-458 | daemon/graphdriver/overlay2/overlay.go:685-694 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:450` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:461` calls `RunningInUserNS` and `daemon/graphdriver/overlay2/overlay.go:696` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (9 lines × 2) libcontainerd/local/local_windows.go:781— libcontainerd/local/local_windows.go:781-789 | libcontainerd/local/local_windows.go:822-830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (9 lines × 2) libnetwork/diagnostic/server.go:138— libnetwork/diagnostic/server.go:138-146 | libnetwork/diagnostic/server.go:159-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/diagnostic/server.go:138` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) libnetwork/drivers/bridge/bridge_store.go:329— libnetwork/drivers/bridge/bridge_store.go:329-337 | libnetwork/drivers/windows/windows_store.go:275-283 — `libnetwork/drivers/bridge/bridge_store.go` and `libnetwork/drivers/windows/windows_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 48 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_store.go:329` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9 lines × 2) daemon/containerd/image_delete.go:254— daemon/containerd/image_delete.go:254-262 | daemon/images/image_delete.go:207-217 — 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) testutil/daemon/config.go:16— testutil/daemon/config.go:16-24 | testutil/daemon/secret.go:16-25 — before extracting anything, compare `testutil/daemon/config.go` and `testutil/daemon/secret.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also 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 × 2) testutil/daemon/config.go:27— testutil/daemon/config.go:27-35 | testutil/daemon/secret.go:28-36 — before extracting anything, compare `testutil/daemon/config.go` and `testutil/daemon/secret.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also 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 × 2) testutil/daemon/config.go:38— testutil/daemon/config.go:38-46 | testutil/daemon/secret.go:39-47 — before extracting anything, compare `testutil/daemon/config.go` and `testutil/daemon/secret.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also 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 × 2) testutil/daemon/node.go:72— testutil/daemon/node.go:72-81 | testutil/daemon/service.go:100-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also 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 × 2) REDACTED:65— REDACTED:65-73 | pkg/archive/changes_other.go:67-77 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:65` it begins part-way through the construct above it, so those 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) api/server/router/swarm/cluster_routes.go:196— api/server/router/swarm/cluster_routes.go:196-205 | api/server/router/swarm/cluster_routes.go:271-279 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `api/server/router/swarm/cluster_routes.go:196` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) libnetwork/drivers/overlay/encryption.go:302— libnetwork/drivers/overlay/encryption.go:302-310 | libnetwork/drivers/overlay/encryption.go:329-337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/overlay/encryption.go:302` 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) api/server/router/swarm/cluster_routes.go:75— api/server/router/swarm/cluster_routes.go:75-83 | api/server/router/swarm/cluster_routes.go:350-358 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `api/server/router/swarm/cluster_routes.go:75` it begins part-way through the construct above it, so those 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) libnetwork/drivers/ipvlan/ipvlan_store.go:299— libnetwork/drivers/ipvlan/ipvlan_store.go:299-307 | libnetwork/drivers/macvlan/macvlan_store.go:293-301 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:299` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) libnetwork/controller.go:662— libnetwork/controller.go:662-670 | libnetwork/controller.go:674-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/controller.go:662` it begins part-way through the construct above it, so those 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 (9 lines × 2) libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go:36— libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go:36-44 | libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go:59-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Swallowed exception (caught, then discarded) volume/drivers/extpoint.go:139— `if err := validateDriver(d); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) testutil/environment/environment.go:132— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) testutil/daemon/daemon.go:124— `if val, err := strconv.ParseBool(env); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) registry/config.go:364— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) quota/testhelpers.go:20— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) profiles/seccomp/kernel_linux.go:20— `if err := unix.Uname(&uts); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) plugin/progress.go:48— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/cgroup2_linux.go:61— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/cgroup2_linux.go:123— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/cgroup2_linux.go:129— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/numcpu_linux.go:13— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/sysinfo_linux.go:239— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/sysinfo_linux.go:245— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/sysinfo/sysinfo_linux.go:302— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/streamformatter/streamformatter.go:56— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/streamformatter/streamformatter.go:69— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/process/process_windows.go:12— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/plugins/discovery.go:47— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) pkg/plugins/discovery.go:74— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
MethodTooLong: Daemon.restore daemon/daemon.go:256— MethodTooLong — restore runs 252 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 152 over it, 2.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Reader.TestFollow daemon/logger/loggertest/logreader.go:196— MethodTooLong — TestFollow runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: DaemonCli.start cmd/dockerd/daemon.go:96— MethodTooLong — start runs 144 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 44 over it, 1.44× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Builder.Build builder/builder-next/builder.go:229— MethodTooLong — Build runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: puller.Snapshot builder/builder-next/adapters/containerimage/pull.go:382— MethodTooLong — Snapshot runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ImageService.DeltaCreate daemon/images/image_delta.go:30— MethodTooLong — DeltaCreate runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: ImageService.Images daemon/images/image_list.go:37— MethodTooLong — Images runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: saveSession.save image/tarexport/save.go:182— MethodTooLong — save runs 127 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 27 over it, 1.27× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Daemon.registerMountPoints daemon/volumes.go:57— MethodTooLong — registerMountPoints runs 123 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 23 over it, 1.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Daemon.ContainerExecStart daemon/exec.go:151— MethodTooLong — ContainerExecStart runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Controller.NewNetwork libnetwork/controller.go:471— MethodTooLong — NewNetwork runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: client.createWindows libcontainerd/local/local_windows.go:180— MethodTooLong — createWindows runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Daemon.StartWithLogFile testutil/daemon/daemon.go:434— MethodTooLong — StartWithLogFile runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: puller.pullSchema2Layers distribution/pull_v2.go:547— MethodTooLong — pullSchema2Layers runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Daemon.buildSandboxOptions daemon/container_operations.go:45— MethodTooLong — buildSandboxOptions runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: LayerDownloadManager.makeDownloadFunc distribution/xfer/download.go:238— MethodTooLong — makeDownloadFunc runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: tarexporter.Load image/tarexport/load.go:33— MethodTooLong — Load runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: driver.CreateEndpoint libnetwork/drivers/bridge/bridge_linux.go:918— MethodTooLong — CreateEndpoint runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (7 lines × 2) api/server/router/swarm/cluster_routes.go:475— api/server/router/swarm/cluster_routes.go:475-481 | api/server/router/swarm/cluster_routes.go:547-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `api/server/router/swarm/cluster_routes.go:475` 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) builder/builder-next/adapters/containerimage/pull.go:321— builder/builder-next/adapters/containerimage/pull.go:321-327 | builder/builder-next/adapters/containerimage/pull.go:341-347 — both copies are in the same file, so extract the 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) daemon/graphdriver/overlay2/overlay.go:534— daemon/graphdriver/overlay2/overlay.go:534-540 | daemon/graphdriver/zfs/zfs.go:369-375 — 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 `daemon/graphdriver/overlay2/overlay.go:534` 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 (7 lines × 2) daemon/logger/plugin.go:58— daemon/logger/plugin.go:58-64 | volume/drivers/extpoint.go:226-232 — 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 `daemon/logger/plugin.go:58` 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) integration-cli/daemon/daemon_swarm.go:68— integration-cli/daemon/daemon_swarm.go:68-74 | integration-cli/daemon/daemon_swarm.go:81-87 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `integration-cli/daemon/daemon_swarm.go:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) libnetwork/drivers/bridge/bridge_linux.go:848— libnetwork/drivers/bridge/bridge_linux.go:848-854 | libnetwork/drivers/bridge/bridge_linux.go:1152-1158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_linux.go:848` 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) libnetwork/drivers/bridge/setup_ip_forwarding.go:50— libnetwork/drivers/bridge/setup_ip_forwarding.go:50-56 | libnetwork/drivers/bridge/setup_ip_forwarding.go:65-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/setup_ip_forwarding.go:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) builder/builder-next/executor_linux.go:180— builder/builder-next/executor_linux.go:180-186 | daemon/container_operations.go:37-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) libnetwork/drvregistry/ipams.go:27— libnetwork/drvregistry/ipams.go:27-33 | libnetwork/drvregistry/networks.go:53-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also 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 (7 lines × 2) pkg/parsers/operatingsystem/operatingsystem_unix.go:12— pkg/parsers/operatingsystem/operatingsystem_unix.go:12-18 | pkg/platform/platform_unix.go:10-16 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) daemon/logger/loggertest/logreader.go:226— daemon/logger/loggertest/logreader.go:226-233 | daemon/logger/loggertest/logreader.go:354-360 — both copies are in the same file, so extract the 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) api/server/router/swarm/cluster_routes.go:437— api/server/router/swarm/cluster_routes.go:437-443 | api/server/router/swarm/cluster_routes.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. 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) internal/testutils/specialimage/dangling.go:20— internal/testutils/specialimage/dangling.go:20-26 | REDACTED:14-20 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) libnetwork/drivers/overlay/joinleave.go:205— libnetwork/drivers/overlay/joinleave.go:205-211 | libnetwork/drivers/overlay/joinleave.go:214-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/overlay/joinleave.go:205` it begins part-way through the construct above it, so those 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) libnetwork/networkdb/networkdbdiagnostic.go:323— libnetwork/networkdb/networkdbdiagnostic.go:323-329 | libnetwork/networkdb/networkdbdiagnostic.go:355-361 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/networkdbdiagnostic.go:323` it begins part-way through the construct above it, so those 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) libnetwork/drivers/bridge/port_mapping_linux.go:45— libnetwork/drivers/bridge/port_mapping_linux.go:45-51 | libnetwork/drivers/bridge/port_mapping_linux.go:71-77 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) libnetwork/drivers/bridge/bridge_linux.go:998— libnetwork/drivers/bridge/bridge_linux.go:998-1004 | libnetwork/drivers/bridge/bridge_linux.go:1011-1017 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_linux.go:998` 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 (7 lines × 2) libnetwork/networkdb/networkdbdiagnostic.go:140— libnetwork/networkdb/networkdbdiagnostic.go:140-146 | libnetwork/networkdb/networkdbdiagnostic.go:189-195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/networkdbdiagnostic.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.
TooManyMethods: Daemon daemon/daemon.go:101— TooManyMethods — 286 methods, declared across 71 files: daemon/daemon.go (37), daemon/container_operations.go (20), daemon/network.go (16), daemon/container.go (14), +67 more file(s). The bar is 30 methods; this is 256 over it, 9.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Client client/client.go:102— TooManyMethods — 152 methods, declared across 108 files: client/client.go (12), client/request.go (12), client/container_exec.go (4), client/plugin_install.go (4), +104 more file(s). The bar is 30 methods; this is 122 over it, 5.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Controller libnetwork/controller.go:82— TooManyMethods — 86 methods, declared across 13 files: libnetwork/controller.go (40), libnetwork/agent.go (11), libnetwork/service_common.go (9), libnetwork/store.go (9), +9 more file(s). The bar is 30 methods; this is 56 over it, 2.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Network libnetwork/network.go:172— TooManyMethods — 86 methods, declared across 5 files: libnetwork/network.go (73), libnetwork/agent.go (7), libnetwork/service_linux.go (3), libnetwork/store.go (2), +1 more file(s). The bar is 30 methods; this is 56 over it, 2.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Daemon testutil/daemon/daemon.go:64— TooManyMethods — 82 methods, declared across 9 files: daemon/daemon.go (37), daemon/swarm.go (16), daemon/service.go (8), daemon/config.go (5), +5 more file(s). The bar is 30 methods; this is 52 over it, 2.73× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ImageService daemon/containerd/service.go:29— TooManyMethods — 76 methods, declared across 27 files: containerd/service.go (11), containerd/image.go (9), containerd/image_delete.go (5), containerd/image_builder.go (4), +23 more file(s). The bar is 30 methods; this is 46 over it, 2.53× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: NetworkDB libnetwork/networkdb/networkdb.go:35— TooManyMethods — 71 methods, declared across 8 files: networkdb/networkdb.go (22), networkdb/cluster.go (19), networkdb/networkdbdiagnostic.go (12), networkdb/delegate.go (9), +4 more file(s). The bar is 30 methods; this is 41 over it, 2.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Container container/container.go:62— TooManyMethods — 64 methods, declared across 5 files: container/container.go (42), container/container_unix.go (15), container/container_windows.go (4), container/archive_windows.go (2), +1 more file(s). The bar is 30 methods; this is 34 over it, 2.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Endpoint REDACTED:29— TooManyMethods — 59 methods, declared across 6 files: REDACTED (38), REDACTED (14), libnetwork/agent.go (4), libnetwork/default_gateway.go (1), +2 more file(s). The bar is 30 methods; this is 29 over it, 1.97× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Sandbox libnetwork/sandbox.go:36— TooManyMethods — 56 methods, declared across 6 files: libnetwork/sandbox.go (27), libnetwork/sandbox_dns_unix.go (12), libnetwork/sandbox_linux.go (7), libnetwork/default_gateway.go (5), +2 more file(s). The bar is 30 methods; this is 26 over it, 1.87× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: ImageService daemon/images/service.go:70— TooManyMethods — 49 methods, declared across 20 files: images/service.go (13), images/image_delete.go (6), images/image.go (5), images/image_builder.go (3), +16 more file(s). The bar is 30 methods; this is 19 over it, 1.63× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Manager plugin/manager.go:78— TooManyMethods — 34 methods, declared across 7 files: REDACTED (13), plugin/manager.go (8), plugin/manager_linux.go (8), plugin/registry.go (2), +3 more file(s). The bar is 30 methods; this is 4 over it, 1.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: containerRouter api/server/router/container/container.go:9— TooManyMethods — 33 methods, declared across 5 files: container/container_routes.go (22), REDACTED (4), container/exec.go (4), container/container.go (2), +1 more file(s). The bar is 30 methods; this is 3 over it, 1.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: swarmRouter api/server/router/swarm/cluster.go:6— TooManyMethods — 33 methods, declared across 3 files: swarm/cluster_routes.go (30), swarm/cluster.go (2), swarm/helpers.go (1). The bar is 30 methods; this is 3 over it, 1.10× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: layerStore layer/layer_store.go:33— TooManyMethods — 31 methods, declared across 4 files: layer/layer_store.go (27), REDACTED (2), layer/layer_store_windows.go (1), layer/layer_unix.go (1). The bar is 30 methods; this is 1 over it, 1.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Namespace libnetwork/osl/namespace_linux.go:323— TooManyMethods — 31 methods, declared across 4 files: osl/namespace_linux.go (13), osl/route_linux.go (12), osl/interface_linux.go (3), osl/neigh_linux.go (3). The bar is 30 methods; this is 1 over it, 1.03× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (11 lines × 2) client/container_prune.go:26— client/container_prune.go:26-36 | client/image_prune.go:26-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/container_prune.go:26` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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) daemon/container_operations.go:124— daemon/container_operations.go:124-134 | daemon/network.go:742-752 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/container_operations.go:124` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (11 lines × 2) daemon/containerd/image_builder.go:143— daemon/containerd/image_builder.go:143-153 | daemon/images/image_builder.go:159-169 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `daemon/images/image_builder.go:157` calls `TagNameOnly` and `daemon/containerd/image_builder.go:141` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:201— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:201-211 | daemon/graphdriver/overlay2/overlay.go:395-405 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.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. 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) daemon/graphdriver/graphtest/graphbench_unix.go:17— daemon/graphdriver/graphtest/graphbench_unix.go:17-27 | daemon/graphdriver/graphtest/graphbench_unix.go:36-46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/graphtest/graphbench_unix.go:17` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) daemon/graphdriver/graphtest/graphbench_unix.go:61— daemon/graphdriver/graphtest/graphbench_unix.go:61-71 | daemon/graphdriver/graphtest/graphbench_unix.go:191-201 — both copies are in the same file, so extract the 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) daemon/info_unix.go:208— daemon/info_unix.go:208-218 | daemon/info_unix.go:483-493 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/info_unix.go:208` it begins part-way through the construct above it, so those 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) daemon/logger/loggertest/logreader.go:335— daemon/logger/loggertest/logreader.go:335-345 | daemon/logger/loggertest/logreader.go:362-372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) integration-cli/daemon/daemon_swarm.go:102— integration-cli/daemon/daemon_swarm.go:102-112 | integration-cli/daemon/daemon_swarm.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. Read the line range as the matched WINDOW rather than a finished unit: at `integration-cli/daemon/daemon_swarm.go:102` 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) libnetwork/agent.go:571— libnetwork/agent.go:571-581 | libnetwork/agent.go:590-600 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/agent.go:571` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:30— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:30-40 | libnetwork/drivers/macvlan/macvlan_joinleave.go:18-28 — `libnetwork/drivers/ipvlan/ipvlan_joinleave.go` and `libnetwork/drivers/macvlan/macvlan_joinleave.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_joinleave.go:30` 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) libnetwork/drivers/ipvlan/ipvlan_store.go:179— libnetwork/drivers/ipvlan/ipvlan_store.go:179-189 | libnetwork/drivers/macvlan/macvlan_store.go:177-187 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (11 lines × 2) libnetwork/drivers/ipvlan/ipvlan_state.go:37— libnetwork/drivers/ipvlan/ipvlan_state.go:37-47 | libnetwork/drivers/macvlan/macvlan_state.go:37-47 — `libnetwork/drivers/ipvlan/ipvlan_state.go` and `libnetwork/drivers/macvlan/macvlan_state.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 57 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also 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) libnetwork/drivers/ipvlan/ipvlan_store.go:93— libnetwork/drivers/ipvlan/ipvlan_store.go:93-103 | libnetwork/drivers/macvlan/macvlan_store.go:92-102 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.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.
Duplicated block (11 lines × 2) client/config_create.go:15— client/config_create.go:15-25 | client/secret_create.go:15-25 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/config_create.go:15` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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) libnetwork/drivers/ipvlan/ipvlan_store.go:78— libnetwork/drivers/ipvlan/ipvlan_store.go:78-88 | libnetwork/drivers/macvlan/macvlan_store.go:77-87 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:78` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) api/server/router/swarm/cluster_routes.go:208— api/server/router/swarm/cluster_routes.go:208-215 | api/server/router/swarm/cluster_routes.go:240-247 — both copies are in the same file, so extract the 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) container/container_unix.go:457— container/container_unix.go:457-464 | container/container_windows.go:191-198 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `container/container_unix.go:457` 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) daemon/daemon.go:321— daemon/daemon.go:321-328 | daemon/daemon.go:348-355 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/daemon.go:321` 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 (8 lines × 2) daemon/daemon_windows.go:284— daemon/daemon_windows.go:284-291 | daemon/daemon_windows.go:389-396 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/daemon_windows.go:284` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:190— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:190-197 | daemon/graphdriver/overlay2/overlay.go:384-391 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) integration/internal/container/ops.go:144— integration/internal/container/ops.go:144-151 | integration/internal/container/ops.go:160-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `integration/internal/container/ops.go:144` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) libnetwork/drivers/overlay/joinleave.go:205— libnetwork/drivers/overlay/joinleave.go:205-212 | libnetwork/drivers/windows/overlay/joinleave_windows.go:96-103 — 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 `libnetwork/drivers/overlay/joinleave.go:205` it begins part-way through the construct above it, so those 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) libnetwork/networkdb/networkdb.go:413— libnetwork/networkdb/networkdb.go:413-420 | libnetwork/networkdb/networkdb.go:440-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) volume/local/local_unix.go:68— volume/local/local_unix.go:68-75 | volume/local/local_unix.go:98-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `volume/local/local_unix.go:68` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) cmd/dockerd/metrics.go:29— cmd/dockerd/metrics.go:29-36 | daemon/metrics_unix.go:36-43 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/dockerd/metrics.go:29` it begins part-way through the construct above it, so those 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) daemon/logger/jsonfilelog/jsonfilelog.go:37— daemon/logger/jsonfilelog/jsonfilelog.go:37-44 | daemon/logger/local/local.go:55-62 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) distribution/metadata/metadata.go:31— distribution/metadata/metadata.go:31-38 | layer/filestore.go:52-59 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (8 lines × 2) testutil/daemon/config.go:49— testutil/daemon/config.go:49-56 | testutil/daemon/secret.go:50-57 — before extracting anything, compare `testutil/daemon/config.go` and `testutil/daemon/secret.go` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also 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 (8 lines × 2) libnetwork/drivers/windows/overlay/joinleave_windows.go:64— libnetwork/drivers/windows/overlay/joinleave_windows.go:64-73 | libnetwork/drivers/windows/overlay/joinleave_windows.go:75-82 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/windows/overlay/joinleave_windows.go:64` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) libnetwork/types/types.go:261— libnetwork/types/types.go:261-268 | libnetwork/types/types.go:280-287 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/types/types.go:261` 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) libnetwork/network.go:1363— libnetwork/network.go:1363-1370 | libnetwork/network.go:1395-1402 — both copies are in the same file, so extract the block into 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) client/container_stats.go:19— client/container_stats.go:19-28 | client/container_stats.go:37-46 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/container_stats.go:19` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) client/node_list.go:15— client/node_list.go:15-24 | client/task_list.go:15-24 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) client/plugin_install.go:19— client/plugin_install.go:19-28 | client/plugin_upgrade.go:20-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) daemon/containerd/image_list.go:323— daemon/containerd/image_list.go:323-332 | daemon/containerd/image_list.go:343-352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/containerd/image_list.go:323` 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) daemon/containerd/image_snapshot_unix.go:46— daemon/containerd/image_snapshot_unix.go:46-55 | daemon/containerd/image_snapshot_unix.go:97-106 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/containerd/image_snapshot_unix.go:46` 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) distribution/xfer/download.go:239— distribution/xfer/download.go:239-248 | distribution/xfer/download.go:406-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 `distribution/xfer/download.go:239` 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 (10 lines × 2) distribution/xfer/download.go:359— distribution/xfer/download.go:359-368 | distribution/xfer/download.go:458-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `distribution/xfer/download.go:359` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `distribution/xfer/download.go:356` calls `DeltaBase`, `DecorateWithDeltaPatcher` and `distribution/xfer/download.go:456` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:183— libnetwork/drivers/ipvlan/ipvlan_setup.go:183-192 | libnetwork/drivers/macvlan/macvlan_setup.go:163-172 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_setup.go:183` 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) daemon/containerd/image_prune.go:22— daemon/containerd/image_prune.go:22-31 | daemon/images/image_prune.go:24-33 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (10 lines × 2) libnetwork/drivers/ipvlan/ipvlan_state.go:13— libnetwork/drivers/ipvlan/ipvlan_state.go:13-22 | libnetwork/drivers/macvlan/macvlan_state.go:13-22 — `libnetwork/drivers/ipvlan/ipvlan_state.go` and `libnetwork/drivers/macvlan/macvlan_state.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 57 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (10 lines × 2) client/plugin_list.go:20— client/plugin_list.go:20-29 | client/volume_list.go:20-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/plugin_list.go:20` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (10 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:31— libnetwork/drivers/ipvlan/ipvlan_setup.go:31-40 | libnetwork/drivers/macvlan/macvlan_setup.go:24-33 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_setup.go:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) libnetwork/drivers/ipvlan/ipvlan_store.go:278— libnetwork/drivers/ipvlan/ipvlan_store.go:278-287 | libnetwork/drivers/macvlan/macvlan_store.go:272-281 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:278` 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) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:648— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:648-657 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:694-703 — both copies are in the same file, so extract the block into 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) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:545— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:545-554 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:641-650 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Low cohesion: Daemon (LCOM4 17) daemon/daemon.go:101— Daemon's methods fall into 17 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 17 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Daemon (LCOM4 13) integration-cli/daemon/daemon.go:17— Daemon's methods fall into 13 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 13 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Daemon (LCOM4 6) testutil/daemon/daemon.go:64— Daemon's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: networkConfiguration (LCOM4 5) libnetwork/drivers/windows/windows.go:34— networkConfiguration's methods fall into 5 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 5 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Config (LCOM4 4) daemon/config/config_linux.go:74— Config's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: task (LCOM4 4) libcontainerd/remote/client.go:62— task's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: networkConfiguration (LCOM4 4) libnetwork/drivers/bridge/bridge_linux.go:60— networkConfiguration's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: bridgeEndpoint (LCOM4 4) libnetwork/drivers/bridge/bridge_linux.go:111— bridgeEndpoint's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: endpoint (LCOM4 4) libnetwork/drivers/ipvlan/ipvlan.go:45— endpoint's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: configuration (LCOM4 4) libnetwork/drivers/ipvlan/ipvlan_store.go:25— configuration's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: endpoint (LCOM4 4) libnetwork/drivers/macvlan/macvlan.go:39— endpoint's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: configuration (LCOM4 4) libnetwork/drivers/macvlan/macvlan_store.go:25— configuration's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: Execution (LCOM4 4) testutil/environment/environment.go:22— Execution's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: volumeWrapper (LCOM4 4) volume/service/store.go:30— volumeWrapper's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
Low cohesion: hnsEndpoint (LCOM4 4) libnetwork/drivers/windows/windows.go:69— hnsEndpoint's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
X3 · Exception handling· Discarded error (an error-returning call as a bare statement) · ×15
Discarded error (an error-returning call as a bare statement) volume/service/store.go:723— `s.purge(ctx, name)` returns an error, and the statement drops it: when `s.purge` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := s.purge(ctx, name); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) testutil/fakestorage/storage.go:112— `f.ctx.Close()` returns an error, and the statement drops it: when `f.ctx.Close` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := f.ctx.Close(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) testutil/fakegit/fakegit.go:43— `g.server.Close()` returns an error, and the statement drops it: when `g.server.Close` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := g.server.Close(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) plugin/fetch_linux.go:224— `out.WriteProgress(progress.Progress{ID: id, Action: "Already exists", LastUpdate: true})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Already exists", LastUpdate: true}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) plugin/fetch_linux.go:281— `out.WriteProgress(progress.Progress{ID: id, Action: "Download complete", Current: s.Offset, LastUpdate: true})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Download complete", Current: s.Offset, LastUpdate: true}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) plugin/fetch_linux.go:285— `out.WriteProgress(progress.Progress{ID: id, Action: "Downloading", Current: s.Offset, Total: s.Total})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(progress.Progress{ID: id, Action: "Downloading", Current: s.Offset, Total: s.Total}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) plugin/manager.go:151— `pm.enable(p, c, true)` returns an error, and the statement drops it: when `pm.enable` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := pm.enable(p, c, true); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) plugin/manager.go:240— `pm.save(p)` returns an error, and the statement drops it: when `pm.save` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := pm.save(p); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/tarsum/tarsum.go:257— `ts.writer.Flush()` returns an error, and the statement drops it: when `ts.writer.Flush` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := ts.writer.Flush(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/tarsum/tarsum.go:278— `ts.writer.Flush()` returns an error, and the statement drops it: when `ts.writer.Flush` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := ts.writer.Flush(); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/progress/progress.go:69— `out.WriteProgress(Progress{ID: id, Action: action})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{ID: id, Action: action}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/progress/progress.go:80— `out.WriteProgress(Progress{ID: id, Message: message})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{ID: id, Message: message}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/progress/progress.go:92— `out.WriteProgress(Progress{Aux: a})` returns an error, and the statement drops it: when `out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := out.WriteProgress(Progress{Aux: a}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/progress/progressreader.go:64— `p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.size, LastUpdate: last})` returns an error, and the statement drops it: when `p.out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.size, LastUpdate: last}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
Discarded error (an error-returning call as a bare statement) pkg/progress/progresssink.go:48— `p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.Size, LastUpdate: p.current == p.Size})` returns an error, and the statement drops it: when `p.out.WriteProgress` fails nothing records it and the code after it runs as if it had succeeded. Check it (`if err := p.out.WriteProgress(Progress{ID: p.id, Action: p.action, Current: p.current, Total: p.Size, LastUpdate: p.current == p.Size}); err != nil { … }`) and return or log it with what was being done, or assign it to `_` with a comment saying why the failure cannot matter.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×12
Edited copy of a member (14 corresponding lines) libnetwork/networkdb/cluster.go:57— libnetwork/networkdb/cluster.go:57-71 | libnetwork/networkdb/cluster.go:91-104 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) container/container_unix.go:456— container/container_unix.go:456-471 | container/container_windows.go:190-203 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) client/config_create.go:12— client/config_create.go:12-25 | client/secret_create.go:12-25 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) daemon/disk_usage.go:19— daemon/disk_usage.go:19-32 | daemon/disk_usage.go:36-51 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) libnetwork/drivers/overlay/peerdb.go:50— libnetwork/drivers/overlay/peerdb.go:50-63 | libnetwork/drivers/overlay/peerdb.go:65-79 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) daemon/graphdriver/vfs/driver.go:231— daemon/graphdriver/vfs/driver.go:231-244 | layer/filestore.go:116-131 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) integration/internal/container/states.go:35— integration/internal/container/states.go:35-48 | integration/internal/container/states.go:51-65 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) REDACTED:221— REDACTED:221-235 | REDACTED:248-261 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) pkg/ioutils/fswriters.go:31— pkg/ioutils/fswriters.go:31-45 | pkg/ioutils/fswriters.go:123-136 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) libnetwork/osl/route_linux.go:61— libnetwork/osl/route_linux.go:61-74 | libnetwork/osl/route_linux.go:158-172 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) libnetwork/drivers/windows/overlay/ov_network_windows.go:351— libnetwork/drivers/windows/overlay/ov_network_windows.go:351-364 | libnetwork/drivers/windows/overlay/ov_network_windows.go:367-383 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) daemon/logger/journald/journald.go:143— daemon/logger/journald/journald.go:143-156 | daemon/logger/jsonfilelog/jsonfilelog.go:155-171 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (15 lines × 2) client/service_logs.go:31— client/service_logs.go:31-45 | client/task_logs.go:30-44 — before extracting anything, compare `client/service_logs.go` and `client/task_logs.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/service_logs.go:31` it begins part-way through the construct above it, so those 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) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:172— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:172-186 | daemon/graphdriver/overlay2/overlay.go:356-370 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:172` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (15 lines × 2) image/tarexport/save.go:314— image/tarexport/save.go:314-328 | image/tarexport/save.go:332-346 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) libnetwork/datastore/cache.go:84— libnetwork/datastore/cache.go:84-98 | libnetwork/datastore/cache.go:112-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/datastore/cache.go:84` 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) libnetwork/drivers/ipvlan/ipvlan_network.go:167— libnetwork/drivers/ipvlan/ipvlan_network.go:167-181 | libnetwork/drivers/macvlan/macvlan_network.go:157-171 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 2) libnetwork/drivers/ipvlan/ipvlan_store.go:261— libnetwork/drivers/ipvlan/ipvlan_store.go:261-275 | libnetwork/drivers/macvlan/macvlan_store.go:255-269 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) libnetwork/osl/namespace_linux.go:194— libnetwork/osl/namespace_linux.go:194-208 | libnetwork/osl/namespace_linux.go:243-257 — both copies are in the same file, so extract the 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 (15 lines × 2) volume/mounts/linux_parser.go:249— volume/mounts/linux_parser.go:249-263 | volume/mounts/windows_parser.go:336-350 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (15 lines × 2) libnetwork/drivers/ipvlan/ipvlan_store.go:197— libnetwork/drivers/ipvlan/ipvlan_store.go:197-211 | libnetwork/drivers/macvlan/macvlan_store.go:189-203 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:197` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:261— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:261-275 | daemon/graphdriver/overlay2/overlay.go:475-489 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (15 lines × 2) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:139— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:139-153 | libnetwork/drivers/macvlan/macvlan_joinleave.go:100-114 — `libnetwork/drivers/ipvlan/ipvlan_joinleave.go` and `libnetwork/drivers/macvlan/macvlan_joinleave.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (15 lines × 2) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:40— libnetwork/drivers/ipvlan/ipvlan_endpoint.go:40-54 | libnetwork/drivers/macvlan/macvlan_endpoint.go:45-59 — `libnetwork/drivers/ipvlan/ipvlan_endpoint.go` and `libnetwork/drivers/macvlan/macvlan_endpoint.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_endpoint.go:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) daemon/containerd/image.go:327— daemon/containerd/image.go:327-332 | daemon/containerd/image.go:451-456 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/containerd/image.go:327` 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) libnetwork/drivers/ipvlan/ivmanager/ivmanager.go:14— libnetwork/drivers/ipvlan/ivmanager/ivmanager.go:14-19 | libnetwork/drivers/macvlan/mvmanager/mvmanager.go:14-19 — before extracting anything, compare `libnetwork/drivers/ipvlan/ivmanager/ivmanager.go` and `libnetwork/drivers/macvlan/mvmanager/mvmanager.go` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
Duplicated block (6 lines × 2) libnetwork/drivers/bridge/brmanager/brmanager.go:14— libnetwork/drivers/bridge/brmanager/brmanager.go:14-19 | libnetwork/drivers/host/host.go:18-23 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (6 lines × 2) libnetwork/agent.go:634— libnetwork/agent.go:634-639 | libnetwork/agent.go:703-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (6 lines × 2) daemon/logger/loggertest/logreader.go:99— daemon/logger/loggertest/logreader.go:99-104 | daemon/logger/loggertest/logreader.go:106-111 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/logger/loggertest/logreader.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 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 (6 lines × 2) libnetwork/diagnostic/server.go:127— libnetwork/diagnostic/server.go:127-132 | libnetwork/diagnostic/server.go:163-168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libnetwork/diagnostic/server.go:124` calls `WrongCommand`, `Sprintf` and `libnetwork/diagnostic/server.go:160` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) libnetwork/cmd/diagnostic/main.go:121— libnetwork/cmd/diagnostic/main.go:121-126 | libnetwork/cmd/diagnostic/main.go:148-153 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/diagnostic/main.go:121` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (6 lines × 2) libnetwork/networkdb/delegate.go:54— libnetwork/networkdb/delegate.go:54-59 | libnetwork/networkdb/delegate.go:64-69 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/delegate.go:54` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) libnetwork/portallocator/portallocator_freebsd.go:19— libnetwork/portallocator/portallocator_freebsd.go:19-24 | libnetwork/portallocator/portallocator_freebsd.go:34-39 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) daemon/logger/loggertest/logreader.go:111— daemon/logger/loggertest/logreader.go:111-116 | daemon/logger/loggertest/logreader.go:118-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/logger/loggertest/logreader.go:111` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also 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 (6 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:552— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:552-557 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:590-595 — both copies are in the same file, so extract the block into 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) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:667— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:667-672 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:703-708 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
X2 · Cancellation propagation· Function without context.Context · ×12
Function without context.Context: loginV2 registry/auth.go:69— `loginV2` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: PingV2Registry registry/auth.go:175— `PingV2Registry` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: ping registry/search_endpoint_v1.go:112— `ping` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: searchRepositories registry/search_session.go:187— `searchRepositories` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: pluginPostStart plugin/manager_linux.go:74— `pluginPostStart` calls `net.Dial(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: dialExtDNS REDACTED:456— `dialExtDNS` calls `net.DialTimeout(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: setExternalKey libnetwork/sandbox_externalkey_unix.go:72— `setExternalKey` calls `net.Dial(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: fetchNodePeers libnetwork/cmd/diagnostic/main.go:106— `fetchNodePeers` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: fetchTable libnetwork/cmd/diagnostic/main.go:145— `fetchTable` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: verifySplunkConnection REDACTED:622— `verifySplunkConnection` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: GetWithStatusError builder/remotecontext/remote.go:46— `GetWithStatusError` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: supportsShallowClone builder/remotecontext/git/gitutils.go:142— `supportsShallowClone` calls `http.Head(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Duplicated block (17 lines × 2) client/container_restart.go:16— client/container_restart.go:16-32 | client/container_stop.go:20-36 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (17 lines × 2) daemon/containerd/image_builder.go:161— daemon/containerd/image_builder.go:161-177 | daemon/images/image_builder.go:176-192 — 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 `daemon/containerd/image_builder.go:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) daemon/containerd/image_events.go:13— daemon/containerd/image_events.go:13-29 | daemon/images/image_events.go:12-28 — `daemon/containerd/image_events.go` and `daemon/images/image_events.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 17 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17 lines × 2) daemon/graphdriver/graphtest/graphbench_unix.go:224— daemon/graphdriver/graphtest/graphbench_unix.go:224-240 | daemon/graphdriver/graphtest/graphtest_unix.go:141-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. 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 (17 lines × 2) daemon/top_unix.go:149— daemon/top_unix.go:149-165 | REDACTED:35-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/top_unix.go:149` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:54` calls `Summary`, `Background` and `daemon/top_unix.go:167` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) distribution/xfer/download.go:380— distribution/xfer/download.go:380-396 | distribution/xfer/download.go:472-488 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `distribution/xfer/download.go:380` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `distribution/xfer/download.go:378` calls `Update`, `ID` and `distribution/xfer/download.go:470` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (17 lines × 2) libnetwork/drivers/bridge/bridge_linux.go:932— libnetwork/drivers/bridge/bridge_linux.go:932-948 | libnetwork/drivers/bridge/bridge_linux.go:1112-1128 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (17 lines × 2) libnetwork/drivers/bridge/port_mapping_linux.go:157— libnetwork/drivers/bridge/port_mapping_linux.go:157-173 | libnetwork/drivers/windows/port_mapping.go:75-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/port_mapping_linux.go:157` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:162— libnetwork/drivers/ipvlan/ipvlan_setup.go:162-178 | libnetwork/drivers/macvlan/macvlan_setup.go:142-158 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (17 lines × 2) volume/mounts/linux_parser.go:295— volume/mounts/linux_parser.go:295-311 | volume/mounts/windows_parser.go:380-396 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `volume/mounts/linux_parser.go:295` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) libnetwork/service_linux.go:89— libnetwork/service_linux.go:89-105 | libnetwork/service_linux.go:178-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/service_linux.go:89` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also 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 (13 lines × 2) client/network_inspect.go:37— client/network_inspect.go:37-49 | client/volume_inspect.go:26-38 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/network_inspect.go:37` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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 (13 lines × 2) daemon/network.go:527— daemon/network.go:527-539 | daemon/network.go:541-553 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13 lines × 2) integration/network/helpers.go:47— integration/network/helpers.go:47-59 | integration/network/helpers_windows.go:14-26 — before extracting anything, compare `integration/network/helpers.go` and `integration/network/helpers_windows.go` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) integration/network/helpers.go:63— integration/network/helpers.go:63-75 | integration/network/helpers_windows.go:30-42 — before extracting anything, compare `integration/network/helpers.go` and `integration/network/helpers_windows.go` as WHOLE FILES: 88% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 2 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:82— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:82-94 | libnetwork/drivers/macvlan/macvlan_joinleave.go:44-56 — `libnetwork/drivers/ipvlan/ipvlan_joinleave.go` and `libnetwork/drivers/macvlan/macvlan_joinleave.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_joinleave.go:82` 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) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:99— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:99-111 | libnetwork/drivers/macvlan/macvlan_joinleave.go:61-73 — `libnetwork/drivers/ipvlan/ipvlan_joinleave.go` and `libnetwork/drivers/macvlan/macvlan_joinleave.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_joinleave.go:99` 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) libnetwork/drivers/ipvlan/ipvlan_network.go:255— libnetwork/drivers/ipvlan/ipvlan_network.go:255-267 | libnetwork/drivers/macvlan/macvlan_network.go:231-243 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (13 lines × 2) libnetwork/networkdb/networkdbdiagnostic.go:148— libnetwork/networkdb/networkdbdiagnostic.go:148-160 | libnetwork/networkdb/networkdbdiagnostic.go:197-209 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/networkdbdiagnostic.go:148` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (13 lines × 2) daemon/images/image_prune.go:171— daemon/images/image_prune.go:171-183 | daemon/prune.go:193-205 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (13 lines × 2) daemon/logger/loginfo.go:37— daemon/logger/loginfo.go:37-49 | daemon/logger/loginfo.go:72-84 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/logger/loginfo.go:37` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (13 lines × 2) libnetwork/drivers/overlay/joinleave.go:24— libnetwork/drivers/overlay/joinleave.go:24-36 | libnetwork/drivers/overlay/ov_endpoint.go:87-99 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/overlay/joinleave.go:24` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Outbound HTTP without resilience builder/remotecontext/git/gitutils.go:150— `http.Head(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience builder/remotecontext/git/gitutils.go:152— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience builder/remotecontext/remote.go:47— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:63— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:75— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:98— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:120— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:147— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience libnetwork/cmd/diagnostic/main.go:198— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience REDACTED:150— `http.Get(` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Outbound HTTP without resilience testutil/request/request.go:165— `http.Client{` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
Duplicated block (12 lines × 2) builder/builder-next/controller.go:146— builder/builder-next/controller.go:146-157 | builder/builder-next/controller.go:368-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `builder/builder-next/controller.go:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `builder/builder-next/controller.go:366` calls `Add` and `builder/builder-next/controller.go:145` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (12 lines × 2) client/config_list.go:16— client/config_list.go:16-27 | client/secret_list.go:16-27 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/config_list.go:16` it begins part-way through the construct above it, so those 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) daemon/inspect.go:122— daemon/inspect.go:122-133 | daemon/inspect_linux.go:24-35 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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) distribution/xfer/download.go:308— distribution/xfer/download.go:308-319 | distribution/xfer/upload.go:163-174 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `distribution/xfer/download.go:308` 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) integration/plugin/logging/cmd/dummy/main.go:10— integration/plugin/logging/cmd/dummy/main.go:10-21 | integration/plugin/volumes/cmd/dummy/main.go:10-21 — before extracting anything, compare `integration/plugin/logging/cmd/dummy/main.go` and `integration/plugin/volumes/cmd/dummy/main.go` as WHOLE FILES: 100% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (12 lines × 2) libnetwork/drivers/host/host.go:33— libnetwork/drivers/host/host.go:33-44 | libnetwork/drivers/null/null.go:33-44 — `libnetwork/drivers/host/host.go` and `libnetwork/drivers/null/null.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 12 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also 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) libnetwork/drivers/ipvlan/ipvlan.go:65— libnetwork/drivers/ipvlan/ipvlan.go:65-76 | libnetwork/drivers/macvlan/macvlan.go:59-70 — `libnetwork/drivers/ipvlan/ipvlan.go` and `libnetwork/drivers/macvlan/macvlan.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 2 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (12 lines × 2) libnetwork/drivers/ipvlan/ipvlan_state.go:68— libnetwork/drivers/ipvlan/ipvlan_state.go:68-79 | libnetwork/drivers/macvlan/macvlan_state.go:68-79 — `libnetwork/drivers/ipvlan/ipvlan_state.go` and `libnetwork/drivers/macvlan/macvlan_state.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 57 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also 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) libnetwork/drivers/ipvlan/ipvlan_network.go:152— libnetwork/drivers/ipvlan/ipvlan_network.go:152-163 | libnetwork/drivers/macvlan/macvlan_network.go:142-153 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_network.go:152` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:470— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:470-481 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:503-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:470` 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 (5 lines × 2) REDACTED:171— REDACTED:171-175 | REDACTED:178-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 (5 lines × 2) daemon/graphdriver/plugin.go:42— daemon/graphdriver/plugin.go:42-46 | daemon/metrics.go:156-161 — 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 `daemon/graphdriver/plugin.go:42` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (5 lines × 2) integration-cli/daemon/daemon_swarm.go:19— integration-cli/daemon/daemon_swarm.go:19-23 | integration-cli/daemon/daemon_swarm.go:36-40 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `integration-cli/daemon/daemon_swarm.go:19` 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) libnetwork/service_common.go:293— libnetwork/service_common.go:293-297 | libnetwork/service_common.go:363-367 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/service_common.go:293` 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) libnetwork/networkdb/nodemgmt.go:100— libnetwork/networkdb/nodemgmt.go:100-104 | libnetwork/networkdb/nodemgmt.go:108-112 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/nodemgmt.go:100` it begins part-way through the construct above it, so those 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) daemon/logger/loggertest/logreader.go:254— daemon/logger/loggertest/logreader.go:254-258 | daemon/logger/loggertest/logreader.go:304-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/logger/loggertest/logreader.go:254` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (5 lines × 2) libnetwork/networkdb/networkdbdiagnostic.go:237— libnetwork/networkdb/networkdbdiagnostic.go:237-241 | libnetwork/networkdb/networkdbdiagnostic.go:274-278 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/networkdbdiagnostic.go:237` 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) libnetwork/iptables/iptables.go:269— libnetwork/iptables/iptables.go:269-273 | libnetwork/iptables/iptables.go:290-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/iptables/iptables.go:269` 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 (5 lines × 2) libnetwork/iptables/iptables.go:276— libnetwork/iptables/iptables.go:276-280 | libnetwork/iptables/iptables.go:297-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/iptables/iptables.go:276` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:486— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:486-490 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:519-523 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×9
Edited copy of a member (15 corresponding lines) api/server/router/container/container_routes.go:772— api/server/router/container/container_routes.go:772-787 | api/server/router/container/exec.go:162-176 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) api/server/router/swarm/cluster_routes.go:473— api/server/router/swarm/cluster_routes.go:473-487 | api/server/router/swarm/cluster_routes.go:545-559 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) client/container_stats.go:12— client/container_stats.go:12-28 | client/container_stats.go:32-46 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) api/server/router/image/image_routes.go:241— api/server/router/image/image_routes.go:241-255 | api/server/router/plugin/plugin_routes.go:241-258 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) client/service_create.go:84— client/service_create.go:84-98 | client/service_create.go:100-114 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) libnetwork/types/types.go:259— libnetwork/types/types.go:259-273 | libnetwork/types/types.go:278-292 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) builder/builder-next/adapters/containerimage/pull.go:88— builder/builder-next/adapters/containerimage/pull.go:88-102 | builder/builder-next/adapters/localinlinecache/inlinecache.go:39-54 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) libnetwork/drivers/bridge/port_mapping_linux.go:191— libnetwork/drivers/bridge/port_mapping_linux.go:191-205 | libnetwork/drivers/windows/port_mapping.go:109-123 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_network.go:234— libnetwork/drivers/ipvlan/ipvlan_network.go:234-251 | libnetwork/drivers/macvlan/macvlan_network.go:213-227 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
ClassTooLong: Network libnetwork/network.go:172— ClassTooLong — 1041 significant lines (blank, comment-only and punctuation-only lines excluded), 86 methods, 74 blocks, lines 172-2215. The bar is 400 significant lines; this is 641 over it, 2.60× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Endpoint REDACTED:29— ClassTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded), 59 methods, 39 blocks, lines 29-1131. The bar is 400 significant lines; this is 190 over it, 1.48× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: driver libnetwork/drivers/bridge/bridge_linux.go:138— ClassTooLong — 579 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods, 23 blocks, lines 138-1536. The bar is 400 significant lines; this is 179 over it, 1.45× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Controller libnetwork/controller.go:82— ClassTooLong — 531 significant lines (blank, comment-only and punctuation-only lines excluded), 86 methods, 41 blocks, lines 82-1130. The bar is 400 significant lines; this is 131 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Daemon daemon/daemon.go:101— ClassTooLong — 514 significant lines (blank, comment-only and punctuation-only lines excluded), 286 methods, 38 blocks, lines 101-1575. The bar is 400 significant lines; this is 114 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: layerStore layer/layer_store.go:33— ClassTooLong — 475 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods, 28 blocks, lines 33-917. The bar is 400 significant lines; this is 75 over it, 1.19× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Daemon testutil/daemon/daemon.go:64— ClassTooLong — 459 significant lines (blank, comment-only and punctuation-only lines excluded), 82 methods, 38 blocks, lines 64-962. The bar is 400 significant lines; this is 59 over it, 1.15× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: cnmNetworkAllocator libnetwork/cnmallocator/networkallocator.go:33— ClassTooLong — 426 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods, 26 blocks, lines 33-960. The bar is 400 significant lines; this is 26 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyFields: Info api/types/system/info.go:11— TooManyFields — 63 stored fields. The bar is 30 stored fields; this is 33 over it, 2.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: CommonConfig REDACTED:153— TooManyFields — 45 stored fields. The bar is 30 stored fields; this is 15 over it, 1.50× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Daemon daemon/daemon.go:101— TooManyFields — 43 stored fields beside 286 methods. The bar is 30 stored fields; this is 13 over it, 1.43× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: HostConfig api/types/container/hostconfig.go:418— TooManyFields — 41 stored fields. The bar is 30 stored fields; this is 11 over it, 1.37× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Container container/container.go:62— TooManyFields — 38 stored fields beside 64 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Network libnetwork/network.go:172— TooManyFields — 35 stored fields beside 86 methods. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: ImageBuildOptions api/types/client.go:84— TooManyFields — 35 stored fields. The bar is 30 stored fields; this is 5 over it, 1.17× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
TooManyFields: Resources api/types/container/hostconfig.go:365— TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication· Edited copy of a member (12 corresponding lines) · ×8
Edited copy of a member (12 corresponding lines) libnetwork/types/types.go:81— libnetwork/types/types.go:81-92 | libnetwork/types/types.go:95-106 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) libnetwork/networkdb/networkdb.go:797— libnetwork/networkdb/networkdb.go:797-808 | libnetwork/networkdb/networkdb.go:812-823 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) libnetwork/iptables/iptables.go:431— libnetwork/iptables/iptables.go:431-443 | libnetwork/iptables/iptables.go:446-457 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) pkg/idtools/idtools.go:75— pkg/idtools/idtools.go:75-86 | pkg/idtools/idtools.go:91-102 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) testutil/daemon/plugin.go:34— testutil/daemon/plugin.go:34-45 | testutil/daemon/plugin.go:57-68 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) REDACTED:78— REDACTED:78-89 | REDACTED:74-85 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) api/server/router/checkpoint/checkpoint_routes.go:30— api/server/router/checkpoint/checkpoint_routes.go:30-43 | api/server/router/container/container_routes.go:413-424 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (12 corresponding lines) REDACTED:647— REDACTED:647-658 | REDACTED:660-671 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×8
Edited copy of a member (9 corresponding lines) libnetwork/iptables/iptables.go:631— libnetwork/iptables/iptables.go:631-640 | libnetwork/iptables/iptables.go:644-652 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) libnetwork/network.go:1892— libnetwork/network.go:1892-1902 | libnetwork/sandbox.go:122-130 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) builder/dockerfile/copy_unix.go:62— builder/dockerfile/copy_unix.go:62-72 | builder/dockerfile/copy_windows.go:128-136 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) pkg/progress/progressreader.go:23— pkg/progress/progressreader.go:23-32 | pkg/progress/progresssink.go:23-31 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) builder/builder-next/adapters/containerimage/pull.go:862— builder/builder-next/adapters/containerimage/pull.go:862-870 | image/image.go:178-186 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) daemon/containerd/image_delete.go:410— daemon/containerd/image_delete.go:410-418 | daemon/images/image_delete.go:264-273 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) distribution/pull_v2.go:54— distribution/pull_v2.go:54-64 | distribution/push_v2.go:41-49 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (9 corresponding lines) libnetwork/endpoint_cnt.go:35— libnetwork/endpoint_cnt.go:35-44 | libnetwork/network.go:257-265 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) api/server/router/plugin/plugin_routes.go:83— api/server/router/plugin/plugin_routes.go:83-96 | api/server/router/plugin/plugin_routes.go:118-131 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) client/container_logs.go:39— client/container_logs.go:39-52 | client/service_logs.go:19-32 — before extracting anything, compare `client/container_logs.go` and `client/service_logs.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/container_logs.go:39` it begins part-way through the construct above it, so those 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) layer/filestore.go:204— layer/filestore.go:204-217 | layer/filestore.go:326-339 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `layer/filestore.go:204` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) libnetwork/cnmallocator/networkallocator.go:206— libnetwork/cnmallocator/networkallocator.go:206-219 | libnetwork/cnmallocator/networkallocator.go:284-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. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cnmallocator/networkallocator.go:206` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (14 lines × 2) REDACTED:123— REDACTED:123-136 | REDACTED:145-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:123` it begins part-way through the construct above it, so those 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) libnetwork/portmapper/mapper.go:83— libnetwork/portmapper/mapper.go:83-96 | libnetwork/portmapper/mapper.go:114-127 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/portmapper/mapper.go:83` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (14 lines × 2) REDACTED:235— REDACTED:235-248 | REDACTED:281-294 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (14 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:657— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:657-670 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:743-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
FunctionTooLong: daemon.NewDaemon daemon/daemon.go:752— FunctionTooLong — NewDaemon runs 286 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 186 over it, 2.86× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: seccomp.DefaultProfile profiles/seccomp/default_linux.go:46— FunctionTooLong — DefaultProfile runs 260 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 160 over it, 2.60× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: buildkit.newGraphDriverController builder/builder-next/controller.go:194— FunctionTooLong — newGraphDriverController runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: splunk.New REDACTED:153— FunctionTooLong — New runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: daemon.withMounts daemon/oci_linux.go:503— FunctionTooLong — withMounts runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: daemon.verifyPlatformContainerResources REDACTED:404— FunctionTooLong — verifyPlatformContainerResources runs 106 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 6 over it, 1.06× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: oci.DefaultLinuxSpec oci/defaults.go:52— FunctionTooLong — DefaultLinuxSpec runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×7
Edited copy of a member (19 corresponding lines) REDACTED:32— REDACTED:32-50 | REDACTED:250-268 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) integration-cli/daemon/daemon_swarm.go:101— integration-cli/daemon/daemon_swarm.go:101-119 | integration-cli/daemon/daemon_swarm.go:122-140 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) api/server/router/swarm/cluster_routes.go:435— api/server/router/swarm/cluster_routes.go:435-453 | api/server/router/swarm/cluster_routes.go:506-525 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_setup.go:160— libnetwork/drivers/ipvlan/ipvlan_setup.go:160-178 | libnetwork/drivers/macvlan/macvlan_setup.go:140-158 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) pkg/sysinfo/cgroup2_linux.go:115— pkg/sysinfo/cgroup2_linux.go:115-133 | pkg/sysinfo/sysinfo_linux.go:228-249 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) libnetwork/drvregistry/ipams.go:66— libnetwork/drvregistry/ipams.go:66-84 | libnetwork/drvregistry/networks.go:32-50 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) container/container_windows.go:40— container/container_windows.go:40-58 | container/container_windows.go:90-108 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×6
Members sharing a duplicated core (4 members, 50+ identical tokens) client/container_prune.go:13— client/container_prune.go:13-36 | client/image_prune.go:13-36 | client/network_prune.go:13-36 | client/volume_prune.go:13-36 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) daemon/graphdriver/plugin.go:25— daemon/graphdriver/plugin.go:25-55 | daemon/metrics.go:145-165 | libnetwork/drivers/remote/driver.go:69-89 | libnetwork/ipams/remote/remote.go:67-87 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) libnetwork/drivers/bridge/bridge_store.go:26— libnetwork/drivers/bridge/bridge_store.go:26-50 | libnetwork/drivers/ipvlan/ipvlan_store.go:45-68 | libnetwork/drivers/macvlan/macvlan_store.go:44-67 | libnetwork/drivers/windows/windows_store.go:23-47 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) libnetwork/drivers/bridge/bridge_store.go:116— libnetwork/drivers/bridge/bridge_store.go:116-134 | libnetwork/drivers/ipvlan/ipvlan_store.go:132-149 | libnetwork/drivers/macvlan/macvlan_store.go:131-148 | libnetwork/drivers/windows/windows_store.go:116-134 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:64— libnetwork/drivers/ipvlan/ipvlan_endpoint.go:64-87 | libnetwork/drivers/ipvlan/ipvlan_network.go:118-163 | libnetwork/drivers/macvlan/macvlan_endpoint.go:69-94 | libnetwork/drivers/macvlan/macvlan_network.go:108-153 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
Members sharing a duplicated core (4 members, 50+ identical tokens) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:464— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:464-494 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:497-527 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:530-564 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:567-599 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×6
Edited copy of a member (20 corresponding lines) daemon/logger/plugin.go:49— daemon/logger/plugin.go:49-68 | volume/drivers/extpoint.go:216-237 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) daemon/images/image_prune.go:185— daemon/images/image_prune.go:185-204 | daemon/prune.go:172-191 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) libnetwork/networkdb/delegate.go:305— libnetwork/networkdb/delegate.go:305-324 | libnetwork/networkdb/delegate.go:326-347 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) volume/mounts/linux_parser.go:326— volume/mounts/linux_parser.go:326-350 | volume/mounts/windows_parser.go:411-430 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:448— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:448-467 | daemon/graphdriver/overlay2/overlay.go:683-707 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) libnetwork/controller.go:853— libnetwork/controller.go:853-872 | libnetwork/network.go:1256-1277 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×6
Edited copy of a member (17 corresponding lines) REDACTED:180— REDACTED:180-197 | REDACTED:254-270 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) libnetwork/drivers/bridge/bridge_store.go:273— libnetwork/drivers/bridge/bridge_store.go:273-289 | libnetwork/drivers/windows/windows_store.go:223-241 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) libnetwork/service_common.go:57— libnetwork/service_common.go:57-73 | libnetwork/service_common.go:121-137 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) libnetwork/drivers/bridge/setup_ip_tables_linux.go:104— libnetwork/drivers/bridge/setup_ip_tables_linux.go:104-120 | libnetwork/drivers/bridge/setup_ip_tables_linux.go:122-142 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) libnetwork/service_linux.go:369— libnetwork/service_linux.go:369-391 | libnetwork/service_linux.go:393-409 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:184— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:184-200 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:202-223 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×6
Edited copy of a member (16 corresponding lines) builder/builder-next/adapters/containerimage/pull.go:365— builder/builder-next/adapters/containerimage/pull.go:365-380 | builder/builder-next/worker/worker.go:342-357 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) pkg/idtools/idtools_unix.go:246— pkg/idtools/idtools_unix.go:246-261 | pkg/idtools/idtools_unix.go:263-278 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) libnetwork/network.go:1708— libnetwork/network.go:1708-1723 | libnetwork/network.go:1725-1742 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) daemon/archive.go:13— daemon/archive.go:13-28 | daemon/archive.go:32-47 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) daemon/container_operations.go:908— daemon/container_operations.go:908-923 | daemon/exec.go:78-94 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) daemon/graphdriver/fsdiff.go:160— daemon/graphdriver/fsdiff.go:160-175 | REDACTED:607-625 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×6
Edited copy of a member (13 corresponding lines) libnetwork/diagnostic/server.go:137— libnetwork/diagnostic/server.go:137-156 | libnetwork/diagnostic/server.go:158-170 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) container/container.go:681— container/container.go:681-698 | container/exec.go:53-65 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) libnetwork/drivers/overlay/encryption.go:403— libnetwork/drivers/overlay/encryption.go:403-415 | libnetwork/drivers/overlay/encryption.go:417-429 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) libnetwork/osl/route_linux.go:110— libnetwork/osl/route_linux.go:110-122 | libnetwork/osl/route_linux.go:125-137 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) api/server/router/container/container_routes.go:426— api/server/router/container/container_routes.go:426-438 | api/server/router/plugin/plugin_routes.go:184-199 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) daemon/configs.go:11— daemon/configs.go:11-23 | daemon/secrets.go:11-25 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
HackComment layer/layer_test.go:486— // hack layer to add file — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment integration-cli/docker_cli_daemon_test.go:1540— // Hack to get the right IPv6 address on balena0, which has already been created — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment integration-cli/docker_cli_external_volume_driver_test.go:75— // hack used to trigger a null volume return on `Get` — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment daemon/oci_linux_test.go:54— // HORRIBLE HACK: clean up shm mounts leaked by some tests. Otherwise the — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
HackComment builder/builder-next/controller.go:98— // HACK! Windows doesn't have 'host' mode networking. — a workaround marked in source: record what it is compensating for and what would allow its removal (the upstream fix, the API it is waiting on, the invariant it restores), so the next reader can judge whether it is still needed rather than rediscovering why it is there.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×5
Edited copy of a member (18 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_setup.go:204— libnetwork/drivers/ipvlan/ipvlan_setup.go:204-221 | libnetwork/drivers/macvlan/macvlan_setup.go:184-201 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) libnetwork/agent.go:570— libnetwork/agent.go:570-587 | libnetwork/agent.go:589-606 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) builder/dockerfile/internals_linux.go:53— builder/dockerfile/internals_linux.go:53-70 | builder/dockerfile/internals_linux.go:72-89 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) libnetwork/controller.go:1044— libnetwork/controller.go:1044-1061 | libnetwork/controller.go:1063-1080 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) REDACTED:558— REDACTED:558-575 | daemon/graphdriver/overlay2/overlay.go:425-442 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×5
Edited copy of a member (11 corresponding lines) integration-cli/daemon/daemon_swarm.go:67— integration-cli/daemon/daemon_swarm.go:67-77 | integration-cli/daemon/daemon_swarm.go:80-90 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) daemon/containerd/image_commit.go:322— daemon/containerd/image_commit.go:322-332 | daemon/images/image_commit.go:120-130 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) builder/builder-next/adapters/snapshot/leasemanager.go:55— builder/builder-next/adapters/snapshot/leasemanager.go:55-65 | builder/builder-next/adapters/snapshot/leasemanager.go:67-77 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) libnetwork/drivers/overlay/overlay.go:60— libnetwork/drivers/overlay/overlay.go:60-70 | libnetwork/drivers/windows/overlay/overlay_windows.go:27-38 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) distribution/xfer/download.go:39— distribution/xfer/download.go:39-50 | distribution/xfer/upload.go:30-40 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×5
Edited copy of a member (7 corresponding lines) pkg/system/lstat_unix.go:14— pkg/system/lstat_unix.go:14-20 | pkg/system/stat_unix.go:60-66 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) REDACTED:791— REDACTED:791-798 | builder/dockerfile/copy_windows.go:37-43 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) libnetwork/drivers/bridge/setup_ip_tables_linux.go:249— libnetwork/drivers/bridge/setup_ip_tables_linux.go:249-255 | libnetwork/iptables/iptables.go:703-709 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) volume/mounts/lcow_parser.go:56— volume/mounts/lcow_parser.go:56-62 | volume/mounts/windows_parser.go:295-301 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (7 corresponding lines) container/container.go:711— container/container.go:711-717 | container/container_unix.go:475-481 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×4
Edited copy of a member (31 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_store.go:277— libnetwork/drivers/ipvlan/ipvlan_store.go:277-307 | libnetwork/drivers/macvlan/macvlan_store.go:271-301 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) pkg/chrootarchive/archive_unix_nolinux.go:61— pkg/chrootarchive/archive_unix_nolinux.go:61-91 | pkg/chrootarchive/archive_unix_nolinux.go:135-170 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) libnetwork/cnmallocator/networkallocator.go:512— libnetwork/cnmallocator/networkallocator.go:512-554 | libnetwork/cnmallocator/networkallocator.go:611-641 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (31 corresponding lines) libnetwork/network.go:1360— libnetwork/network.go:1360-1390 | libnetwork/network.go:1392-1423 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×4
Edited copy of a member (22 corresponding lines) REDACTED:122— REDACTED:122-143 | REDACTED:196-221 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) libnetwork/iptables/firewalld.go:255— libnetwork/iptables/firewalld.go:255-277 | libnetwork/iptables/firewalld.go:281-302 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) client/container_restart.go:15— client/container_restart.go:15-36 | client/container_stop.go:19-40 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) libnetwork/datastore/cache.go:83— libnetwork/datastore/cache.go:83-109 | libnetwork/datastore/cache.go:111-132 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×4
Edited copy of a member (8 corresponding lines) REDACTED:50— REDACTED:50-57 | REDACTED:65-74 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) daemon/logger/gcplogs/gcplogging.go:45— daemon/logger/gcplogs/gcplogging.go:45-53 | daemon/logger/journald/journald.go:69-76 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) REDACTED:301— REDACTED:301-308 | libnetwork/sandbox.go:297-305 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) daemon/graphdriver/graphtest/graphtest_unix.go:293— daemon/graphdriver/graphtest/graphtest_unix.go:293-300 | internal/testutils/specialimage/multilayer.go:145-152 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×4
Edited copy of a member (10 corresponding lines) client/container_update.go:11— client/container_update.go:11-21 | client/volume_create.go:11-20 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) pkg/system/stat_bsd.go:8— pkg/system/stat_bsd.go:8-17 | pkg/system/stat_linux.go:6-16 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) REDACTED:183— REDACTED:183-192 | REDACTED:382-391 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (10 corresponding lines) cmd/dockerd/service_windows.go:64— cmd/dockerd/service_windows.go:64-73 | plugin/manager.go:310-320 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (20 lines × 2) daemon/archive_unix.go:132— daemon/archive_unix.go:132-151 | daemon/archive_windows.go:233-252 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (20 lines × 2) REDACTED:177— REDACTED:177-196 | REDACTED:151-170 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (20 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:279— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:279-298 | daemon/graphdriver/overlay2/overlay.go:493-512 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (20 lines × 2) libnetwork/drivers/remote/driver.go:70— libnetwork/drivers/remote/driver.go:70-89 | libnetwork/ipams/remote/remote.go:68-87 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 2) api/server/router/container/container_routes.go:231— api/server/router/container/container_routes.go:231-248 | api/server/router/container/container_routes.go:284-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (18 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:428— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:428-445 | daemon/graphdriver/overlay2/overlay.go:663-680 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (18 lines × 2) daemon/graphdriver/graphtest/graphbench_unix.go:91— daemon/graphdriver/graphtest/graphbench_unix.go:91-108 | daemon/graphdriver/graphtest/graphbench_unix.go:126-143 — both copies are in the same file, so extract the 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 (18 lines × 2) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:181— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:181-198 | libnetwork/drivers/macvlan/macvlan_joinleave.go:127-144 — `libnetwork/drivers/ipvlan/ipvlan_joinleave.go` and `libnetwork/drivers/macvlan/macvlan_joinleave.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:385— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:385-400 | daemon/graphdriver/overlay2/overlay.go:622-637 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:401` calls `fusermountU` and `daemon/graphdriver/overlay2/overlay.go:638` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (16 lines × 2) libnetwork/drivers/bridge/bridge_linux.go:1285— libnetwork/drivers/bridge/bridge_linux.go:1285-1300 | libnetwork/drivers/bridge/bridge_linux.go:1341-1356 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (16 lines × 2) libnetwork/drivers/ipvlan/ipvlan_network.go:216— libnetwork/drivers/ipvlan/ipvlan_network.go:216-231 | libnetwork/drivers/macvlan/macvlan_network.go:195-210 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (16 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:206— libnetwork/drivers/ipvlan/ipvlan_setup.go:206-221 | libnetwork/drivers/macvlan/macvlan_setup.go:186-201 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 3) container/view.go:443— container/view.go:443-452 | container/view.go:478-487 | container/view.go:503-512 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (10 lines × 3) daemon/graphdriver/graphtest/graphbench_unix.go:99— daemon/graphdriver/graphtest/graphbench_unix.go:99-108 | daemon/graphdriver/graphtest/graphbench_unix.go:134-143 | daemon/graphdriver/graphtest/graphtest_unix.go:192-201 — 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 `daemon/graphdriver/graphtest/graphbench_unix.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `daemon/graphdriver/graphtest/graphtest_unix.go:203` calls `removeAll`, `Fatal` and `daemon/graphdriver/graphtest/graphbench_unix.go:144` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 3) libnetwork/drivers/ipvlan/ipvlan_store.go:107— libnetwork/drivers/ipvlan/ipvlan_store.go:107-116 | libnetwork/drivers/macvlan/macvlan_store.go:106-115 | libnetwork/drivers/windows/windows_store.go:92-101 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:107` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:583— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:583-592 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:687-696 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:724-733 — 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.
Collection crosses a callback boundary unsynchronised daemon/daemon.go:325— `restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 325. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`.
Collection crosses a callback boundary unsynchronised daemon/daemon.go:582— `restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 582. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`.
Collection crosses a callback boundary unsynchronised daemon/daemon.go:635— `restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 635. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`.
Collection crosses a callback boundary unsynchronised daemon/daemon.go:666— `restore` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 666. The loop never waits on `group` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `group` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `group` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`.
X27 · Collection changed while being enumerated· Collection is structurally changed while it is being enumerated · ×4
Collection is structurally changed while it is being enumerated REDACTED:100— `s.Mounts` is walked by the `for … range` at line 100, and line 103 removes from (or inserts into) `s.Mounts` by shifting its elements in the backing array the loop is still reading: the element after each change moves under the index the loop has already passed, so it is skipped, and the last ones are read twice.
Collection is structurally changed while it is being enumerated REDACTED:14— `ts.sums` is walked by the `for … range` at line 14, and line 16 removes from (or inserts into) `ts.sums` by shifting its elements in the backing array the loop is still reading: the element after each change moves under the index the loop has already passed, so it is skipped, and the last ones are read twice.
Collection is structurally changed while it is being enumerated REDACTED:110— `realmark.keys()` is a live view over `realmark` by the `for` on line 110, and line 113 calls `del realmark[…]` inside the loop body — a change to the size of a dict this file builds. The loop's next step raises `RuntimeError: dictionary changed size during iteration`, so every pass that reaches this call ends the loop by exception and the remaining items are never seen.
Collection is structurally changed while it is being enumerated REDACTED:115— `stasks.keys()` is a live view over `stasks` by the `for` on line 115, and line 118 calls `del stasks[…]` inside the loop body — a change to the size of a dict this file builds. The loop's next step raises `RuntimeError: dictionary changed size during iteration`, so every pass that reaches this call ends the loop by exception and the remaining items are never seen.
X3 · Exception handling· Discarded error (assigned to `_`, then its result used) · ×4
Discarded error (assigned to `_`, then its result used) volume/service/convert.go:84— `createdAt, _ := v.CreatedAt()` writes the call's error to `_` and then uses `createdAt` as if the call succeeded. When `v.CreatedAt` fails, `createdAt` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `createdAt` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) volume/mounts/windows_parser.go:127— `exists, isDir, _ := p.fi.fileInfo(matchgroups["destination"])` writes the call's error to `_` and then uses `exists` as if the call succeeded. When `p.fi.fileInfo` fails, `exists` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `exists` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) volume/drivers/adapter.go:142— `mountpoint, _ := a.proxy.Path(a.name)` writes the call's error to `_` and then uses `mountpoint` as if the call succeeded. When `a.proxy.Path` fails, `mountpoint` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `mountpoint` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) testutil/daemon/daemon_windows.go:15— `ev, _ := windows.UTF16PtrFromString("Global\\docker-daemon-" + strconv.Itoa(pid))` writes the call's error to `_` and then uses `ev` as if the call succeeded. When `windows.UTF16PtrFromString` fails, `ev` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `ev` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
XxxComment libnetwork/controller.go:466— // XXX This should be made driver agnostic. See comment below. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment libnetwork/controller.go:641— // XXX If the driver type is "overlay" check the options for DSR — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
XxxComment integration-cli/docker_cli_run_test.go:3256— // XXX: This may include a daemon crash. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×3
Edited copy of a member (28 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_store.go:178— libnetwork/drivers/ipvlan/ipvlan_store.go:178-211 | libnetwork/drivers/macvlan/macvlan_store.go:176-203 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) client/image_pull.go:22— client/image_pull.go:22-49 | client/image_push.go:20-51 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (28 corresponding lines) daemon/pause.go:23— daemon/pause.go:23-57 | daemon/unpause.go:22-49 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (34 corresponding lines) · ×3
Edited copy of a member (34 corresponding lines) api/server/router/plugin/plugin_routes.go:82— api/server/router/plugin/plugin_routes.go:82-115 | api/server/router/plugin/plugin_routes.go:117-150 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) integration-cli/cli/cli.go:59— integration-cli/cli/cli.go:59-92 | integration-cli/daemon/daemon.go:103-137 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (34 corresponding lines) REDACTED:40— REDACTED:40-75 | REDACTED:38-71 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×3
Edited copy of a member (24 corresponding lines) libnetwork/network.go:1793— libnetwork/network.go:1793-1816 | libnetwork/network.go:1818-1841 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) libnetwork/endpoint_info_unix.go:8— libnetwork/endpoint_info_unix.go:8-31 | libnetwork/endpoint_info_windows.go:8-46 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (24 corresponding lines) libnetwork/drivers/bridge/bridge_linux.go:1578— libnetwork/drivers/bridge/bridge_linux.go:1578-1602 | libnetwork/drivers/windows/windows.go:576-599 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×3
Edited copy of a member (27 corresponding lines) api/server/router/container/container_routes.go:230— api/server/router/container/container_routes.go:230-256 | api/server/router/container/container_routes.go:283-309 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) container/container.go:175— container/container.go:175-203 | container/container.go:246-272 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) client/container_exec.go:13— client/container_exec.go:13-39 | client/network_create.go:12-40 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×3
Edited copy of a member (21 corresponding lines) daemon/containerd/image_snapshot_unix.go:45— daemon/containerd/image_snapshot_unix.go:45-65 | daemon/containerd/image_snapshot_unix.go:67-94 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_setup.go:181— libnetwork/drivers/ipvlan/ipvlan_setup.go:181-201 | libnetwork/drivers/macvlan/macvlan_setup.go:161-181 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) libnetwork/drivers/windows/windows.go:823— libnetwork/drivers/windows/windows.go:823-852 | libnetwork/drivers/windows/windows.go:855-875 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×3
Edited copies of one member (3 members, 10+ corresponding lines) client/config_update.go:11— client/config_update.go:11-20 | client/secret_update.go:11-20 | client/volume_update.go:13-24 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) api/server/router/swarm/cluster_routes.go:281— api/server/router/swarm/cluster_routes.go:281-290 | api/server/router/swarm/cluster_routes.go:334-345 | api/server/router/swarm/cluster_routes.go:405-416 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) libnetwork/sandbox_options.go:116— libnetwork/sandbox_options.go:116-125 | libnetwork/sandbox_options.go:129-141 | libnetwork/sandbox_options.go:145-155 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 12+ corresponding lines) · ×3
Edited copies of one member (3 members, 12+ corresponding lines) testutil/environment/protect.go:71— testutil/environment/protect.go:71-84 | testutil/environment/protect.go:157-168 | testutil/environment/protect.go:186-201 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) integration-cli/daemon/daemon_swarm.go:18— integration-cli/daemon/daemon_swarm.go:18-31 | integration-cli/daemon/daemon_swarm.go:35-48 | integration-cli/daemon/daemon_swarm.go:143-154 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 12+ corresponding lines) api/server/router/checkpoint/checkpoint_routes.go:11— api/server/router/checkpoint/checkpoint_routes.go:11-28 | api/server/router/network/network_routes.go:160-175 | api/server/router/network/network_routes.go:177-188 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (24 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:231— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:231-254 | daemon/graphdriver/overlay2/overlay.go:445-468 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (24 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:302— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:302-325 | daemon/graphdriver/overlay2/overlay.go:516-539 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:302` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:326` calls `fusermountU` and `daemon/graphdriver/overlay2/overlay.go:540` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (24 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:134— libnetwork/drivers/ipvlan/ipvlan_setup.go:134-157 | libnetwork/drivers/macvlan/macvlan_setup.go:114-137 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (21 lines × 2) REDACTED:55— REDACTED:55-75 | REDACTED:51-71 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:55` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:121— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:121-141 | daemon/graphdriver/overlay2/overlay.go:284-304 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (21 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:345— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:345-365 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:406-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:345` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (19 lines × 2) daemon/container_operations.go:96— daemon/container_operations.go:96-114 | daemon/network.go:714-732 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (19 lines × 2) layer/layer_store.go:306— layer/layer_store.go:306-324 | layer/layer_store.go:539-557 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `layer/layer_store.go:306` 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 (19 lines × 2) libnetwork/drivers/ipvlan/ipvlan_store.go:158— libnetwork/drivers/ipvlan/ipvlan_store.go:158-176 | libnetwork/drivers/macvlan/macvlan_store.go:156-174 — `libnetwork/drivers/ipvlan/ipvlan_store.go` and `libnetwork/drivers/macvlan/macvlan_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 12 separate duplicated blocks between them, totalling at least 148 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_store.go:158` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15–16 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:84— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:84-99 | daemon/graphdriver/overlay2/overlay.go:167-181 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:84` 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–16 lines × 2) distribution/pull.go:95— distribution/pull.go:95-109 | distribution/push.go:41-56 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `distribution/pull.go:95` 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–16 lines × 2) libnetwork/networkdb/watch.go:96— libnetwork/networkdb/watch.go:96-110 | libnetwork/networkdb/watch.go:117-132 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/watch.go:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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–15 lines × 2) daemon/containerd/image_delete.go:95— daemon/containerd/image_delete.go:95-109 | daemon/containerd/image_delete.go:126-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/containerd/image_delete.go:95` it begins part-way through the construct above it, so those 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 (14–15 lines × 2) REDACTED:527— REDACTED:527-540 | REDACTED:627-641 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:527` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:525` calls `Set`, `String` and `REDACTED:625` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (14–15 lines × 2) libnetwork/drivers/bridge/bridge_store.go:292— libnetwork/drivers/bridge/bridge_store.go:292-306 | libnetwork/drivers/windows/windows_store.go:244-257 — `libnetwork/drivers/bridge/bridge_store.go` and `libnetwork/drivers/windows/windows_store.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 48 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_store.go:292` 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 × 4) libnetwork/drivers/bridge/bridge_store.go:27— libnetwork/drivers/bridge/bridge_store.go:27-34 | libnetwork/drivers/ipvlan/ipvlan_store.go:46-53 | libnetwork/drivers/macvlan/macvlan_store.go:45-52 | libnetwork/drivers/windows/windows_store.go:24-31 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_store.go:27` 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 × 4) daemon/logger/awslogs/cloudwatchlogs.go:114— daemon/logger/awslogs/cloudwatchlogs.go:114-121 | daemon/logger/fluentd/fluentd.go:64-71 | daemon/logger/gelf/gelf.go:28-35 | daemon/logger/syslog/syslog.go:54-61 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times.
Duplicated block (8 lines × 4) libnetwork/networkdb/networkdbdiagnostic.go:147— libnetwork/networkdb/networkdbdiagnostic.go:147-154 | libnetwork/networkdb/networkdbdiagnostic.go:196-203 | libnetwork/networkdb/networkdbdiagnostic.go:243-250 | libnetwork/networkdb/networkdbdiagnostic.go:280-287 — 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 `libnetwork/networkdb/networkdbdiagnostic.go:147` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (7 lines × 3) daemon/graphdriver/graphtest/graphbench_unix.go:90— daemon/graphdriver/graphtest/graphbench_unix.go:90-96 | daemon/graphdriver/graphtest/graphbench_unix.go:125-131 | daemon/graphdriver/graphtest/graphtest_unix.go:262-268 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. The matched lines also 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 (7 lines × 3) integration/internal/container/ops.go:129— integration/internal/container/ops.go:129-135 | integration/internal/container/ops.go:142-148 | integration/internal/container/ops.go:158-164 — 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 `integration/internal/container/ops.go:129` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83-90 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:96-103 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:109-115 — 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 `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `port` in one and `networkName` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Driver.create (cyclomatic 18) daemon/graphdriver/overlay2/overlay.go:347— Driver.create has cyclomatic complexity 18 (threshold 15). Of this number, 17 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.
Driver.create (cyclomatic 18) REDACTED:184— Driver.create has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.EventNotify (cyclomatic 18) libnetwork/drivers/overlay/joinleave.go:153— driver.EventNotify has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
driver.EventNotify (cyclomatic 18) libnetwork/drivers/windows/overlay/joinleave_windows.go:49— driver.EventNotify has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
driver.DeleteNetwork (cognitive 25) libnetwork/drivers/ipvlan/ipvlan_network.go:118— driver.DeleteNetwork has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
driver.DeleteNetwork (cognitive 25) libnetwork/drivers/macvlan/macvlan_network.go:108— driver.DeleteNetwork has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (24 pts), loops 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
driver.EventNotify (cognitive 20) libnetwork/drivers/overlay/joinleave.go:153— driver.EventNotify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
driver.EventNotify (cognitive 20) libnetwork/drivers/windows/overlay/joinleave_windows.go:49— driver.EventNotify has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
driver.createNetwork (cognitive 17) libnetwork/drivers/ipvlan/ipvlan_network.go:66— driver.createNetwork has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.createNetwork (cognitive 17) libnetwork/drivers/macvlan/macvlan_network.go:56— driver.createNetwork has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Near-duplicate member pair (37 shared lines) distribution/xfer/download.go:238— distribution/xfer/download.go:238-396 | distribution/xfer/download.go:405-488 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (37 shared lines) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:29— libnetwork/drivers/ipvlan/ipvlan_joinleave.go:29-136 | libnetwork/drivers/macvlan/macvlan_joinleave.go:17-97 — These two members are variants of one another: 37 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×2
Edited copy of a member (39 corresponding lines) libcontainerd/local/local_windows.go:776— libcontainerd/local/local_windows.go:776-814 | libcontainerd/local/local_windows.go:817-855 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (39 corresponding lines) libnetwork/osl/namespace_linux.go:182— libnetwork/osl/namespace_linux.go:182-226 | libnetwork/osl/namespace_linux.go:233-271 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (42 corresponding lines) · ×2
Edited copy of a member (42 corresponding lines) libnetwork/service_common.go:14— libnetwork/service_common.go:14-55 | libnetwork/service_common.go:75-119 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (42 corresponding lines) libnetwork/drivers/ipvlan/ipvlan.go:15— libnetwork/drivers/ipvlan/ipvlan.go:15-62 | libnetwork/drivers/macvlan/macvlan.go:15-56 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×2
Edited copy of a member (26 corresponding lines) daemon/graphdriver/graphtest/graphbench_unix.go:60— daemon/graphdriver/graphtest/graphbench_unix.go:60-85 | daemon/graphdriver/graphtest/graphbench_unix.go:190-220 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (26 corresponding lines) daemon/info_unix.go:203— daemon/info_unix.go:203-228 | daemon/info_unix.go:479-508 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×2
Edited copy of a member (30 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_setup.go:23— libnetwork/drivers/ipvlan/ipvlan_setup.go:23-58 | libnetwork/drivers/macvlan/macvlan_setup.go:21-50 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (30 corresponding lines) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:336— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:336-365 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:396-426 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) integration/internal/container/ops.go:128— integration/internal/container/ops.go:128-138 | integration/internal/container/ops.go:141-154 | integration/internal/container/ops.go:157-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) client/container_diff.go:12— client/container_diff.go:12-23 | client/image_history.go:12-22 | client/info.go:13-26 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×2
Edited copy of a member (6 corresponding lines) pkg/tarsum/fileinfosums.go:110— pkg/tarsum/fileinfosums.go:110-115 | pkg/tarsum/fileinfosums.go:123-128 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (6 corresponding lines) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:152— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:152-157 | daemon/graphdriver/vfs/driver.go:155-161 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×2
Edited copies of one member (3 members, 9+ corresponding lines) builder/builder-next/adapters/containerimage/pull.go:804— builder/builder-next/adapters/containerimage/pull.go:804-813 | daemon/containerd/progress.go:98-107 | libnetwork/internal/setmatrix/setmatrix.go:107-115 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 9+ corresponding lines) client/node_remove.go:11— client/node_remove.go:11-20 | client/plugin_disable.go:11-19 | client/plugin_remove.go:11-20 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (33 lines × 2) client/service_create.go:37— client/service_create.go:37-69 | client/service_update.go:41-73 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (33 lines × 2) libnetwork/drivers/ipvlan/ipvlan_network.go:31— libnetwork/drivers/ipvlan/ipvlan_network.go:31-63 | libnetwork/drivers/macvlan/macvlan_network.go:21-53 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_network.go:31` it begins part-way through the construct above it, so those 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 (22 lines × 2) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:332— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:332-353 | daemon/graphdriver/overlay2/overlay.go:544-565 — before extracting anything, compare `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go` and `daemon/graphdriver/overlay2/overlay.go` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 220 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:332` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (22 lines × 2) libnetwork/drivers/overlay/encryption.go:365— libnetwork/drivers/overlay/encryption.go:365-386 | libnetwork/drivers/overlay/encryption.go:567-588 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (17–18 lines × 2) daemon/containerd/image_snapshot_unix.go:76— daemon/containerd/image_snapshot_unix.go:76-92 | daemon/containerd/image_snapshot_unix.go:99-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/containerd/image_snapshot_unix.go:76` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (17–18 lines × 2) libcontainerd/local/local_windows.go:443— libcontainerd/local/local_windows.go:443-460 | libcontainerd/local/local_windows.go:612-628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libcontainerd/local/local_windows.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. 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 (13 lines × 3) libnetwork/portmapper/mapper.go:69— libnetwork/portmapper/mapper.go:69-81 | libnetwork/portmapper/mapper.go:100-112 | libnetwork/portmapper/mapper.go:131-143 — 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 `libnetwork/portmapper/mapper.go:69` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (13 lines × 3) libnetwork/drivers/bridge/bridge_store.go:306— libnetwork/drivers/bridge/bridge_store.go:306-318 | libnetwork/drivers/ipvlan/ipvlan_store.go:292-304 | libnetwork/drivers/macvlan/macvlan_store.go:286-298 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
Duplicated block (12 lines × 3) client/container_logs.go:37— client/container_logs.go:37-48 | client/service_logs.go:17-28 | client/task_logs.go:16-27 — before extracting anything, compare `client/container_logs.go` and `client/service_logs.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `client/container_logs.go:37` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 3) client/container_logs.go:62— client/container_logs.go:62-73 | client/service_logs.go:34-45 | client/task_logs.go:33-44 — before extracting anything, compare `client/container_logs.go` and `client/service_logs.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 38 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
Duplicated block (11–12 lines × 2) api/server/router/container/container_routes.go:773— api/server/router/container/container_routes.go:773-784 | api/server/router/container/exec.go:163-173 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11–12 lines × 2) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:186— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:186-197 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:204-214 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:216` calls `Sleep`, `leaveNetwork`, `joinNetwork` and `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:198` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 4) libnetwork/networkdb/networkdbdiagnostic.go:129— libnetwork/networkdb/networkdbdiagnostic.go:129-139 | libnetwork/networkdb/networkdbdiagnostic.go:178-188 | libnetwork/networkdb/networkdbdiagnostic.go:263-273 | libnetwork/networkdb/networkdbdiagnostic.go:373-383 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (11 lines × 4) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:465— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:465-475 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:498-508 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:531-541 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:568-578 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:582` calls `WithTimeout`, `Background`, `Duration` and `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:479` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) daemon/oci_linux.go:277— daemon/oci_linux.go:277-287 | daemon/oci_linux.go:310-320 | daemon/oci_linux.go:346-356 — 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 `daemon/oci_linux.go:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 3) libnetwork/drivers/bridge/bridge_linux.go:492— libnetwork/drivers/bridge/bridge_linux.go:492-504 | libnetwork/drivers/ipvlan/ipvlan_state.go:93-104 | libnetwork/drivers/macvlan/macvlan_state.go:92-102 — `libnetwork/drivers/ipvlan/ipvlan_state.go` and `libnetwork/drivers/macvlan/macvlan_state.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 57 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (8 lines × 3) daemon/logger/loggertest/logreader.go:261— daemon/logger/loggertest/logreader.go:261-268 | daemon/logger/loggertest/logreader.go:286-293 | daemon/logger/loggertest/logreader.go:311-318 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also 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 (8 lines × 3) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:603— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:603-610 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:632-639 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:678-685 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also 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 (5 lines × 3) daemon/graphdriver/plugin.go:44— daemon/graphdriver/plugin.go:44-48 | libnetwork/drivers/remote/driver.go:83-87 | libnetwork/ipams/remote/remote.go:81-85 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 3) libnetwork/networkdb/nodemgmt.go:100— libnetwork/networkdb/nodemgmt.go:100-104 | libnetwork/networkdb/nodemgmt.go:108-112 | libnetwork/networkdb/nodemgmt.go:116-120 — 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 `libnetwork/networkdb/nodemgmt.go:100` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X28 · Index access outside its own emptiness guard· Index access outside its own emptiness guard · ×2
Index access outside its own emptiness guard container/env.go:13— `index` is the result of a search that answers -1 when nothing is found, and `e[:index]` uses it as a bound with no test of `index` in between. When the search misses, the bound is -1 and the access panics with `slice bounds out of range`. Test `index < 0` (or use `strings.Cut`) before using it.
Index access outside its own emptiness guard builder/dockerfile/dispatchers_windows.go:87— This condition tests `requested` for emptiness and then indexes it on a branch that test does not reach. `requested[0]` is evaluated whenever the guarded half is false — which includes the case the guard exists to anticipate, `requested` being empty — so an empty `requested` indexes position 0 of nothing and throws. This same condition already shows the intended bracketing at line 88: `requested[1]` sits INSIDE the guard. Either the guard is load-bearing, in which case this access escapes it and crashes, or `requested` cannot be empty here, in which case the guard beside it is dead code — the condition is wrong under both readings. Move the parenthesis so the emptiness test brackets every access to `requested`.
Stateful package: dummyclient libnetwork/cmd/networkdb-test/dummyclient/dummyClient.go:51— Package `dummyclient` serves requests (request-handler function literals run on a goroutine per request, and every one sees the same package variables and captured values) but writes that shared state outside any lock (clientWatchTable; e.g. `clientWatchTable` in `watchTable` at line 51). Unsynchronised concurrent writes are a data race in Go: an update is lost or a value tears, and a concurrent map write aborts the process.
Stateful handler: Ctx pkg/authorization/authz.go:48— `Ctx` serves requests (net/http handlers run on a goroutine per request, and every one shares the single `Ctx` value the router holds) but writes its fields outside any lock (authReq; e.g. `authReq` in `AuthZRequest` at line 87). Unsynchronised concurrent writes are a data race in Go: an update is lost or a value tears, and a concurrent map write aborts the process.
daemon.verifyPlatformContainerResources (cyclomatic 83) REDACTED:404— daemon.verifyPlatformContainerResources has cyclomatic complexity 83 (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.
Daemon.restore (cyclomatic 70) daemon/daemon.go:256— Daemon.restore has cyclomatic complexity 70 (threshold 15). Most of this is not in the body itself: 12 of the 70 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 350, 596, 280, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
daemon.NewDaemon (cyclomatic 67) daemon/daemon.go:752— daemon.NewDaemon has cyclomatic complexity 67 (threshold 15). Of this number, 60 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.Images (cyclomatic 65) daemon/images/image_list.go:37— ImageService.Images has cyclomatic complexity 65 (threshold 15). Of this number, 54 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
daemon.withMounts (cyclomatic 63) daemon/oci_linux.go:503— daemon.withMounts has cyclomatic complexity 63 (threshold 15). Most of this is not in the body itself: 1 of the 63 points is its own statement and the rest belongs to one function literal inside it that branches (line 504). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
cache.compare (cyclomatic 53) image/cache/compare.go:45— cache.compare has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
containerRouter.postContainersCreate (cyclomatic 52) api/server/router/container/container_routes.go:480— containerRouter.postContainersCreate has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.NewNetwork (cyclomatic 50) libnetwork/controller.go:471— Controller.NewNetwork has cyclomatic complexity 50 (threshold 15). Of this number, 38 points are the body's own statements and 12 belong to 6 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.
daemon.includeContainerInList (cyclomatic 49) daemon/list.go:388— daemon.includeContainerInList has cyclomatic complexity 49 (threshold 15). Of this number, 42 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.
Daemon.registerMountPoints (cyclomatic 47) daemon/volumes.go:57— Daemon.registerMountPoints has cyclomatic complexity 47 (threshold 15). Of this number, 42 points are the body's own statements and 5 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.
Builder.Build (cyclomatic 45) builder/builder-next/builder.go:229— Builder.Build has cyclomatic complexity 45 (threshold 15). Of this number, 38 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.
archive.createTarFile (cyclomatic 44) REDACTED:678— archive.createTarFile has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.createSpec (cyclomatic 41) daemon/oci_linux.go:1060— Daemon.createSpec has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Endpoint.sbJoin (cyclomatic 41) REDACTED:428— Endpoint.sbJoin has cyclomatic complexity 41 (threshold 15). Of this number, 33 points are the body's own statements and 8 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.
archive.UnpackLayer (cyclomatic 40) REDACTED:21— archive.UnpackLayer has cyclomatic complexity 40 (threshold 15). Of this number, 36 points are the body's own statements and 4 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.
DaemonCli.start (cyclomatic 39) cmd/dockerd/daemon.go:96— DaemonCli.start has cyclomatic complexity 39 (threshold 15). Of this number, 33 points are the body's own statements and 6 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
IPTable.ProgramChain (cyclomatic 38) libnetwork/iptables/iptables.go:212— IPTable.ProgramChain has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
puller.Snapshot (cyclomatic 37) builder/builder-next/adapters/containerimage/pull.go:382— puller.Snapshot has cyclomatic complexity 37 (threshold 15). Of this number, 29 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
daemon.verifyPlatformContainerResources (cyclomatic 37) daemon/daemon_windows.go:74— daemon.verifyPlatformContainerResources has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.initNetworkController (cyclomatic 37) REDACTED:838— Daemon.initNetworkController has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.buildSandboxOptions (cyclomatic 36) daemon/container_operations.go:45— Daemon.buildSandboxOptions has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
copy.DirCopy (cyclomatic 36) daemon/graphdriver/copy/copy.go:124— copy.DirCopy has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 4 of the 36 points are its own statements and the rest belongs to one function literal inside it that branches (line 132). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tarexporter.Load (cyclomatic 35) image/tarexport/load.go:33— tarexporter.Load has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Network.UnmarshalJSON (cyclomatic 35) libnetwork/network.go:578— Network.UnmarshalJSON has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
client.createWindows (cyclomatic 35) libcontainerd/local/local_windows.go:180— client.createWindows has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
splunk.New (cyclomatic 34) REDACTED:153— splunk.New has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.CreateEndpoint (cyclomatic 34) libnetwork/drivers/bridge/bridge_linux.go:918— driver.CreateEndpoint has cyclomatic complexity 34 (threshold 15). Of this number, 29 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Tarballer.Do (cyclomatic 34) REDACTED:911— Tarballer.Do has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 6 of the 34 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 974, 919). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.StartWithLogFile (cyclomatic 34) testutil/daemon/daemon.go:434— Daemon.StartWithLogFile has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
walker.walk (cyclomatic 33) REDACTED:89— walker.walk has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.ImageDelete (cyclomatic 32) daemon/containerd/image_delete.go:58— ImageService.ImageDelete has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.Images (cyclomatic 32) daemon/containerd/image_list.go:63— ImageService.Images has cyclomatic complexity 32 (threshold 15). Of this number, 23 points are the body's own statements and 9 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.
pushDescriptor.Upload (cyclomatic 32) distribution/push_v2.go:299— pushDescriptor.Upload has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.resolveAllReferences (cyclomatic 31) daemon/containerd/image.go:425— ImageService.resolveAllReferences has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
archive.Unpack (cyclomatic 31) REDACTED:1088— archive.Unpack has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
seccomp.setupSeccomp (cyclomatic 31) profiles/seccomp/seccomp_linux.go:77— seccomp.setupSeccomp has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
daemon.merge (cyclomatic 30) daemon/commit.go:24— daemon.merge has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.ContainerLogs (cyclomatic 30) daemon/logs.go:26— Daemon.ContainerLogs has cyclomatic complexity 30 (threshold 15). Of this number, 17 points are the body's own statements and 13 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.
ImageService.DeltaCreate (cyclomatic 30) daemon/images/image_delta.go:30— ImageService.DeltaCreate has cyclomatic complexity 30 (threshold 15). Of this number, 24 points are the body's own statements and 6 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.
puller.pullSchema2Layers (cyclomatic 30) distribution/pull_v2.go:547— puller.pullSchema2Layers has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tarAppender.addTarFile (cyclomatic 30) REDACTED:563— tarAppender.addTarFile has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
build.newImageBuildOptions (cyclomatic 29) api/server/router/build/build_routes.go:38— build.newImageBuildOptions has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.connectToNetwork (cyclomatic 29) daemon/container_operations.go:642— Daemon.connectToNetwork has cyclomatic complexity 29 (threshold 15). Of this number, 27 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.
Daemon.ContainerRename (cyclomatic 29) daemon/rename.go:20— Daemon.ContainerRename has cyclomatic complexity 29 (threshold 15). Of this number, 21 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.
ImageService.ImagesPrune (cyclomatic 29) daemon/images/image_prune.go:36— ImageService.ImagesPrune has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
awslogs.ValidateLogOpt (cyclomatic 29) daemon/logger/awslogs/cloudwatchlogs.go:741— awslogs.ValidateLogOpt has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.containerStart (cyclomatic 28) daemon/start.go:110— Daemon.containerStart has cyclomatic complexity 28 (threshold 15). Of this number, 19 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
puller.pullTag (cyclomatic 28) distribution/pull_v2.go:284— puller.pullTag has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
saveSession.save (cyclomatic 28) image/tarexport/save.go:182— saveSession.save has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.CreateEndpoint (cyclomatic 28) libnetwork/drivers/windows/windows.go:601— driver.CreateEndpoint has cyclomatic complexity 28 (threshold 15). Of this number, 27 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.
ImageService.setupFilters (cyclomatic 27) daemon/containerd/image_list.go:320— ImageService.setupFilters has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 9 of the 27 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 322, 342, 402, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.create (cyclomatic 27) REDACTED:146— Daemon.create has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong 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.
Daemon.ContainerExecStart (cyclomatic 27) daemon/exec.go:151— Daemon.ContainerExecStart has cyclomatic complexity 27 (threshold 15). Of this number, 25 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.
Controller.reservePools (cyclomatic 27) libnetwork/controller.go:739— Controller.reservePools has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Endpoint.sbLeave (cyclomatic 27) REDACTED:661— Endpoint.sbLeave has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.CreateNetwork (cyclomatic 27) libnetwork/drivers/windows/overlay/ov_network_windows.go:64— driver.CreateNetwork has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.Join (cyclomatic 26) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:29— driver.Join has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Network.createEndpoint (cyclomatic 26) libnetwork/network.go:1137— Network.createEndpoint has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 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.
dockerfile.dispatch (cyclomatic 25) builder/dockerfile/evaluator.go:39— dockerfile.dispatch has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 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 taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
ImageService.ExportImage (cyclomatic 25) daemon/containerd/image_exporter.go:50— ImageService.ExportImage has cyclomatic complexity 25 (threshold 15). Of this number, 15 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.pruneUnused (cyclomatic 25) daemon/containerd/image_prune.go:65— ImageService.pruneUnused has cyclomatic complexity 25 (threshold 15). Of this number, 23 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.
Info.ExtraAttributes (cyclomatic 25) daemon/logger/loginfo.go:30— Info.ExtraAttributes has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
distribution.detectManifestBlobMediaType (cyclomatic 25) distribution/manifest.go:262— distribution.detectManifestBlobMediaType has cyclomatic complexity 25 (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.
LayerDownloadManager.makeDownloadFunc (cyclomatic 25) distribution/xfer/download.go:238— LayerDownloadManager.makeDownloadFunc has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to one function literal inside it that branches (line 239). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
tarexporter.parseNames (cyclomatic 25) image/tarexport/save.go:58— tarexporter.parseNames has cyclomatic complexity 25 (threshold 15). Of this number, 17 points are the body's own statements and 8 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.
driver.Join (cyclomatic 25) libnetwork/drivers/overlay/joinleave.go:22— driver.Join has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Network.delete (cyclomatic 25) libnetwork/network.go:953— Network.delete has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Manager.reload (cyclomatic 25) plugin/manager.go:171— Manager.reload has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 205). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
linuxParser.validateMountConfigImpl (cyclomatic 25) volume/mounts/linux_parser.go:48— linuxParser.validateMountConfigImpl has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
windowsParser.validateMountConfigReg (cyclomatic 25) volume/mounts/windows_parser.go:215— windowsParser.validateMountConfigReg has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Client.ContainerCreate (cyclomatic 24) client/container_create.go:23— Client.ContainerCreate has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
daemon.WithNamespaces (cyclomatic 24) daemon/oci_linux.go:251— daemon.WithNamespaces has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 252). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Daemon.openContainerFS (cyclomatic 24) daemon/containerfs_linux.go:56— Daemon.openContainerFS has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 4 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 82, 147, 60, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.ProcessEvent (cyclomatic 24) daemon/monitor.go:158— Daemon.ProcessEvent has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.ImageDelete (cyclomatic 24) daemon/images/image_delete.go:63— ImageService.ImageDelete has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Copier.copySrc (cyclomatic 24) daemon/logger/copier.go:53— Copier.copySrc has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fluentd.parseConfig (cyclomatic 24) daemon/logger/fluentd/fluentd.go:169— fluentd.parseConfig has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
archive.changes (cyclomatic 24) pkg/archive/changes.go:116— archive.changes has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 122). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
systemRouter.getDiskUsage (cyclomatic 23) api/server/router/system/system_routes.go:107— systemRouter.getDiskUsage has cyclomatic complexity 23 (threshold 15). Of this number, 21 points are the body's own statements and 2 belong 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.
imageExporterInstance.Export (cyclomatic 23) builder/builder-next/exporter/mobyexporter/export.go:88— imageExporterInstance.Export has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dockerd.loadDaemonCliConfig (cyclomatic 23) cmd/dockerd/daemon.go:510— dockerd.loadDaemonCliConfig has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
network.FilterNetworks (cyclomatic 23) daemon/network/filter.go:13— network.FilterNetworks has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
PortMapper.MapRange (cyclomatic 23) libnetwork/portmapper/mapper.go:55— PortMapper.MapRange has cyclomatic complexity 23 (threshold 15). Of this number, 20 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Sandbox.setupDNS (cyclomatic 23) libnetwork/sandbox_dns_unix.go:205— Sandbox.setupDNS has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Driver.Remove (cyclomatic 23) REDACTED:265— Driver.Remove has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.CreateNetwork (cyclomatic 23) libnetwork/drivers/windows/windows.go:268— driver.CreateNetwork has cyclomatic complexity 23 (threshold 15). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
imageRouter.postImagesCreate (cyclomatic 22) api/server/router/image/image_routes.go:35— imageRouter.postImagesCreate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.containerAttach (cyclomatic 22) REDACTED:110— Daemon.containerAttach has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.ContainerStats (cyclomatic 22) daemon/stats.go:22— Daemon.ContainerStats has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
errdefs.FromStatusCode (cyclomatic 22) errdefs/http_helpers.go:8— errdefs.FromStatusCode has cyclomatic complexity 22 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
remote.monitorDaemon (cyclomatic 22) libcontainerd/supervisor/remote_daemon.go:238— remote.monitorDaemon has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
networkConfiguration.fromLabels (cyclomatic 22) libnetwork/drivers/bridge/bridge_linux.go:275— networkConfiguration.fromLabels has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.link (cyclomatic 22) libnetwork/drivers/bridge/bridge_linux.go:1456— driver.link has cyclomatic complexity 22 (threshold 15). Of this number, 20 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.
driver.CreateNetwork (cyclomatic 22) libnetwork/drivers/overlay/ov_network.go:94— driver.CreateNetwork has cyclomatic complexity 22 (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.
Resolver.serveDNS (cyclomatic 22) REDACTED:354— Resolver.serveDNS has cyclomatic complexity 22 (threshold 15). Of this number, 19 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.
specconv.toRootless (cyclomatic 22) pkg/rootless/specconv/specconv_linux.go:56— specconv.toRootless has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tarSum.Read (cyclomatic 22) pkg/tarsum/tarsum.go:191— tarSum.Read has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
VolumeStore.filter (cyclomatic 22) volume/service/store.go:250— VolumeStore.filter has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ssd.check_network (cyclomatic 22) REDACTED:63— ssd.check_network has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
buildkit.newGraphDriverController (cyclomatic 21) builder/builder-next/controller.go:194— buildkit.newGraphDriverController has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Client.imageBuildOptionsToQuery (cyclomatic 21) client/image_build.go:46— Client.imageBuildOptionsToQuery has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
daemon.buildCreateEndpointOptions (cyclomatic 21) daemon/network.go:612— daemon.buildCreateEndpointOptions has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.pullTag (cyclomatic 21) daemon/containerd/image_pull.go:65— ImageService.pullTag has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 116, 84, 96). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.createNetwork (cyclomatic 21) daemon/network.go:149— Daemon.createNetwork has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Driver.Get (cyclomatic 21) daemon/graphdriver/overlay2/overlay.go:515— Driver.Get has cyclomatic complexity 21 (threshold 15). Of this number, 16 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gelf.ValidateLogOpt (cyclomatic 21) daemon/logger/gelf/gelf.go:200— gelf.ValidateLogOpt has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
pusher.pushTag (cyclomatic 21) distribution/push_v2.go:127— pusher.pushTag has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
tarexporter.legacyLoadImage (cyclomatic 21) image/tarexport/load.go:311— tarexporter.legacyLoadImage has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.handleKeyChange (cyclomatic 21) libnetwork/agent.go:114— Controller.handleKeyChange has cyclomatic complexity 21 (threshold 15). Of this number, 18 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.
Controller.handleEpTableEvent (cyclomatic 21) libnetwork/agent.go:902— Controller.handleEpTableEvent has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Controller.sandboxCleanup (cyclomatic 21) libnetwork/sandbox_store.go:171— Controller.sandboxCleanup has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Network.validateConfiguration (cyclomatic 21) libnetwork/network.go:345— Network.validateConfiguration has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Namespace.Restore (cyclomatic 21) libnetwork/osl/namespace_linux.go:483— Namespace.Restore has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Plugin.Set (cyclomatic 21) plugin/v2/plugin.go:113— Plugin.Set has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpstatus.FromError (cyclomatic 20) api/server/httpstatus/status.go:21— httpstatus.FromError has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
time.GetTimestamp (cyclomatic 20) api/types/time/timestamp.go:26— time.GetTimestamp has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Config.CopyStreams (cyclomatic 20) container/stream/attach.go:60— Config.CopyStreams has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 65, 134, 100). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
View.transform (cyclomatic 20) container/view.go:301— View.transform has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.createDiff (cyclomatic 20) daemon/containerd/image_commit.go:153— ImageService.createDiff has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
graphtest.DriverTestDiffApply (cyclomatic 20) daemon/graphdriver/graphtest/graphtest_unix.go:170— graphtest.DriverTestDiffApply has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
overlay2.doesSupportNativeDiff (cyclomatic 20) daemon/graphdriver/overlay2/check.go:27— overlay2.doesSupportNativeDiff has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
jsonlog.ffjsonWriteJSONBytesAsString (cyclomatic 20) daemon/logger/jsonfilelog/jsonlog/jsonlogbytes.go:64— jsonlog.ffjsonWriteJSONBytesAsString has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
loggerutils.volumeName (cyclomatic 20) REDACTED:191— loggerutils.volumeName has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cnmNetworkAllocator.IsServiceAllocated (cyclomatic 20) libnetwork/cnmallocator/networkallocator.go:351— cnmNetworkAllocator.IsServiceAllocated has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.updateKeys (cyclomatic 20) libnetwork/drivers/overlay/encryption.go:466— driver.updateKeys has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Network.ipamAllocateVersion (cyclomatic 20) libnetwork/network.go:1565— Network.ipamAllocateVersion has cyclomatic complexity 20 (threshold 15). Of this number, 18 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.
Network.addLBBackend (cyclomatic 20) libnetwork/service_linux.go:82— Network.addLBBackend has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
NetworkDB.handleTableEvent (cyclomatic 20) libnetwork/networkdb/delegate.go:141— NetworkDB.handleTableEvent has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
requestReader.Read (cyclomatic 20) registry/resumable/resumablerequestreader.go:37— requestReader.Read has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
VolumeStore.getVolume (cyclomatic 20) volume/service/store.go:680— VolumeStore.getVolume has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.CreateEndpoint (cyclomatic 20) libnetwork/drivers/windows/overlay/ov_endpoint_windows.go:96— driver.CreateEndpoint has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, 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.
driver.parseNetworkOptions (cyclomatic 20) libnetwork/drivers/windows/windows.go:175— driver.parseNetworkOptions has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.allocateNetwork (cyclomatic 19) daemon/container_operations.go:438— Daemon.allocateNetwork has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
overlay2.Init (cyclomatic 19) daemon/graphdriver/overlay2/overlay.go:126— overlay2.Init has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
client.processEventStream (cyclomatic 19) libcontainerd/remote/client.go:604— client.processEventStream has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cnmNetworkAllocator.AllocateService (cyclomatic 19) libnetwork/cnmallocator/networkallocator.go:191— cnmNetworkAllocator.AllocateService has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
driver.Join (cyclomatic 19) libnetwork/drivers/macvlan/macvlan_joinleave.go:17— driver.Join has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Endpoint.UnmarshalJSON (cyclomatic 19) REDACTED:84— Endpoint.UnmarshalJSON has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
RestartManager.ShouldRestart (cyclomatic 19) restartmanager/restartmanager.go:48— RestartManager.ShouldRestart has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 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.
daemon.NewDaemon (cyclomatic 19) testutil/daemon/daemon.go:104— daemon.NewDaemon has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
containerRouter.postContainerExecStart (cyclomatic 18) api/server/router/container/exec.go:69— containerRouter.postContainerExecStart has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
mobyexporter.normalizeLayersAndHistory (cyclomatic 18) builder/builder-next/exporter/mobyexporter/writer.go:95— mobyexporter.normalizeLayersAndHistory has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Client.doRequest (cyclomatic 18) client/request.go:138— Client.doRequest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
dockerd.loadListeners (cyclomatic 18) cmd/dockerd/daemon.go:810— dockerd.loadListeners has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
daemon.handleProbeResult (cyclomatic 18) daemon/health.go:181— daemon.handleProbeResult has cyclomatic complexity 18 (threshold 15). Of this number, 15 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.
daemon.withCommonOptions (cyclomatic 18) daemon/oci_linux.go:755— daemon.withCommonOptions has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 756). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.resolveImage (cyclomatic 18) daemon/containerd/image.go:276— ImageService.resolveImage has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.containerExtractToDir (cyclomatic 18) daemon/archive_unix.go:100— Daemon.containerExtractToDir has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.generateSecurityOpt (cyclomatic 18) REDACTED:277— Daemon.generateSecurityOpt has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.setWindowsCredentialSpec (cyclomatic 18) REDACTED:342— Daemon.setWindowsCredentialSpec has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Driver.Get (cyclomatic 18) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:301— Driver.Get has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 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.
jsonfilelog.New (cyclomatic 18) daemon/logger/jsonfilelog/jsonfilelog.go:48— jsonfilelog.New has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
loggerutils.fixLongPath (cyclomatic 18) REDACTED:91— loggerutils.fixLongPath has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
pushDescriptor.layerAlreadyExists (cyclomatic 18) distribution/push_v2.go:531— pushDescriptor.layerAlreadyExists has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cache.getLocalCachedImage (cyclomatic 18) image/cache/cache.go:221— cache.getLocalCachedImage has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 239, 226). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
saveSession.saveConfigAndLayer (cyclomatic 18) image/tarexport/save.go:460— saveSession.saveConfigAndLayer has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Namespace.AddInterface (cyclomatic 18) libnetwork/osl/interface_linux.go:165— Namespace.AddInterface has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
LocalRegistry.Scan (cyclomatic 18) pkg/plugins/discovery.go:37— LocalRegistry.Scan has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
stdcopy.StdCopy (cyclomatic 18) pkg/stdcopy/stdcopy.go:94— stdcopy.StdCopy has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ContainerConfigWrapper.getHostConfig (cyclomatic 18) runconfig/config_unix.go:22— ContainerConfigWrapper.getHostConfig has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
container.handleMACAddressBC (cyclomatic 17) api/server/router/container/container_routes.go:675— container.handleMACAddressBC 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.
distributionRouter.fetchManifest (cyclomatic 17) api/server/router/distribution/distribution_routes.go:77— distributionRouter.fetchManifest 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.
systemRouter.getEvents (cyclomatic 17) api/server/router/system/system_routes.go:215— systemRouter.getEvents 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.
copier.calcCopyInfo (cyclomatic 17) builder/dockerfile/copy.go:170— copier.calcCopyInfo 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.
daemon.validateEndpointSettings (cyclomatic 17) daemon/container_operations.go:523— daemon.validateEndpointSettings 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.
daemon.parseRemappedRoot (cyclomatic 17) REDACTED:1096— daemon.parseRemappedRoot 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.
config.Validate (cyclomatic 17) REDACTED:637— config.Validate has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
localCache.GetCache (cyclomatic 17) daemon/containerd/cache.go:57— localCache.GetCache 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.
ImageService.GetImageAndReleasableLayer (cyclomatic 17) daemon/containerd/image_builder.go:69— ImageService.GetImageAndReleasableLayer 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.
Daemon.updateContainerNetworkSettings (cyclomatic 17) daemon/container_operations.go:362— Daemon.updateContainerNetworkSettings has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.containerCreate (cyclomatic 17) REDACTED:60— Daemon.containerCreate has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.cleanupContainer (cyclomatic 17) daemon/delete.go:90— Daemon.cleanupContainer 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.
Driver.Create (cyclomatic 17) REDACTED:487— Driver.Create 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.
LayerDownloadManager.Download (cyclomatic 17) distribution/xfer/download.go:119— LayerDownloadManager.Download has cyclomatic complexity 17 (threshold 15). Of this number, 15 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.
Controller.NewSandbox (cyclomatic 17) libnetwork/controller.go:884— Controller.NewSandbox has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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.
driver.configure (cyclomatic 17) libnetwork/drivers/bridge/bridge_linux.go:395— driver.configure has cyclomatic complexity 17 (threshold 15). Of this number, 15 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.
Endpoint.Delete (cyclomatic 17) REDACTED:775— Endpoint.Delete has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong 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.
NetworkDB.Watch (cyclomatic 17) libnetwork/networkdb/watch.go:57— NetworkDB.Watch has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 61, 95, 116). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Sandbox.delete (cyclomatic 17) libnetwork/sandbox.go:137— Sandbox.delete 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.
Sandbox.clearNetworkResources (cyclomatic 17) libnetwork/sandbox.go:589— Sandbox.clearNetworkResources 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.
runconfig.validateNetContainerMode (cyclomatic 17) runconfig/hostconfig.go:33— runconfig.validateNetContainerMode has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.StopWithError (cyclomatic 17) testutil/daemon/daemon.go:679— Daemon.StopWithError has cyclomatic complexity 17 (threshold 15). Of this number, 14 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.
MountPoint.Setup (cyclomatic 17) volume/mounts/mounts.go:112— MountPoint.Setup has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reader.drainJournal (cyclomatic 17) daemon/logger/journald/read.go:251— reader.drainJournal 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.
swarm.adjustForAPIVersion (cyclomatic 16) api/server/router/swarm/helpers.go:77— swarm.adjustForAPIVersion has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
containerimage.showProgress (cyclomatic 16) builder/builder-next/adapters/containerimage/pull.go:675— containerimage.showProgress has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
snapshotter.Usage (cyclomatic 16) builder/builder-next/adapters/snapshot/snapshot.go:418— snapshotter.Usage has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Client.ServiceCreate (cyclomatic 16) client/service_create.go:20— Client.ServiceCreate has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Container.StartLogger (cyclomatic 16) container/container.go:397— Container.StartLogger has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
config.findConfigurationConflicts (cyclomatic 16) REDACTED:551— config.findConfigurationConflicts has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
containerd.setupLabelFilter (cyclomatic 16) daemon/containerd/image_list.go:433— containerd.setupLabelFilter has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 467). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.deleteAll (cyclomatic 16) daemon/containerd/image_delete.go:188— ImageService.deleteAll has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 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.
ImageService.getSameReferences (cyclomatic 16) daemon/containerd/image_delete.go:276— ImageService.getSameReferences has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ImageService.ImageHistory (cyclomatic 16) daemon/containerd/image_history.go:18— ImageService.ImageHistory has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.Shutdown (cyclomatic 16) daemon/daemon.go:1301— Daemon.Shutdown has cyclomatic complexity 16 (threshold 15). Of this number, 13 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.
Daemon.filterByNameIDMatches (cyclomatic 16) daemon/list.go:158— Daemon.filterByNameIDMatches has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Daemon.foldFilter (cyclomatic 16) daemon/list.go:228— Daemon.foldFilter has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Daemon.ContainerStart (cyclomatic 16) daemon/start.go:44— Daemon.ContainerStart has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
btrfs.subvolDelete (cyclomatic 16) REDACTED:262— btrfs.subvolDelete has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 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.
ImageService.manifestMatchesPlatform (cyclomatic 16) daemon/images/image.go:54— ImageService.manifestMatchesPlatform has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
gcplogs.New (cyclomatic 16) daemon/logger/gcplogs/gcplogging.go:106— gcplogs.New has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong 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.
splunkLogger.tryPostMessages (cyclomatic 16) REDACTED:474— splunkLogger.tryPostMessages has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: splunk.ValidateLogOpt (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
distribution.pullEndpoints (cyclomatic 16) distribution/pull.go:76— distribution.pullEndpoints has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
puller.pullManifestList (cyclomatic 16) distribution/pull_v2.go:749— puller.pullManifestList has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
saveSession.saveImage (cyclomatic 16) image/tarexport/save.go:383— saveSession.saveImage has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
client.newStdioPipes (cyclomatic 16) libcontainerd/remote/client_io_windows.go:59— client.newStdioPipes has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 78, 111, 144, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
cnmNetworkAllocator.allocatePools (cyclomatic 16) libnetwork/cnmallocator/networkallocator.go:848— cnmNetworkAllocator.allocatePools has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
bridge.setupIPChains (cyclomatic 16) libnetwork/drivers/bridge/setup_ip_tables_linux.go:35— bridge.setupIPChains has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
driver.Join (cyclomatic 16) libnetwork/drivers/remote/driver.go:252— driver.Join has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
archive.ReplaceFileTarWrapper (cyclomatic 16) REDACTED:320— archive.ReplaceFileTarWrapper has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 323). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
jsonmessage.DisplayJSONMessagesStream (cyclomatic 16) pkg/jsonmessage/jsonmessage.go:228— jsonmessage.DisplayJSONMessagesStream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
JSONProgress.String (cyclomatic 16) pkg/jsonmessage/jsonmessage.go:54— JSONProgress.String has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
main.Parse (cyclomatic 16) pkg/plugins/pluginrpc-gen/parser.go:65— main.Parse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Service.Search (cyclomatic 16) registry/search.go:25— Service.Search has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FixmeComment repeated across 28 files testutil/helpers.go:1— The identical FixmeComment appears in 28 files (28 occurrences) — almost certainly one boilerplate line from a single migration or decision, not 28 independent debts. Fix the systemic cause once rather than file-by-file. Text: "// FIXME(thaJeztah): remove once we are a module; the go:build directive prevents go from downgrading language version to go1.16:". Source code is not a task system: track the cleanup where tasks live. (Every occurrence still counts toward the score and metrics.)
Daemon.restore (cognitive 147) daemon/daemon.go:256— Daemon.restore has cognitive complexity 147 (threshold 15). Drivers by points: if/else 47 (117 pts), match/switch 3 (11 pts), boolean chains 10, loops 8 (9 pts) (nesting depth added 79). Most of this is not in the body itself: 12 of the 147 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 350, 596, 280, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
ImageService.Images (cognitive 136) daemon/images/image_list.go:37— ImageService.Images has cognitive complexity 136 (threshold 15). Drivers by points: if/else 44 (101 pts), loops 8 (20 pts), boolean chains 13, match/switch 1 (2 pts) (nesting depth added 70). Of this number, 125 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.withMounts (cognitive 131) daemon/oci_linux.go:503— daemon.withMounts has cognitive complexity 131 (threshold 15). Drivers by points: if/else 44 (109 pts), loops 6 (9 pts), boolean chains 8, match/switch 2 (5 pts) (nesting depth added 71). None of this is in the body itself: all 131 points belong to one function literal inside it that branches (line 504). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
archive.UnpackLayer (cognitive 113) REDACTED:21— archive.UnpackLayer has cognitive complexity 113 (threshold 15). Drivers by points: if/else 36 (108 pts), boolean chains 3, loops 2 (nesting depth added 72). Of this number, 96 points are the body's own statements and 17 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Daemon.registerMountPoints (cognitive 99) daemon/volumes.go:57— Daemon.registerMountPoints has cognitive complexity 99 (threshold 15). Drivers by points: if/else 34 (84 pts), loops 7 (9 pts), boolean chains 6 (nesting depth added 52). Of this number, 90 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.NewDaemon (cognitive 92) daemon/daemon.go:752— daemon.NewDaemon has cognitive complexity 92 (threshold 15). Drivers by points: if/else 65 (87 pts), boolean chains 4, loops 1 (nesting depth added 22). Of this number, 81 points are the body's own statements and 11 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
containerRouter.postContainersCreate (cognitive 87) api/server/router/container/container_routes.go:480— containerRouter.postContainersCreate has cognitive complexity 87 (threshold 15). Drivers by points: if/else 38 (68 pts), loops 5 (11 pts), boolean chains 8 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.verifyPlatformContainerResources (cognitive 83) REDACTED:404— daemon.verifyPlatformContainerResources has cognitive complexity 83 (threshold 15). Drivers by points: if/else 42 (48 pts), boolean chains 35 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
seccomp.setupSeccomp (cognitive 82) profiles/seccomp/seccomp_linux.go:77— seccomp.setupSeccomp has cognitive complexity 82 (threshold 15). Drivers by points: if/else 24 (63 pts), loops 4 (11 pts), jumps 6, boolean chains 2 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.includeContainerInList (cognitive 77) daemon/list.go:388— daemon.includeContainerInList has cognitive complexity 77 (threshold 15). Drivers by points: if/else 37 (62 pts), loops 5 (10 pts), boolean chains 5 (nesting depth added 30). Of this number, 61 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Copier.copySrc (cognitive 75) daemon/logger/copier.go:53— Copier.copySrc has cognitive complexity 75 (threshold 15). Drivers by points: if/else 18 (62 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.initNetworkController (cognitive 74) REDACTED:838— Daemon.initNetworkController has cognitive complexity 74 (threshold 15). Drivers by points: if/else 23 (55 pts), loops 7 (14 pts), boolean chains 5 (nesting depth added 39). Of this number, 72 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.resolveAllReferences (cognitive 73) daemon/containerd/image.go:425— ImageService.resolveAllReferences has cognitive complexity 73 (threshold 15). Drivers by points: if/else 30 (65 pts), loops 2 (5 pts), boolean chains 3 (nesting depth added 38). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cache.compare (cognitive 70) image/cache/compare.go:45— cache.compare has cognitive complexity 70 (threshold 15). Drivers by points: if/else 40 (57 pts), loops 9 (10 pts), boolean chains 3 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tarexporter.Load (cognitive 70) image/tarexport/load.go:33— tarexporter.Load has cognitive complexity 70 (threshold 15). Drivers by points: if/else 30 (64 pts), loops 4 (6 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tarballer.Do (cognitive 68) REDACTED:911— Tarballer.Do has cognitive complexity 68 (threshold 15). Drivers by points: if/else 26 (58 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 36). Most of this is not in the body itself: 6 of the 68 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 974, 919). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.createSpec (cognitive 65) daemon/oci_linux.go:1060— Daemon.createSpec has cognitive complexity 65 (threshold 15). Drivers by points: if/else 36 (58 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.NewNetwork (cognitive 65) libnetwork/controller.go:471— Controller.NewNetwork has cognitive complexity 65 (threshold 15). Drivers by points: if/else 42 (57 pts), boolean chains 7, jumps 1 (nesting depth added 15). Of this number, 46 points are the body's own statements and 19 belong to 6 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.createWindows (cognitive 65) libcontainerd/local/local_windows.go:180— client.createWindows has cognitive complexity 65 (threshold 15). Drivers by points: if/else 30 (54 pts), loops 5 (9 pts), boolean chains 2 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.merge (cognitive 64) daemon/commit.go:24— daemon.merge has cognitive complexity 64 (threshold 15). Drivers by points: if/else 28 (54 pts), loops 5 (10 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ImageDelete (cognitive 64) daemon/containerd/image_delete.go:58— ImageService.ImageDelete has cognitive complexity 64 (threshold 15). Drivers by points: if/else 23 (52 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ImagesPrune (cognitive 63) daemon/images/image_prune.go:36— ImageService.ImagesPrune has cognitive complexity 63 (threshold 15). Drivers by points: if/else 19 (43 pts), loops 5 (11 pts), boolean chains 4, match/switch 2 (4 pts), jumps 1 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
archive.createTarFile (cognitive 63) REDACTED:678— archive.createTarFile has cognitive complexity 63 (threshold 15). Drivers by points: if/else 29 (54 pts), boolean chains 7, loops 1, match/switch 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.Join (cognitive 62) libnetwork/drivers/ipvlan/ipvlan_joinleave.go:29— driver.Join has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (60 pts), match/switch 1 (2 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder.Build (cognitive 61) builder/builder-next/builder.go:229— Builder.Build has cognitive complexity 61 (threshold 15). Drivers by points: if/else 37 (52 pts), boolean chains 5, loops 3, match/switch 1 (nesting depth added 15). Of this number, 52 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ImageDelete (cognitive 61) daemon/images/image_delete.go:63— ImageService.ImageDelete has cognitive complexity 61 (threshold 15). Drivers by points: if/else 19 (48 pts), loops 3 (10 pts), boolean chains 3 (nesting depth added 36). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Endpoint.sbJoin (cognitive 61) REDACTED:428— Endpoint.sbJoin has cognitive complexity 61 (threshold 15). Drivers by points: if/else 35 (57 pts), boolean chains 4 (nesting depth added 22). Of this number, 46 points are the body's own statements and 15 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IPTable.ProgramChain (cognitive 61) libnetwork/iptables/iptables.go:212— IPTable.ProgramChain has cognitive complexity 61 (threshold 15). Drivers by points: if/else 27 (51 pts), boolean chains 9, match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Manager.reload (cognitive 60) plugin/manager.go:171— Manager.reload has cognitive complexity 60 (threshold 15). Drivers by points: if/else 16 (53 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 38). Of this number, 16 points are the body's own statements and 44 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
puller.Snapshot (cognitive 59) builder/builder-next/adapters/containerimage/pull.go:382— puller.Snapshot has cognitive complexity 59 (threshold 15). Drivers by points: if/else 31 (52 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 22). Of this number, 42 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Namespace.Restore (cognitive 59) libnetwork/osl/namespace_linux.go:483— Namespace.Restore has cognitive complexity 59 (threshold 15). Drivers by points: if/else 15 (48 pts), loops 3 (9 pts), boolean chains 2 (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
archive.Unpack (cognitive 59) REDACTED:1088— archive.Unpack has cognitive complexity 59 (threshold 15). Drivers by points: if/else 21 (50 pts), boolean chains 4, loops 3 (4 pts), jumps 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tarexporter.parseNames (cognitive 58) image/tarexport/save.go:58— tarexporter.parseNames has cognitive complexity 58 (threshold 15). Drivers by points: if/else 21 (52 pts), loops 3 (6 pts) (nesting depth added 34). Of this number, 44 points are the body's own statements and 14 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pushDescriptor.Upload (cognitive 57) distribution/push_v2.go:299— pushDescriptor.Upload has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (42 pts), match/switch 2 (6 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.buildSandboxOptions (cognitive 55) daemon/container_operations.go:45— Daemon.buildSandboxOptions has cognitive complexity 55 (threshold 15). Drivers by points: if/else 24 (40 pts), loops 8 (12 pts), boolean chains 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.DeltaCreate (cognitive 55) daemon/images/image_delta.go:30— ImageService.DeltaCreate has cognitive complexity 55 (threshold 15). Drivers by points: if/else 29 (53 pts), loops 2 (nesting depth added 24). Of this number, 37 points are the body's own statements and 18 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ssd.check_network (cognitive 55) REDACTED:63— ssd.check_network has cognitive complexity 55 (threshold 15). Drivers by points: if/else 13 (32 pts), loops 10 (23 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.Images (cognitive 54) daemon/containerd/image_list.go:63— ImageService.Images has cognitive complexity 54 (threshold 15). Drivers by points: if/else 23 (42 pts), loops 5 (9 pts), boolean chains 3 (nesting depth added 23). Of this number, 38 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateNetwork (cognitive 52) libnetwork/drivers/windows/windows.go:268— driver.CreateNetwork has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (45 pts), loops 3 (7 pts) (nesting depth added 28). Of this number, 50 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Info.ExtraAttributes (cognitive 51) daemon/logger/loginfo.go:30— Info.ExtraAttributes has cognitive complexity 51 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 5 (9 pts), boolean chains 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tarSum.Read (cognitive 51) pkg/tarsum/tarsum.go:191— tarSum.Read has cognitive complexity 51 (threshold 15). Drivers by points: if/else 19 (49 pts), match/switch 1 (2 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Plugin.Set (cognitive 51) plugin/v2/plugin.go:113— Plugin.Set has cognitive complexity 51 (threshold 15). Drivers by points: if/else 16 (40 pts), loops 4 (7 pts), jumps 4 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
copy.DirCopy (cognitive 50) daemon/graphdriver/copy/copy.go:124— copy.DirCopy has cognitive complexity 50 (threshold 15). Drivers by points: if/else 29 (47 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 18). Most of this is not in the body itself: 4 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 132). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
dockerd.loadListeners (cognitive 49) cmd/dockerd/daemon.go:810— dockerd.loadListeners has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (45 pts), boolean chains 3, loops 1 (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Daemon.ProcessEvent (cognitive 49) daemon/monitor.go:158— Daemon.ProcessEvent has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (48 pts), match/switch 1 (nesting depth added 30). Of this number, 45 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.UnmarshalJSON (cognitive 49) libnetwork/network.go:578— Network.UnmarshalJSON has cognitive complexity 49 (threshold 15). Drivers by points: if/else 33 (44 pts), loops 2 (5 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRouter.postImagesCreate (cognitive 48) api/server/router/image/image_routes.go:35— imageRouter.postImagesCreate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 23 (46 pts), loops 1 (2 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
DaemonCli.start (cognitive 48) cmd/dockerd/daemon.go:96— DaemonCli.start has cognitive complexity 48 (threshold 15). Drivers by points: if/else 34 (41 pts), match/switch 2 (4 pts), boolean chains 2, loops 1 (nesting depth added 9). Of this number, 37 points are the body's own statements and 11 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Daemon.ContainerRename (cognitive 48) daemon/rename.go:20— Daemon.ContainerRename has cognitive complexity 48 (threshold 15). Drivers by points: if/else 22 (39 pts), loops 5 (7 pts), boolean chains 2 (nesting depth added 19). Of this number, 30 points are the body's own statements and 18 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.handleEpTableEvent (cognitive 48) libnetwork/agent.go:902— Controller.handleEpTableEvent has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (46 pts), boolean chains 2 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Controller.reservePools (cognitive 47) libnetwork/controller.go:739— Controller.reservePools has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 9, loops 4 (8 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
walker.walk (cognitive 47) REDACTED:89— walker.walk has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 7, loops 4, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
puller.pullTag (cognitive 46) distribution/pull_v2.go:284— puller.pullTag has cognitive complexity 46 (threshold 15). Drivers by points: if/else 24 (44 pts), boolean chains 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
remote.monitorDaemon (cognitive 46) libcontainerd/supervisor/remote_daemon.go:238— remote.monitorDaemon has cognitive complexity 46 (threshold 15). Drivers by points: if/else 13 (34 pts), match/switch 3 (10 pts), boolean chains 1, loops 1 (nesting depth added 28). Of this number, 45 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
PortMapper.MapRange (cognitive 46) libnetwork/portmapper/mapper.go:55— PortMapper.MapRange has cognitive complexity 46 (threshold 15). Drivers by points: if/else 22 (45 pts), match/switch 1 (nesting depth added 23). Of this number, 40 points are the body's own statements and 6 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.StartWithLogFile (cognitive 46) testutil/daemon/daemon.go:434— Daemon.StartWithLogFile has cognitive complexity 46 (threshold 15). Drivers by points: if/else 23 (35 pts), match/switch 2 (6 pts), boolean chains 3, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.pruneUnused (cognitive 45) daemon/containerd/image_prune.go:65— ImageService.pruneUnused has cognitive complexity 45 (threshold 15). Drivers by points: if/else 15 (35 pts), loops 5 (6 pts), boolean chains 4 (nesting depth added 21). Of this number, 42 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ExportImage (cognitive 44) daemon/containerd/image_exporter.go:50— ImageService.ExportImage has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (35 pts), loops 3 (4 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 19). Of this number, 28 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.sandboxCleanup (cognitive 44) libnetwork/sandbox_store.go:171— Controller.sandboxCleanup has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (37 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.verifyPlatformContainerResources (cognitive 43) daemon/daemon_windows.go:74— daemon.verifyPlatformContainerResources has cognitive complexity 43 (threshold 15). Drivers by points: if/else 29 (36 pts), boolean chains 7 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
network.FilterNetworks (cognitive 43) daemon/network/filter.go:13— network.FilterNetworks has cognitive complexity 43 (threshold 15). Drivers by points: if/else 18 (39 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 22). Of this number, 41 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveSession.save (cognitive 43) image/tarexport/save.go:182— saveSession.save has cognitive complexity 43 (threshold 15). Drivers by points: if/else 22 (35 pts), loops 5 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateEndpoint (cognitive 43) libnetwork/drivers/bridge/bridge_linux.go:918— driver.CreateEndpoint has cognitive complexity 43 (threshold 15). Drivers by points: if/else 31 (40 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). Of this number, 36 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Driver.Remove (cognitive 43) REDACTED:265— Driver.Remove has cognitive complexity 43 (threshold 15). Drivers by points: if/else 16 (37 pts), boolean chains 4, loops 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.getSameReferences (cognitive 42) daemon/containerd/image_delete.go:276— ImageService.getSameReferences has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (41 pts), loops 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Daemon.openContainerFS (cognitive 42) daemon/containerfs_linux.go:56— Daemon.openContainerFS has cognitive complexity 42 (threshold 15). Drivers by points: if/else 20 (38 pts), boolean chains 2, loops 2 (nesting depth added 18). Most of this is not in the body itself: 3 of the 42 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 82, 147, 60, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
splunk.New (cognitive 42) REDACTED:153— splunk.New has cognitive complexity 42 (threshold 15). Drivers by points: if/else 25 (35 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cnmNetworkAllocator.IsServiceAllocated (cognitive 42) libnetwork/cnmallocator/networkallocator.go:351— cnmNetworkAllocator.IsServiceAllocated has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 4 (10 pts), boolean chains 5, jumps 3 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tarAppender.addTarFile (cognitive 42) REDACTED:563— tarAppender.addTarFile has cognitive complexity 42 (threshold 15). Drivers by points: if/else 23 (37 pts), boolean chains 5 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
specconv.toRootless (cognitive 42) pkg/rootless/specconv/specconv_linux.go:56— specconv.toRootless has cognitive complexity 42 (threshold 15). Drivers by points: if/else 18 (37 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
windowsParser.validateMountConfigReg (cognitive 42) volume/mounts/windows_parser.go:215— windowsParser.validateMountConfigReg has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VolumeStore.filter (cognitive 42) volume/service/store.go:250— VolumeStore.filter has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (34 pts), loops 2 (4 pts), match/switch 2 (4 pts) (nesting depth added 26). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
View.transform (cognitive 41) container/view.go:301— View.transform has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 6 (13 pts), boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.containerAttach (cognitive 41) REDACTED:110— Daemon.containerAttach has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (30 pts), boolean chains 4, match/switch 1 (3 pts), jumps 2, loops 1 (2 pts) (nesting depth added 18). Of this number, 38 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
puller.pullSchema2Layers (cognitive 41) distribution/pull_v2.go:547— puller.pullSchema2Layers has cognitive complexity 41 (threshold 15). Drivers by points: if/else 24 (35 pts), loops 3 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 12). Of this number, 39 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.link (cognitive 41) libnetwork/drivers/bridge/bridge_linux.go:1456— driver.link has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 19). Of this number, 39 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.ipamAllocateVersion (cognitive 41) libnetwork/network.go:1565— Network.ipamAllocateVersion has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 2 (4 pts), boolean chains 2, match/switch 1 (nesting depth added 23). Of this number, 36 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LocalRegistry.Scan (cognitive 41) pkg/plugins/discovery.go:37— LocalRegistry.Scan has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 4 (8 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
linuxParser.validateMountConfigImpl (cognitive 41) volume/mounts/linux_parser.go:48— linuxParser.validateMountConfigImpl has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 4, match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateNetwork (cognitive 41) libnetwork/drivers/windows/overlay/ov_network_windows.go:64— driver.CreateNetwork has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (27 pts), loops 6 (11 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
build.newImageBuildOptions (cognitive 40) api/server/router/build/build_routes.go:38— build.newImageBuildOptions has cognitive complexity 40 (threshold 15). Drivers by points: if/else 25 (36 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.resolveImage (cognitive 40) daemon/containerd/image.go:276— ImageService.resolveImage has cognitive complexity 40 (threshold 15). Drivers by points: if/else 16 (34 pts), loops 2 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayerDownloadManager.makeDownloadFunc (cognitive 39) distribution/xfer/download.go:238— LayerDownloadManager.makeDownloadFunc has cognitive complexity 39 (threshold 15). Drivers by points: if/else 14 (22 pts), match/switch 6 (12 pts), loops 2 (3 pts), boolean chains 1, jumps 1 (nesting depth added 15). None of this is in the body itself: all 39 points belong to one function literal inside it that branches (line 239). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
containerimage.showProgress (cognitive 38) builder/builder-next/adapters/containerimage/pull.go:675— containerimage.showProgress has cognitive complexity 38 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (6 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.createDiff (cognitive 38) daemon/containerd/image_commit.go:153— ImageService.createDiff has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (38 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.ContainerLogs (cognitive 38) daemon/logs.go:26— Daemon.ContainerLogs has cognitive complexity 38 (threshold 15). Drivers by points: if/else 17 (25 pts), match/switch 3 (8 pts), boolean chains 4, loops 1 (nesting depth added 13). Of this number, 18 points are the body's own statements and 20 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cnmNetworkAllocator.AllocateService (cognitive 38) libnetwork/cnmallocator/networkallocator.go:191— cnmNetworkAllocator.AllocateService has cognitive complexity 38 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 5 (8 pts), jumps 3, boolean chains 2 (nesting depth added 16). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.buildCreateEndpointOptions (cognitive 37) daemon/network.go:612— daemon.buildCreateEndpointOptions has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.handleKeyChange (cognitive 37) libnetwork/agent.go:114— Controller.handleKeyChange has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 4 (6 pts) (nesting depth added 17). Of this number, 33 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Endpoint.UnmarshalJSON (cognitive 37) REDACTED:84— Endpoint.UnmarshalJSON has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (31 pts), loops 2 (6 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
archive.changes (cognitive 37) pkg/archive/changes.go:116— archive.changes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 14). Most of this is not in the body itself: 2 of the 37 points are its own statements and the rest belongs to one function literal inside it that branches (line 122). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.setupFilters (cognitive 36) daemon/containerd/image_list.go:320— ImageService.setupFilters has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 10). Most of this is not in the body itself: 9 of the 36 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 322, 342, 402, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.ContainerStats (cognitive 36) daemon/stats.go:22— Daemon.ContainerStats has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5, loops 2 (5 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mobyexporter.normalizeLayersAndHistory (cognitive 35) builder/builder-next/exporter/mobyexporter/writer.go:95— mobyexporter.normalizeLayersAndHistory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 6 (8 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.doRequest (cognitive 35) client/request.go:138— Client.doRequest has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 4 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
daemon.handleProbeResult (cognitive 35) daemon/health.go:181— daemon.handleProbeResult has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 2, match/switch 1 (nesting depth added 16). Of this number, 25 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.connectToNetwork (cognitive 35) daemon/container_operations.go:642— Daemon.connectToNetwork has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 3 (nesting depth added 8). Of this number, 32 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.containerStart (cognitive 35) daemon/start.go:110— Daemon.containerStart has cognitive complexity 35 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 3 (nesting depth added 8). Of this number, 19 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.manifestMatchesPlatform (cognitive 35) daemon/images/image.go:54— ImageService.manifestMatchesPlatform has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (29 pts), loops 2 (3 pts), match/switch 1 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.Join (cognitive 35) libnetwork/drivers/macvlan/macvlan_joinleave.go:17— driver.Join has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (35 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Endpoint.sbLeave (cognitive 35) REDACTED:661— Endpoint.sbLeave has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.delete (cognitive 35) libnetwork/network.go:953— Network.delete has cognitive complexity 35 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 2, jumps 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
stdcopy.StdCopy (cognitive 35) pkg/stdcopy/stdcopy.go:94— stdcopy.StdCopy has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (28 pts), loops 3 (5 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
randomAccessTarStream.ReadAt (cognitive 35) pkg/tarsplitutils/tarstream.go:24— randomAccessTarStream.ReadAt has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (32 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.parseRemappedRoot (cognitive 34) REDACTED:1096— daemon.parseRemappedRoot has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.ContainerExecStart (cognitive 34) daemon/exec.go:151— Daemon.ContainerExecStart has cognitive complexity 34 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 2, match/switch 1 (nesting depth added 8). Of this number, 31 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loggerutils.volumeName (cognitive 34) REDACTED:191— loggerutils.volumeName has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (7 pts), boolean chains 6 (nesting depth added 19). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
LayerDownloadManager.Download (cognitive 34) distribution/xfer/download.go:119— LayerDownloadManager.Download has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (31 pts), loops 2, match/switch 1 (nesting depth added 18). Of this number, 31 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
localCache.GetCache (cognitive 33) daemon/containerd/cache.go:57— localCache.GetCache has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (30 pts), boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonmessage.DisplayJSONMessagesStream (cognitive 33) pkg/jsonmessage/jsonmessage.go:228— jsonmessage.DisplayJSONMessagesStream has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (29 pts), boolean chains 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.Parse (cognitive 33) pkg/plugins/pluginrpc-gen/parser.go:65— main.Parse has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 4 (7 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageExporterInstance.Export (cognitive 32) builder/builder-next/exporter/mobyexporter/export.go:88— imageExporterInstance.Export has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (25 pts), loops 3 (5 pts), boolean chains 1, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Config.CopyStreams (cognitive 32) container/stream/attach.go:60— Config.CopyStreams has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 1, match/switch 1 (nesting depth added 12). Most of this is not in the body itself: 3 of the 32 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 65, 134, 100). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.create (cognitive 32) REDACTED:146— Daemon.create has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24 (31 pts), boolean chains 1 (nesting depth added 7). Of this number, 29 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
initlayer.Setup (cognitive 32) daemon/initlayer/setup_unix.go:19— initlayer.Setup has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (25 pts), match/switch 1 (4 pts), loops 2 (3 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
logStream.collectBatch (cognitive 32) daemon/logger/awslogs/cloudwatchlogs.go:553— logStream.collectBatch has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fluentd.parseConfig (cognitive 32) daemon/logger/fluentd/fluentd.go:169— fluentd.parseConfig has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (28 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
distribution.pullEndpoints (cognitive 32) distribution/pull.go:76— distribution.pullEndpoints has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (26 pts), match/switch 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.validateConfiguration (cognitive 32) libnetwork/network.go:345— Network.validateConfiguration has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 1 (4 pts), boolean chains 3 (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Sandbox.setupDNS (cognitive 32) libnetwork/sandbox_dns_unix.go:205— Sandbox.setupDNS has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
containerd.setupLabelFilter (cognitive 31) daemon/containerd/image_list.go:433— containerd.setupLabelFilter has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (27 pts), loops 3 (4 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 467). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.GetImage (cognitive 31) daemon/containerd/image.go:34— ImageService.GetImage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Driver.Get (cognitive 31) daemon/graphdriver/overlay2/overlay.go:515— Driver.Get has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (29 pts), boolean chains 1, loops 1 (nesting depth added 9). Of this number, 21 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cache.getLocalCachedImage (cognitive 31) image/cache/cache.go:221— cache.getLocalCachedImage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 14). Most of this is not in the body itself: 13 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 239, 226). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Network.createEndpoint (cognitive 31) libnetwork/network.go:1137— Network.createEndpoint has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 3, loops 1 (nesting depth added 7). Of this number, 22 points are the body's own statements and 9 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.addLBBackend (cognitive 31) libnetwork/service_linux.go:82— Network.addLBBackend has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (25 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VolumeStore.getVolume (cognitive 31) volume/service/store.go:680— VolumeStore.getVolume has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateEndpoint (cognitive 31) libnetwork/drivers/windows/windows.go:601— driver.CreateEndpoint has cognitive complexity 31 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 3 (nesting depth added 4). Of this number, 29 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Daemon.allocateNetwork (cognitive 30) daemon/container_operations.go:438— Daemon.allocateNetwork has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (27 pts), loops 2, boolean chains 1 (nesting depth added 12). Of this number, 27 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.newStdioPipes (cognitive 30) libcontainerd/remote/client_io_windows.go:59— client.newStdioPipes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (30 pts) (nesting depth added 15). Most of this is not in the body itself: 9 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 78, 111, 144, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
networkConfiguration.fromLabels (cognitive 30) libnetwork/drivers/bridge/bridge_linux.go:275— networkConfiguration.fromLabels has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (27 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.NewDaemon (cognitive 30) testutil/daemon/daemon.go:104— daemon.NewDaemon has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17 (29 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Driver.create (cognitive 30) REDACTED:184— Driver.create has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (30 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
time.GetTimestamp (cognitive 29) api/types/time/timestamp.go:26— time.GetTimestamp has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (20 pts), match/switch 2 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.pullTag (cognitive 29) daemon/containerd/image_pull.go:65— ImageService.pullTag has cognitive complexity 29 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 4 (nesting depth added 8). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 116, 84, 96). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.cleanupContainer (cognitive 29) daemon/delete.go:90— Daemon.cleanupContainer has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.ContainerStart (cognitive 29) daemon/start.go:44— Daemon.ContainerStart has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogFile.openRotatedFiles (cognitive 29) REDACTED:478— LogFile.openRotatedFiles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 4 (6 pts) (nesting depth added 15). Most of this is not in the body itself: 11 of the 29 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 496, 485). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
tarexporter.legacyLoadImage (cognitive 29) image/tarexport/load.go:311— tarexporter.legacyLoadImage has cognitive complexity 29 (threshold 15). Drivers by points: if/else 20 (27 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin.splitConfigRootFSFromTar (cognitive 29) REDACTED:741— plugin.splitConfigRootFSFromTar has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (26 pts), boolean chains 2, loops 1 (nesting depth added 15). None of this is in the body itself: all 29 points belong to one function literal inside it that branches (line 743). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Service.Search (cognitive 29) registry/search.go:25— Service.Search has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (26 pts), loops 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
containerRouter.postContainerExecStart (cognitive 28) api/server/router/container/exec.go:69— containerRouter.postContainerExecStart has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
swarm.adjustForAPIVersion (cognitive 28) api/server/router/swarm/helpers.go:77— swarm.adjustForAPIVersion has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 1 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dockerd.loadDaemonCliConfig (cognitive 28) cmd/dockerd/daemon.go:510— dockerd.loadDaemonCliConfig has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
daemon.WithNamespaces (cognitive 28) daemon/oci_linux.go:251— daemon.WithNamespaces has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (24 pts), match/switch 3 (4 pts) (nesting depth added 10). None of this is in the body itself: all 28 points belong to one function literal inside it that branches (line 252). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.deleteAll (cognitive 28) daemon/containerd/image_delete.go:188— ImageService.deleteAll has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 12). Of this number, 22 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.unleaseSnapshotsFromDeletedConfigs (cognitive 28) daemon/containerd/image_prune.go:211— ImageService.unleaseSnapshotsFromDeletedConfigs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (23 pts), boolean chains 3, loops 2 (nesting depth added 13). Of this number, 26 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.filterByNameIDMatches (cognitive 28) daemon/list.go:158— Daemon.filterByNameIDMatches has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graphdriver.New (cognitive 28) daemon/graphdriver/driver.go:199— graphdriver.New has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 4 (7 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Driver.Get (cognitive 28) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:301— Driver.Get has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 1, loops 1 (nesting depth added 10). Of this number, 14 points are the body's own statements and 14 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pusher.pushTag (cognitive 28) distribution/push_v2.go:127— pusher.pushTag has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (26 pts), loops 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.Join (cognitive 28) libnetwork/drivers/overlay/joinleave.go:22— driver.Join has cognitive complexity 28 (threshold 15). Drivers by points: if/else 22 (26 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
driver.CreateNetwork (cognitive 28) libnetwork/drivers/overlay/ov_network.go:94— driver.CreateNetwork has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19 (24 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NetworkDB.Watch (cognitive 28) libnetwork/networkdb/watch.go:57— NetworkDB.Watch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 5 (nesting depth added 10). Most of this is not in the body itself: 10 of the 28 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 61, 95, 116). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Namespace.AddInterface (cognitive 28) libnetwork/osl/interface_linux.go:165— Namespace.AddInterface has cognitive complexity 28 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver.serveDNS (cognitive 28) REDACTED:354— Resolver.serveDNS has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 3, match/switch 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parsers.parseUintList (cognitive 28) pkg/parsers/parsers.go:59— parsers.parseUintList has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
registry.ReadCertsDirectory (cognitive 28) REDACTED:54— registry.ReadCertsDirectory has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reader.drainJournal (cognitive 28) daemon/logger/journald/read.go:251— reader.drainJournal has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 4, match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
systemRouter.getDiskUsage (cognitive 27) api/server/router/system/system_routes.go:107— systemRouter.getDiskUsage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (14 pts), loops 4 (8 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 8). Of this number, 23 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Container.StartLogger (cognitive 27) container/container.go:397— Container.StartLogger has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (26 pts), match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.WithDevices (cognitive 27) daemon/oci_linux.go:899— daemon.WithDevices has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (5 pts) (nesting depth added 13). None of this is in the body itself: all 27 points belong to one function literal inside it that branches (line 900). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
config.getConflictFreeConfiguration (cognitive 27) REDACTED:437— config.getConflictFreeConfiguration has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). Of this number, 19 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.GetImageAndReleasableLayer (cognitive 27) daemon/containerd/image_builder.go:69— ImageService.GetImageAndReleasableLayer has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.createNetwork (cognitive 27) daemon/network.go:149— Daemon.createNetwork has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (22 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Daemon.setWindowsCredentialSpec (cognitive 27) REDACTED:342— Daemon.setWindowsCredentialSpec has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
puller.pullManifestList (cognitive 27) distribution/pull_v2.go:749— puller.pullManifestList has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (24 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pushDescriptor.layerAlreadyExists (cognitive 27) distribution/push_v2.go:531— pushDescriptor.layerAlreadyExists has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3, boolean chains 2, match/switch 1 (2 pts), jumps 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.Services (cognitive 27) libnetwork/agent.go:469— Network.Services has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 5 (10 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MountPoint.Setup (cognitive 27) volume/mounts/mounts.go:112— MountPoint.Setup has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (26 pts), boolean chains 1 (nesting depth added 11). Of this number, 22 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
container.handleMACAddressBC (cognitive 26) api/server/router/container/container_routes.go:675— container.handleMACAddressBC has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.buildIPAMResources (cognitive 26) daemon/network.go:522— daemon.buildIPAMResources has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.generateSecurityOpt (cognitive 26) REDACTED:277— Daemon.generateSecurityOpt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.killWithSignal (cognitive 26) daemon/kill.go:64— Daemon.killWithSignal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 1 (nesting depth added 10). Of this number, 19 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Driver.Create (cognitive 26) REDACTED:487— Driver.Create has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonlog.ffjsonWriteJSONBytesAsString (cognitive 26) daemon/logger/jsonfilelog/jsonlog/jsonlogbytes.go:64— jsonlog.ffjsonWriteJSONBytesAsString has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bridgeNetwork.allocatePortsInternal (cognitive 26) libnetwork/drivers/bridge/port_mapping_linux.go:38— bridgeNetwork.allocatePortsInternal has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (22 pts), boolean chains 3, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.rebuildDNS (cognitive 26) libnetwork/sandbox_dns_unix.go:364— Sandbox.rebuildDNS has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), loops 2 (4 pts), jumps 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.callWithRetry (cognitive 26) pkg/plugins/client.go:171— Client.callWithRetry has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.setResourcesInSpec (cognitive 25) REDACTED:412— daemon.setResourcesInSpec has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.GetImageManifest (cognitive 25) daemon/containerd/image.go:175— ImageService.GetImageManifest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (25 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ImageHistory (cognitive 25) daemon/containerd/image_history.go:18— ImageService.ImageHistory has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (5 pts), boolean chains 1 (nesting depth added 10). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.handleContainerExit (cognitive 25) daemon/monitor.go:31— Daemon.handleContainerExit has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 1 (nesting depth added 9). Of this number, 15 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graphtest.changeManyFiles (cognitive 25) REDACTED:145— graphtest.changeManyFiles has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
distribution.Push (cognitive 25) distribution/push.go:20— distribution.Push has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageCache.GetCache (cognitive 25) image/cache/cache.go:57— ImageCache.GetCache has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveSession.saveImage (cognitive 25) image/tarexport/save.go:383— saveSession.saveImage has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fileMetadataStore.getOrphan (cognitive 25) layer/filestore.go:341— fileMetadataStore.getOrphan has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (21 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.processEventStream (cognitive 25) libcontainerd/remote/client.go:604— client.processEventStream has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (18 pts), match/switch 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cnmNetworkAllocator.allocateNetworkIPs (cognitive 25) libnetwork/cnmallocator/networkallocator.go:644— cnmNetworkAllocator.allocateNetworkIPs has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cnmNetworkAllocator.allocatePools (cognitive 25) libnetwork/cnmallocator/networkallocator.go:848— cnmNetworkAllocator.allocatePools has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.ipamReleaseVersion (cognitive 25) libnetwork/network.go:1666— Network.ipamReleaseVersion has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.delete (cognitive 25) libnetwork/sandbox.go:137— Sandbox.delete has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.StopWithError (cognitive 25) testutil/daemon/daemon.go:679— Daemon.StopWithError has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), match/switch 2 (4 pts), jumps 2, loops 2, boolean chains 1 (nesting depth added 8). Of this number, 20 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildkit.getGCPolicy (cognitive 24) builder/builder-next/controller.go:395— buildkit.getGCPolicy has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.imageBuildOptionsToQuery (cognitive 24) client/image_build.go:46— Client.imageBuildOptionsToQuery has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21 (24 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Container.NetworkMounts (cognitive 24) container/container_unix.go:68— Container.NetworkMounts has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (24 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.cleanupMountsFromReaderByID (cognitive 24) REDACTED:44— Daemon.cleanupMountsFromReaderByID has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (5 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Daemon.ContainersPrune (cognitive 24) daemon/prune.go:40— Daemon.ContainersPrune has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
btrfs.subvolDelete (cognitive 24) REDACTED:262— btrfs.subvolDelete has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2, loops 1 (nesting depth added 8). Most of this is not in the body itself: 11 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 273). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
gelf.ValidateLogOpt (cognitive 24) daemon/logger/gelf/gelf.go:200— gelf.ValidateLogOpt has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsonfilelog.New (cognitive 24) daemon/logger/jsonfilelog/jsonfilelog.go:48— jsonfilelog.New has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
follow.Do (cognitive 24) daemon/logger/loggerutils/follow.go:25— follow.Do has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 1, loops 1 (nesting depth added 13). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
unshare.Go (cognitive 24) internal/unshare/unshare_linux.go:100— unshare.Go has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 2 (3 pts) (nesting depth added 12). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to one function literal inside it that branches (line 109). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
main.fetchTable (cognitive 24) libnetwork/cmd/diagnostic/main.go:145— main.fetchTable has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.cleanupLocalEndpoints (cognitive 24) REDACTED:1133— Controller.cleanupLocalEndpoints has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (6 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.Join (cognitive 24) libnetwork/drivers/remote/driver.go:252— driver.Join has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
archive.ReplaceFileTarWrapper (cognitive 24) REDACTED:320— archive.ReplaceFileTarWrapper has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2, match/switch 1 (nesting depth added 10). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 323). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
plugin.withFetchProgress (cognitive 24) plugin/fetch_linux.go:198— plugin.withFetchProgress has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (20 pts), match/switch 2 (3 pts), loops 1 (nesting depth added 11). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 199). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
VolumeStore.restore (cognitive 24) volume/service/restore.go:18— VolumeStore.restore has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2, boolean chains 1 (nesting depth added 13). Most of this is not in the body itself: 1 of the 24 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 31, 77). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
VolumeStore.list (cognitive 24) volume/service/store.go:404— VolumeStore.list has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 6 (10 pts) (nesting depth added 10). Of this number, 20 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRouter.getImagesJSON (cognitive 23) api/server/router/image/image_routes.go:379— imageRouter.getImagesJSON has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
config.findConfigurationConflicts (cognitive 23) REDACTED:551— config.findConfigurationConflicts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 7). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 590, 563, 580). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
pushProgress.UpdateProgress (cognitive 23) daemon/containerd/progress.go:180— pushProgress.UpdateProgress has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.LoadImage (cognitive 23) daemon/containerd/image_exporter.go:235— ImageService.LoadImage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 1, loops 1 (nesting depth added 9). Most of this is not in the body itself: 8 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 279, 251). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Daemon.initializeNetworkingPaths (cognitive 23) daemon/container_operations_unix.go:292— Daemon.initializeNetworkingPaths has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
awslogs.ValidateLogOpt (cognitive 23) daemon/logger/awslogs/cloudwatchlogs.go:741— awslogs.ValidateLogOpt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
splunkLogger.postMessages (cognitive 23) REDACTED:436— splunkLogger.postMessages has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
tarexporter.legacyLoad (cognitive 23) image/tarexport/load.go:253— tarexporter.legacyLoad has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fileMetadataStore.List (cognitive 23) layer/filestore.go:390— fileMetadataStore.List has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.configure (cognitive 23) libnetwork/drivers/bridge/bridge_linux.go:395— driver.configure has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 1, match/switch 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.deleteNetwork (cognitive 23) libnetwork/drivers/bridge/bridge_linux.go:827— driver.deleteNetwork has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2, match/switch 1 (nesting depth added 10). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ContainerConfigWrapper.getHostConfig (cognitive 23) runconfig/config_unix.go:22— ContainerConfigWrapper.getHostConfig has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 8 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
windowsParser.splitRawSpec (cognitive 23) volume/mounts/windows_parser.go:90— windowsParser.splitRawSpec has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
distributionRouter.fetchManifest (cognitive 22) api/server/router/distribution/distribution_routes.go:77— distributionRouter.fetchManifest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
systemRouter.getEvents (cognitive 22) api/server/router/system/system_routes.go:215— systemRouter.getEvents has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
snapshotter.getLayer (cognitive 22) builder/builder-next/adapters/snapshot/snapshot.go:161— snapshotter.getLayer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (22 pts) (nesting depth added 13). Of this number, 16 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.ContainerCreate (cognitive 22) client/container_create.go:23— Client.ContainerCreate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
daemon.validateEndpointSettings (cognitive 22) daemon/container_operations.go:523— daemon.validateEndpointSettings has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.containerExtractToDir (cognitive 22) daemon/archive_unix.go:100— Daemon.containerExtractToDir has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Daemon.fillRootlessVersion (cognitive 22) daemon/info_unix.go:230— Daemon.fillRootlessVersion has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (21 pts), match/switch 1 (nesting depth added 9). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 266, 294). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
Driver.create (cognitive 22) daemon/graphdriver/overlay2/overlay.go:347— Driver.create has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ImageService.GetImageAndReleasableLayer (cognitive 22) daemon/images/image_builder.go:202— ImageService.GetImageAndReleasableLayer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.ImageHistory (cognitive 22) daemon/images/image_history.go:15— ImageService.ImageHistory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogFile.rotate (cognitive 22) REDACTED:198— LogFile.rotate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 4 (nesting depth added 6). Most of this is not in the body itself: 6 of the 22 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 217, 201, 255). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
splunkLogger.tryPostMessages (cognitive 22) REDACTED:474— splunkLogger.tryPostMessages has cognitive complexity 22 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
container.createIO (cognitive 22) libcontainerd/remote/client.go:491— container.createIO has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (20 pts), match/switch 1 (2 pts) (nesting depth added 12). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 507). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
driver.updateKeys (cognitive 22) libnetwork/drivers/overlay/encryption.go:466— driver.updateKeys has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.DeleteNetwork (cognitive 22) libnetwork/drivers/overlay/ov_network.go:208— driver.DeleteNetwork has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkDB.rejoinClusterBootStrap (cognitive 22) libnetwork/networkdb/cluster.go:277— NetworkDB.rejoinClusterBootStrap has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkDB.bulkSyncTables (cognitive 22) libnetwork/networkdb/cluster.go:518— NetworkDB.bulkSyncTables has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (7 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Control.findNextProjectID (cognitive 22) REDACTED:324— Control.findNextProjectID has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). Of this number, 19 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
serviceConfig.loadInsecureRegistries (cognitive 22) registry/config.go:184— serviceConfig.loadInsecureRegistries has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (4 pts), boolean chains 1, jumps 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateEndpoint (cognitive 22) libnetwork/drivers/windows/overlay/ov_endpoint_windows.go:96— driver.CreateEndpoint has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19 (22 pts) (nesting depth added 3). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
network.ValidateIPAM (cognitive 21) api/types/network/ipam.go:35— network.ValidateIPAM has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
buildkit.newGraphDriverController (cognitive 21) builder/builder-next/controller.go:194— buildkit.newGraphDriverController has cognitive complexity 21 (threshold 15). Drivers by points: if/else 20, loops 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Builder.dispatchDockerfileWithCancellation (cognitive 21) builder/dockerfile/builder.go:250— Builder.dispatchDockerfileWithCancellation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (5 pts), match/switch 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.buildPortsRelatedCreateEndpointOptions (cognitive 21) daemon/network.go:706— daemon.buildPortsRelatedCreateEndpointOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 5 (9 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.withCommonOptions (cognitive 21) daemon/oci_linux.go:755— daemon.withCommonOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5 (nesting depth added 5). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 756). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
config.Validate (cognitive 21) REDACTED:637— config.Validate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), match/switch 2 (4 pts), loops 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ImageService.singlePlatformImage (cognitive 21) daemon/containerd/image_list.go:214— ImageService.singlePlatformImage has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.updateContainerNetworkSettings (cognitive 21) daemon/container_operations.go:362— Daemon.updateContainerNetworkSettings has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Daemon.Shutdown (cognitive 21) daemon/daemon.go:1301— Daemon.Shutdown has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 2 (nesting depth added 6). Of this number, 15 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local.getTailReader (cognitive 21) daemon/logger/local/read.go:25— local.getTailReader has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LogFile.readLogsLocked (cognitive 21) REDACTED:400— LogFile.readLogsLocked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (4 pts), match/switch 1 (3 pts) (nesting depth added 10). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
saveSession.saveConfigAndLayer (cognitive 21) image/tarexport/save.go:460— saveSession.saveConfigAndLayer has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (19 pts), loops 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Controller.NewSandbox (cognitive 21) libnetwork/controller.go:884— Controller.NewSandbox has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 1, loops 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bridge.setupIPForwarding (cognitive 21) libnetwork/drivers/bridge/setup_ip_forwarding.go:27— bridge.setupIPForwarding has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (21 pts) (nesting depth added 11). Of this number, 16 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
overlay.programSA (cognitive 21) libnetwork/drivers/overlay/encryption.go:278— overlay.programSA has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (21 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.NetworkAllocate (cognitive 21) libnetwork/drivers/overlay/ovmanager/ovmanager.go:63— driver.NetworkAllocate has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
windows.parseEndpointOptions (cognitive 21) libnetwork/drivers/windows/windows.go:525— windows.parseEndpointOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (21 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Endpoint.deleteServiceInfoFromCluster (cognitive 21) libnetwork/agent.go:684— Endpoint.deleteServiceInfoFromCluster has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkDB.gossip (cognitive 21) libnetwork/networkdb/cluster.go:445— NetworkDB.gossip has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkDB.handleTableEvent (cognitive 21) libnetwork/networkdb/delegate.go:141— NetworkDB.handleTableEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6, jumps 1, loops 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.clearNetworkResources (cognitive 21) libnetwork/sandbox.go:589— Sandbox.clearNetworkResources has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
archive.ChangesSize (cognitive 21) pkg/archive/changes.go:365— archive.ChangesSize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (18 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
BytesPipe.Write (cognitive 21) pkg/ioutils/bytespipe.go:52— BytesPipe.Write has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1, jumps 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
scanner.Scan (cognitive 21) pkg/tailfile/tailfile.go:166— scanner.Scan has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
local.getMountOptions (cognitive 21) volume/local/local_unix.go:121— local.getMountOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
client.extractResourcesFromSpec (cognitive 21) libcontainerd/local/local_windows.go:360— client.extractResourcesFromSpec has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (21 pts) (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
driver.parseNetworkOptions (cognitive 21) libnetwork/drivers/windows/windows.go:175— driver.parseNetworkOptions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reader.readLogs (cognitive 21) daemon/logger/journald/read.go:359— reader.readLogs has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
networkRouter.getNetwork (cognitive 20) api/server/router/network/network_routes.go:65— networkRouter.getNetwork has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), loops 3 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
snapshotter.Usage (cognitive 20) builder/builder-next/adapters/snapshot/snapshot.go:418— snapshotter.Usage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (20 pts) (nesting depth added 4). Of this number, 15 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
pullProgress.UpdateProgress (cognitive 20) daemon/containerd/progress.go:115— pullProgress.UpdateProgress has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.PushImage (cognitive 20) daemon/containerd/image_push.go:42— ImageService.PushImage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.containerCreate (cognitive 20) REDACTED:60— Daemon.containerCreate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Daemon.getInspectData (cognitive 20) daemon/inspect.go:149— Daemon.getInspectData has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
overlay2.doesSupportNativeDiff (cognitive 20) daemon/graphdriver/overlay2/check.go:27— overlay2.doesSupportNativeDiff has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19 (20 pts) (nesting depth added 1). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
manifestStore.Get (cognitive 20) distribution/manifest.go:169— manifestStore.Get has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mounttree.SwitchRoot (cognitive 20) internal/mounttree/switchroot_linux.go:19— mounttree.SwitchRoot has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 1 (nesting depth added 6). Of this number, 10 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerStore.registerWithDescriptor (cognitive 20) layer/layer_store.go:301— layerStore.registerWithDescriptor has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (20 pts) (nesting depth added 5). Of this number, 13 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.rmLBBackend (cognitive 20) libnetwork/service_linux.go:171— Network.rmLBBackend has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (20 pts) (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Sandbox.resolveName (cognitive 20) libnetwork/sandbox.go:494— Sandbox.resolveName has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VolumesService.volumesToAPI (cognitive 20) volume/service/convert.go:34— VolumesService.volumesToAPI has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reader.readJournal (cognitive 20) daemon/logger/journald/read.go:322— reader.readJournal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Backend.Build (cognitive 19) api/server/backend/build/backend.go:53— Backend.Build has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
plugin.getName (cognitive 19) api/server/router/plugin/plugin_routes.go:152— plugin.getName has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (19 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
snapshotter.EnsureLayer (cognitive 19) builder/builder-next/adapters/snapshot/layer.go:26— snapshotter.EnsureLayer has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (19 pts) (nesting depth added 4). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 72, 53). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
buildkit.toBuildkitPruneInfo (cognitive 19) builder/builder-next/builder.go:627— buildkit.toBuildkitPruneInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.main (cognitive 19) cmd/mobynit/main.go:59— main.main has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.idOrNameFilter (cognitive 19) daemon/list.go:342— daemon.idOrNameFilter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.getEndpointPortMapInfo (cognitive 19) daemon/network.go:794— daemon.getEndpointPortMapInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.PrepareSnapshot (cognitive 19) daemon/containerd/image_snapshot.go:21— ImageService.PrepareSnapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (19 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.DisconnectFromNetwork (cognitive 19) daemon/container_operations.go:1016— Daemon.DisconnectFromNetwork has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.setupIPCDirs (cognitive 19) daemon/container_operations_unix.go:101— Daemon.setupIPCDirs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (18 pts), match/switch 1 (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
graphtest.DriverTestDiffApply (cognitive 19) daemon/graphdriver/graphtest/graphtest_unix.go:170— graphtest.DriverTestDiffApply has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Sender.Send (cognitive 19) daemon/logger/journald/internal/fake/sender.go:116— Sender.Send has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
puller.pullRepository (cognitive 19) distribution/pull_v2.go:91— puller.pullRepository has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayerUploadManager.makeUploadFunc (cognitive 19) distribution/xfer/upload.go:115— LayerUploadManager.makeUploadFunc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (6 pts), loops 2 (3 pts), boolean chains 1, jumps 1 (nesting depth added 9). None of this is in the body itself: all 19 points belong to one function literal inside it that branches (line 116). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
container.NewTask (cognitive 19) libcontainerd/remote/client.go:149— container.NewTask has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (nesting depth added 7). Of this number, 12 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bridge.setupIPChains (cognitive 19) libnetwork/drivers/bridge/setup_ip_tables_linux.go:35— bridge.setupIPChains has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (19 pts) (nesting depth added 4). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 49, 61, 73, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
driver.CreateEndpoint (cognitive 19) libnetwork/drivers/macvlan/macvlan_endpoint.go:18— driver.CreateEndpoint has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (19 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
network.setupSubnetSandbox (cognitive 19) libnetwork/drivers/overlay/ov_network.go:425— network.setupSubnetSandbox has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.DiscoverNew (cognitive 19) libnetwork/drivers/overlay/overlay.go:115— driver.DiscoverNew has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
EndpointInterface.UnmarshalJSON (cognitive 19) REDACTED:81— EndpointInterface.UnmarshalJSON has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resolver.forwardExtDNS (cognitive 19) REDACTED:484— Resolver.forwardExtDNS has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), match/switch 2 (5 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.needDefaultGW (cognitive 19) libnetwork/default_gateway.go:115— Sandbox.needDefaultGW has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
containerfs.EnsureRemoveAll (cognitive 19) pkg/containerfs/rm.go:26— containerfs.EnsureRemoveAll has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
puller.resolveLocal (cognitive 18) builder/builder-next/adapters/containerimage/pull.go:234— puller.resolveLocal has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1 (nesting depth added 9). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 235). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
puller.CacheKey (cognitive 18) builder/builder-next/adapters/containerimage/pull.go:318— puller.CacheKey has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.ServiceCreate (cognitive 18) client/service_create.go:20— Client.ServiceCreate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.updateNetworkSettings (cognitive 18) daemon/container_operations.go:216— Daemon.updateNetworkSettings has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.foldFilter (cognitive 18) daemon/list.go:228— Daemon.foldFilter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15 (18 pts) (nesting depth added 3). Of this number, 11 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Daemon.setupConfigDir (cognitive 18) REDACTED:20— Daemon.setupConfigDir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (17 pts), loops 1 (nesting depth added 7). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.createSpecWindowsFields (cognitive 18) REDACTED:225— Daemon.createSpecWindowsFields has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (18 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
graphtest.DriverBenchDiffApplyN (cognitive 18) daemon/graphdriver/graphtest/graphbench_unix.go:124— graphtest.DriverBenchDiffApplyN has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
overlay2.usingMetacopy (cognitive 18) daemon/graphdriver/overlay2/check.go:128— overlay2.usingMetacopy has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
overlay2.Init (cognitive 18) daemon/graphdriver/overlay2/overlay.go:126— overlay2.Init has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16 (17 pts), match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Link.ToEnv (cognitive 18) daemon/links/links.go:49— Link.ToEnv has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 6). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
distribution.detectManifestBlobMediaType (cognitive 18) distribution/manifest.go:262— distribution.detectManifestBlobMediaType has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 7, match/switch 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
xfer.broadcast (cognitive 18) distribution/xfer/transfer.go:106— xfer.broadcast has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 3 (5 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
Network.applyConfigurationTo (cognitive 18) libnetwork/network.go:393— Network.applyConfigurationTo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Network.CopyTo (cognitive 18) libnetwork/network.go:431— Network.CopyTo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 7 (8 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.ResolveName (cognitive 18) libnetwork/sandbox.go:427— Sandbox.ResolveName has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
JSONProgress.String (cognitive 18) pkg/jsonmessage/jsonmessage.go:54— JSONProgress.String has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.parseInterface (cognitive 18) pkg/plugins/pluginrpc-gen/parser.go:135— main.parseInterface has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.lookup (cognitive 18) volume/drivers/extpoint.go:74— Store.lookup has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (18 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
windows.writeLayerFromTar (cognitive 18) REDACTED:724— windows.writeLayerFromTar has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
task.Exec (cognitive 18) libcontainerd/local/local_windows.go:563— task.Exec has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (18 pts) (nesting depth added 4). Of this number, 9 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
reader.wait (cognitive 18) daemon/logger/journald/read.go:194— reader.wait has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
imageRouter.postImagesPush (cognitive 17) api/server/router/image/image_routes.go:157— imageRouter.postImagesPush has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Worker.FromRemote (cognitive 17) builder/builder-next/worker/worker.go:360— Worker.FromRemote has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 3 (nesting depth added 6). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Builder.performCopy (cognitive 17) builder/dockerfile/internals.go:121— Builder.performCopy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
copier.calcCopyInfo (cognitive 17) builder/dockerfile/copy.go:170— copier.calcCopyInfo has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Client.ServiceUpdate (cognitive 17) client/service_update.go:18— Client.ServiceUpdate has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (16 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.withCgroups (cognitive 17) daemon/oci_linux.go:829— daemon.withCgroups has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1 (nesting depth added 2). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 830). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
ImageService.getImage (cognitive 17) daemon/images/image.go:201— ImageService.getImage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2 (nesting depth added 4). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
awslogs.New (cognitive 17) daemon/logger/awslogs/cloudwatchlogs.go:141— awslogs.New has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 166). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
puller.pullSchema1 (cognitive 17) distribution/pull_v2.go:450— puller.pullSchema1 has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
store.restore (cognitive 17) image/store.go:74— store.restore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 1 (nesting depth added 7). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 82). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Controller.rmServiceBinding (cognitive 17) libnetwork/service_common.go:314— Controller.rmServiceBinding has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
driver.CreateEndpoint (cognitive 17) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:17— driver.CreateEndpoint has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (17 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Endpoint.Delete (cognitive 17) REDACTED:775— Endpoint.Delete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 4 (nesting depth added 2). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Sandbox.SetKey (cognitive 17) libnetwork/sandbox_linux.go:110— Sandbox.SetKey has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Sandbox.addRedirectRules (cognitive 17) libnetwork/service_linux.go:626— Sandbox.addRedirectRules has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (nesting depth added 7). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 651). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
archive.CopyInfoDestinationPath (cognitive 17) REDACTED:170— archive.CopyInfoDestinationPath has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
refStore.addReference (cognitive 17) reference/store.go:125— refStore.addReference has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
requestReader.Read (cognitive 17) registry/resumable/resumablerequestreader.go:37— requestReader.Read has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runconfig.validateNetContainerMode (cognitive 17) runconfig/hostconfig.go:33— runconfig.validateNetContainerMode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
windowsParser.parseMountSpec (cognitive 17) volume/mounts/windows_parser.go:366— windowsParser.parseMountSpec has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
VolumeStore.create (cognitive 17) volume/service/store.go:587— VolumeStore.create has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (17 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httputils.WriteLogStream (cognitive 16) api/server/httputils/write_log_stream.go:19— httputils.WriteLogStream has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
networkRouter.findUniqueNetwork (cognitive 16) api/server/router/network/network_routes.go:231— networkRouter.findUniqueNetwork has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
dockerfile.normalizeDest (cognitive 16) builder/dockerfile/copy_unix.go:48— dockerfile.normalizeDest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
UDPProxy.Run (cognitive 16) cmd/docker-proxy/udp_proxy.go:110— UDPProxy.Run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemonOptions.setDefaultOptions (cognitive 16) cmd/dockerd/options.go:127— daemonOptions.setDefaultOptions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.validateHostConfig (cognitive 16) daemon/container.go:266— daemon.validateHostConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 3, boolean chains 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.configureNetworking (cognitive 16) REDACTED:864— daemon.configureNetworking has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
daemon.parsePSOutput (cognitive 16) daemon/top_unix.go:68— daemon.parsePSOutput has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ImageService.TagImage (cognitive 16) daemon/containerd/image_tag.go:19— ImageService.TagImage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (16 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.findAndAttachNetwork (cognitive 16) daemon/container_operations.go:320— Daemon.findAndAttachNetwork has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.setupSecretDir (cognitive 16) daemon/container_operations_unix.go:157— Daemon.setupSecretDir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (nesting depth added 5). Of this number, 13 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.restartSwarmContainers (cognitive 16) daemon/daemon.go:689— Daemon.restartSwarmContainers has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (13 pts), boolean chains 2, loops 1 (nesting depth added 9). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.setDefaultIsolation (cognitive 16) REDACTED:1407— Daemon.setDefaultIsolation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Daemon.containerStop (cognitive 16) daemon/stop.go:48— Daemon.containerStop has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (16 pts) (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
gcplogs.New (cognitive 16) daemon/logger/gcplogs/gcplogging.go:106— gcplogs.New has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 1 (nesting depth added 1). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
loggerutils.fixLongPath (cognitive 16) REDACTED:91— loggerutils.fixLongPath has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 4, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
forwarder.Do (cognitive 16) REDACTED:625— forwarder.Do has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
layerDescriptor.Read (cognitive 16) distribution/pull_v2.go:192— layerDescriptor.Read has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mod.moduleVersion (cognitive 16) internal/mod/mod.go:20— mod.moduleVersion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
main.main (cognitive 16) libnetwork/cmd/diagnostic/main.go:42— main.main has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Controller.handleFirewallReloadService (cognitive 16) libnetwork/firewall_linux.go:84— Controller.handleFirewallReloadService has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
IPAMData.Validate (cognitive 16) libnetwork/driverapi/ipamdata.go:68— IPAMData.Validate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 2 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
bridge.setINC (cognitive 16) libnetwork/drivers/bridge/setup_ip_tables_linux.go:352— bridge.setINC has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
bridge.setupBridgeIPv4 (cognitive 16) libnetwork/drivers/bridge/setup_ipv4_linux.go:30— bridge.setupBridgeIPv4 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (16 pts) (nesting depth added 9). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
driver.createNetwork (cognitive 16) libnetwork/drivers/bridge/bridge_linux.go:689— driver.createNetwork has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 1 (nesting depth added 2). Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
overlay.deleteVxlanByVNI (cognitive 16) libnetwork/drivers/overlay/ov_utils.go:104— overlay.deleteVxlanByVNI has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
driver.CreateEndpoint (cognitive 16) libnetwork/drivers/remote/driver.go:168— driver.CreateEndpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (16 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
remote.parseInterface (cognitive 16) libnetwork/drivers/remote/driver.go:403— remote.parseInterface has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (16 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Endpoint.Less (cognitive 16) libnetwork/sandbox.go:700— Endpoint.Less has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (16 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
NetworkDB.reapNetworks (cognitive 16) libnetwork/networkdb/cluster.go:372— NetworkDB.reapNetworks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
resolvconf.Build (cognitive 16) libnetwork/resolvconf/resolvconf.go:221— resolvconf.Build has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
oci.AppendDevicePermissionsFromCgroupRules (cognitive 16) oci/oci.go:35— oci.AppendDevicePermissionsFromCgroupRules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
idtools.parseSubidFile (cognitive 16) pkg/idtools/idtools.go:191— idtools.parseSubidFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
loopback.openNextAvailableLoopback (cognitive 16) REDACTED:37— loopback.openNextAvailableLoopback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Service.lookupV2Endpoints (cognitive 16) registry/service_v2.go:10— Service.lookupV2Endpoints has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
linuxParser.parseMountSpec (cognitive 16) volume/mounts/linux_parser.go:284— linuxParser.parseMountSpec has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D22 · Internal API Consistency· `Worker.Labels` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) · ×1
`Worker.Labels` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) builder/builder-next/worker/worker.go:150— 4 of 5 collection-returning members of `Worker` return a slice (`[]T`) (4 of 5). Siblings: Worker.Platforms (builder/builder-next/worker/worker.go:155); Worker.GCPolicy (builder/builder-next/worker/worker.go:174); Worker.DiskUsage (builder/builder-next/worker/worker.go:246); Worker.GetRemotes (builder/builder-next/worker/worker.go:274). Return a slice (`[]T`). [rule A4]
D22 · Internal API Consistency· `Daemon.Features` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) · ×1
`Daemon.Features` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) daemon/daemon.go:200— 4 of 5 collection-returning members of `Daemon` return a slice (`[]T`) (4 of 5). Siblings: Daemon.Subnets (daemon/daemon.go:1380); Daemon.SubscribeToEvents (daemon/events.go:78); Daemon.List (daemon/list.go:53); Daemon.GetNetworkDriverList (daemon/network.go:327). Return a slice (`[]T`). [rule A4]
D22 · Internal API Consistency· `distribution.DeltaBaseImageFromConfig` takes no context.Context; its 4 sibling operations take one · ×1
`distribution.DeltaBaseImageFromConfig` takes no context.Context; its 4 sibling operations take one distribution/pull_v2.go:1017— 4 of 5 fallible operations of `package distribution` take a `ctx context.Context` (4 of 5). Siblings: distribution.Pull (distribution/pull.go:19); distribution.Tags (distribution/pull.go:34); distribution.Push (distribution/push.go:20); distribution.GetRepositories (distribution/repository.go:19). Take `ctx context.Context` as the first parameter, like its siblings, and pass it on. [rule A1]
D22 · Internal API Consistency· `Store.Map` returns a map (`map[K]V`) where its 3 siblings return a slice (`[]T`) · ×1
`Store.Map` returns a map (`map[K]V`) where its 3 siblings return a slice (`[]T`) layer/layer.go:180— 3 of 4 collection-returning members of `Store` return a slice (`[]T`) (3 of 4). Siblings: Store.Release (layer/layer.go:181); Store.ReleaseRWLayer (layer/layer.go:185); Store.DriverStatus (layer/layer.go:187). Return a slice (`[]T`). [rule A4]
D22 · Internal API Consistency· `Endpoint.DriverInfo` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) · ×1
`Endpoint.DriverInfo` returns a map (`map[K]V`) where its 4 siblings return a slice (`[]T`) libnetwork/endpoint_info_unix.go:8— 4 of 5 collection-returning members of `Endpoint` return a slice (`[]T`) (4 of 5). Siblings: Endpoint.MarshalJSON (REDACTED:58); Endpoint.Key (REDACTED:338); Endpoint.KeyPrefix (REDACTED:346); Endpoint.Value (REDACTED:354). Return a slice (`[]T`). [rule A4]
D22 · Internal API Consistency· `testutil.SetContext` takes its context.Context last where 2 members of the package take it first · ×1
`testutil.SetContext` takes its context.Context last where 2 members of the package take it first testutil/helpers.go:153— 2 of 3 members of package testutil with a context take it as the first parameter, the context package's own rule (2 of 3). Siblings: testutil.StartSpan (testutil/helpers.go:89); testutil.RunCommand (testutil/helpers.go:101). Move `ctx context.Context` to the front of the parameter list. [rule A2]
Change coupling: backend.go ↔ image_service.go api/server/router/image/backend.go:1— `api/server/router/image/backend.go` and `daemon/image_service.go` change together 62% of the time (10 of the 16 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well, and counted over this repository's 10,000 most recent commits rather than its whole history — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 10 shared commits counted here, the most recent 3 are `48cacbca` api/types: move image-types to api/types/image; `ccb37fa5` imageService/PullImage: Move reference parse to api; `e7393d0f` images/push: Accept reference — run `git show` on any of them.
Near-duplicate member pair (39 shared lines) daemon/container_operations.go:45— daemon/container_operations.go:45-214 | daemon/network.go:706-776 — These two members are variants of one another: 39 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (34 shared lines) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:168— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:168-228 | daemon/graphdriver/overlay2/overlay.go:347-422 — These two members are variants of one another: 34 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (11 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (11 members, 50+ identical tokens) libnetwork/networkdb/networkdbdiagnostic.go:38— libnetwork/networkdb/networkdbdiagnostic.go:38-69 | libnetwork/networkdb/networkdbdiagnostic.go:71-103 | libnetwork/networkdb/networkdbdiagnostic.go:105-126 | libnetwork/networkdb/networkdbdiagnostic.go:128-175 | libnetwork/networkdb/networkdbdiagnostic.go:177-223 | libnetwork/networkdb/networkdbdiagnostic.go:225-260 | libnetwork/networkdb/networkdbdiagnostic.go:262-306 | libnetwork/networkdb/networkdbdiagnostic.go:308-338 | libnetwork/networkdb/networkdbdiagnostic.go:340-370 | libnetwork/networkdb/networkdbdiagnostic.go:372-418 | libnetwork/networkdb/networkdbdiagnostic.go:420-455 — These 11 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 11 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 11 times.
D4 · Code Duplication· Edited copy of a member (41 corresponding lines) · ×1
Edited copy of a member (41 corresponding lines) libnetwork/drivers/bridge/bridge_store.go:291— libnetwork/drivers/bridge/bridge_store.go:291-337 | libnetwork/drivers/windows/windows_store.go:243-283 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (69 corresponding lines) · ×1
Edited copy of a member (69 corresponding lines) volume/mounts/linux_parser.go:48— volume/mounts/linux_parser.go:48-116 | volume/mounts/windows_parser.go:215-293 — These two members are one piece of code written twice and then edited apart: 69 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (64 corresponding lines) · ×1
Edited copy of a member (64 corresponding lines) libnetwork/drivers/overlay/joinleave.go:153— libnetwork/drivers/overlay/joinleave.go:153-221 | libnetwork/drivers/windows/overlay/joinleave_windows.go:49-112 — These two members are one piece of code written twice and then edited apart: 64 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (63 corresponding lines) · ×1
Edited copy of a member (63 corresponding lines) client/service_create.go:20— client/service_create.go:20-82 | client/service_update.go:18-86 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (56 corresponding lines) · ×1
Edited copy of a member (56 corresponding lines) REDACTED:20— REDACTED:20-76 | REDACTED:92-147 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (46 corresponding lines) · ×1
Edited copy of a member (46 corresponding lines) daemon/containerd/image_builder.go:137— daemon/containerd/image_builder.go:137-194 | daemon/images/image_builder.go:152-197 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (58 corresponding lines) · ×1
Edited copy of a member (58 corresponding lines) volume/mounts/linux_parser.go:209— volume/mounts/linux_parser.go:209-278 | volume/mounts/windows_parser.go:303-360 — These two members are one piece of code written twice and then edited apart: 58 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (72 corresponding lines) · ×1
Edited copy of a member (72 corresponding lines) daemon/archive_windows.go:56— daemon/archive_windows.go:56-143 | daemon/archive_windows.go:263-334 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (45 corresponding lines) · ×1
Edited copy of a member (45 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:17— libnetwork/drivers/ipvlan/ipvlan_endpoint.go:17-61 | libnetwork/drivers/macvlan/macvlan_endpoint.go:18-66 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (55 corresponding lines) · ×1
Edited copy of a member (55 corresponding lines) libnetwork/drivers/bridge/port_mapping_linux.go:131— libnetwork/drivers/bridge/port_mapping_linux.go:131-185 | libnetwork/drivers/windows/port_mapping.go:46-106 — These two members are one piece of code written twice and then edited apart: 55 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 27+ corresponding lines) · ×1
Edited copies of one member (4 members, 27+ corresponding lines) libnetwork/drivers/bridge/bridge_store.go:74— libnetwork/drivers/bridge/bridge_store.go:74-101 | libnetwork/drivers/ipvlan/ipvlan_store.go:90-116 | libnetwork/drivers/macvlan/macvlan_store.go:89-115 | libnetwork/drivers/windows/windows_store.go:72-101 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (48 corresponding lines) · ×1
Edited copy of a member (48 corresponding lines) daemon/archive_unix.go:39— daemon/archive_unix.go:39-92 | daemon/archive_unix.go:164-211 — These two members are one piece of code written twice and then edited apart: 48 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 37+ corresponding lines) · ×1
Edited copies of one member (3 members, 37+ corresponding lines) client/container_logs.go:36— client/container_logs.go:36-80 | client/service_logs.go:16-52 | client/task_logs.go:15-51 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 37 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (35 corresponding lines) · ×1
Edited copy of a member (35 corresponding lines) daemon/containerd/image_import.go:217— daemon/containerd/image_import.go:217-251 | daemon/containerd/image_import.go:254-289 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (32 corresponding lines) · ×1
Edited copy of a member (32 corresponding lines) daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:384— daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:384-417 | daemon/graphdriver/overlay2/overlay.go:621-652 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (25 corresponding lines) · ×1
Edited copy of a member (25 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_store.go:151— libnetwork/drivers/ipvlan/ipvlan_store.go:151-176 | libnetwork/drivers/macvlan/macvlan_store.go:150-174 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×1
Edited copy of a member (23 corresponding lines) cmd/dockerd/metrics.go:14— cmd/dockerd/metrics.go:14-38 | daemon/metrics_unix.go:24-46 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) libnetwork/drivers/ipvlan/ipvlan_network.go:166— libnetwork/drivers/ipvlan/ipvlan_network.go:166-212 | libnetwork/drivers/macvlan/macvlan_network.go:156-191 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 22+ corresponding lines) · ×1
Edited copies of one member (3 members, 22+ corresponding lines) libnetwork/networkdb/networkdb.go:405— libnetwork/networkdb/networkdb.go:405-427 | libnetwork/networkdb/networkdb.go:433-454 | libnetwork/networkdb/networkdb.go:485-510 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (6 members, 20+ corresponding lines) · ×1
Edited copies of one member (6 members, 20+ corresponding lines) client/config_inspect.go:13— client/config_inspect.go:13-36 | client/container_inspect.go:30-53 | client/image_inspect.go:13-32 | client/node_inspect.go:13-32 | client/service_inspect.go:16-37 | client/task_inspect.go:13-32 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (7 members, 20+ corresponding lines) · ×1
Edited copies of one member (7 members, 20+ corresponding lines) client/config_list.go:14— client/config_list.go:14-38 | client/network_list.go:13-32 | client/node_list.go:14-35 | client/secret_list.go:14-38 | client/service_list.go:14-39 | client/task_list.go:14-35 | client/volume_list.go:13-33 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 18+ corresponding lines) · ×1
Edited copies of one member (4 members, 18+ corresponding lines) libnetwork/drivers/bridge/bridge_store.go:52— libnetwork/drivers/bridge/bridge_store.go:52-72 | libnetwork/drivers/ipvlan/ipvlan_store.go:71-88 | libnetwork/drivers/macvlan/macvlan_store.go:70-87 | libnetwork/drivers/windows/windows_store.go:49-70 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) REDACTED:342— REDACTED:342-366 | REDACTED:368-389 | REDACTED:391-408 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (8 members, 15+ corresponding lines) · ×1
Edited copies of one member (8 members, 15+ corresponding lines) api/server/router/container/container_routes.go:928— api/server/router/container/container_routes.go:928-943 | api/server/router/image/image_routes.go:510-525 | api/server/router/network/network_routes.go:206-221 | api/server/router/plugin/plugin_routes.go:272-286 | api/server/router/swarm/cluster_routes.go:316-332 | api/server/router/swarm/cluster_routes.go:387-403 | api/server/router/swarm/cluster_routes.go:418-433 | api/server/router/swarm/cluster_routes.go:489-504 — These 8 members are one piece of code written 8 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 8 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 17+ corresponding lines) · ×1
Edited copies of one member (3 members, 17+ corresponding lines) REDACTED:21— REDACTED:21-38 | REDACTED:19-36 | cmd/docker-proxy/udp_proxy.go:57-73 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 17 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 13+ corresponding lines) · ×1
Edited copies of one member (3 members, 13+ corresponding lines) testutil/daemon/config.go:60— testutil/daemon/config.go:60-72 | testutil/daemon/secret.go:61-74 | testutil/daemon/swarm.go:158-170 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 11+ corresponding lines) · ×1
Edited copies of one member (4 members, 11+ corresponding lines) libnetwork/drivers/bridge/bridge_store.go:103— libnetwork/drivers/bridge/bridge_store.go:103-114 | libnetwork/drivers/ipvlan/ipvlan_store.go:119-129 | libnetwork/drivers/macvlan/macvlan_store.go:118-128 | libnetwork/drivers/windows/windows_store.go:103-114 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 16+ corresponding lines) · ×1
Edited copies of one member (3 members, 16+ corresponding lines) layer/filestore.go:202— layer/filestore.go:202-217 | layer/filestore.go:307-322 | layer/filestore.go:324-339 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 7+ corresponding lines) · ×1
Edited copies of one member (5 members, 7+ corresponding lines) api/server/router/container/container_routes.go:404— api/server/router/container/container_routes.go:404-411 | api/server/router/container/exec.go:19-26 | api/server/router/image/image_routes.go:437-444 | api/server/router/plugin/plugin_routes.go:288-294 | api/server/router/swarm/cluster_routes.go:464-471 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Duplicated block (49 lines × 2) libnetwork/drivers/ipvlan/ipvlan_network.go:67— libnetwork/drivers/ipvlan/ipvlan_network.go:67-115 | libnetwork/drivers/macvlan/macvlan_network.go:57-105 — `libnetwork/drivers/ipvlan/ipvlan_network.go` and `libnetwork/drivers/macvlan/macvlan_network.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 7 separate duplicated blocks between them, totalling at least 171 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (31 lines × 2) libnetwork/drivers/ipvlan/ipvlan.go:32— libnetwork/drivers/ipvlan/ipvlan.go:32-62 | libnetwork/drivers/macvlan/macvlan.go:26-56 — `libnetwork/drivers/ipvlan/ipvlan.go` and `libnetwork/drivers/macvlan/macvlan.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 2 separate duplicated blocks between them, totalling at least 43 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan.go:32` it begins part-way through the construct above it, so those 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–33 lines × 4) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:76— libnetwork/drivers/ipvlan/ipvlan_endpoint.go:76-82 | libnetwork/drivers/ipvlan/ipvlan_network.go:119-151 | libnetwork/drivers/macvlan/macvlan_endpoint.go:81-87 | libnetwork/drivers/macvlan/macvlan_network.go:109-141 — `libnetwork/drivers/ipvlan/ipvlan_endpoint.go` and `libnetwork/drivers/macvlan/macvlan_endpoint.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/ipvlan/ipvlan_endpoint.go:76` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (35 lines × 2) libnetwork/drivers/ipvlan/ipvlan_setup.go:96— libnetwork/drivers/ipvlan/ipvlan_setup.go:96-130 | libnetwork/drivers/macvlan/macvlan_setup.go:76-110 — `libnetwork/drivers/ipvlan/ipvlan_setup.go` and `libnetwork/drivers/macvlan/macvlan_setup.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 6 separate duplicated blocks between them, totalling at least 112 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (25 lines × 2) daemon/containerd/cache.go:171— daemon/containerd/cache.go:171-195 | image/cache/cache.go:184-208 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (24–25 lines × 2) pkg/directory/directory_unix.go:16— pkg/directory/directory_unix.go:16-39 | pkg/directory/directory_windows.go:12-36 — before extracting anything, compare `pkg/directory/directory_unix.go` and `pkg/directory/directory_windows.go` as WHOLE FILES: 89% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/directory/directory_unix.go:16` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (21–24 lines × 2) libnetwork/networkdb/networkdb.go:533— libnetwork/networkdb/networkdb.go:533-556 | libnetwork/networkdb/networkdb.go:562-582 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/networkdb/networkdb.go:533` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `node` in one and `nDB *NetworkDB) deleteNodeTableEntries(node` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
Duplicated block (19–20 lines × 2) libnetwork/drivers/bridge/bridge_linux.go:1200— libnetwork/drivers/bridge/bridge_linux.go:1200-1219 | libnetwork/drivers/windows/windows.go:802-820 — 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 `libnetwork/drivers/bridge/bridge_linux.go:1200` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (15–16 lines × 4) libnetwork/drivers/bridge/bridge_store.go:119— libnetwork/drivers/bridge/bridge_store.go:119-134 | libnetwork/drivers/ipvlan/ipvlan_store.go:135-149 | libnetwork/drivers/macvlan/macvlan_store.go:134-148 | libnetwork/drivers/windows/windows_store.go:119-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/drivers/bridge/bridge_store.go:119` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (15–16 lines × 3) daemon/graphdriver/graphtest/graphbench_unix.go:70— daemon/graphdriver/graphtest/graphbench_unix.go:70-85 | daemon/graphdriver/graphtest/graphbench_unix.go:107-121 | daemon/graphdriver/graphtest/graphbench_unix.go:205-220 — 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 `daemon/graphdriver/graphtest/graphbench_unix.go:70` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 3) builder/builder-next/adapters/containerimage/pull.go:831— builder/builder-next/adapters/containerimage/pull.go:831-845 | builder/builder-next/exporter/mobyexporter/writer.go:211-225 | builder/builder-next/worker/worker.go:518-532 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
Duplicated block (14 lines × 3) daemon/logger/loggertest/logreader.go:236— daemon/logger/loggertest/logreader.go:236-249 | daemon/logger/loggertest/logreader.go:365-378 | daemon/logger/loggertest/logreader.go:394-407 — 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 `daemon/logger/loggertest/logreader.go:236` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also 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 (13–14 lines × 2) REDACTED:296— REDACTED:296-308 | REDACTED:309-322 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11–13 lines × 3) libnetwork/drivers/ipvlan/ipvlan_endpoint.go:65— libnetwork/drivers/ipvlan/ipvlan_endpoint.go:65-75 | libnetwork/drivers/macvlan/macvlan_endpoint.go:70-80 | libnetwork/drivers/windows/overlay/ov_endpoint_windows.go:224-236 — `libnetwork/drivers/ipvlan/ipvlan_endpoint.go` and `libnetwork/drivers/macvlan/macvlan_endpoint.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 3 separate duplicated blocks between them, totalling at least 61 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 7) libnetwork/networkdb/networkdbdiagnostic.go:39— libnetwork/networkdb/networkdbdiagnostic.go:39-49 | libnetwork/networkdb/networkdbdiagnostic.go:72-82 | libnetwork/networkdb/networkdbdiagnostic.go:106-116 | libnetwork/networkdb/networkdbdiagnostic.go:226-236 | libnetwork/networkdb/networkdbdiagnostic.go:309-319 | libnetwork/networkdb/networkdbdiagnostic.go:341-351 | libnetwork/networkdb/networkdbdiagnostic.go:421-431 — all 7 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 3) daemon/containerd/image_snapshot_unix.go:47— daemon/containerd/image_snapshot_unix.go:47-55 | daemon/containerd/image_snapshot_unix.go:75-83 | daemon/containerd/image_snapshot_unix.go:98-106 — 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 `daemon/containerd/image_snapshot_unix.go:47` 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 × 11) libnetwork/networkdb/networkdbdiagnostic.go:44— libnetwork/networkdb/networkdbdiagnostic.go:44-49 | libnetwork/networkdb/networkdbdiagnostic.go:77-82 | libnetwork/networkdb/networkdbdiagnostic.go:111-116 | libnetwork/networkdb/networkdbdiagnostic.go:134-139 | libnetwork/networkdb/networkdbdiagnostic.go:183-188 | libnetwork/networkdb/networkdbdiagnostic.go:231-236 | libnetwork/networkdb/networkdbdiagnostic.go:268-273 | libnetwork/networkdb/networkdbdiagnostic.go:314-319 | libnetwork/networkdb/networkdbdiagnostic.go:346-351 | libnetwork/networkdb/networkdbdiagnostic.go:378-383 | libnetwork/networkdb/networkdbdiagnostic.go:426-431 — all 11 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (9 lines × 4) libnetwork/drivers/ipvlan/ipvlan_state.go:81— libnetwork/drivers/ipvlan/ipvlan_state.go:81-90 | libnetwork/drivers/macvlan/macvlan_state.go:81-89 | libnetwork/drivers/overlay/ov_utils.go:21-31 | libnetwork/drivers/windows/overlay/ov_endpoint_windows.go:41-51 — `libnetwork/drivers/ipvlan/ipvlan_state.go` and `libnetwork/drivers/macvlan/macvlan_state.go` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 5 separate duplicated blocks between them, totalling at least 57 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
Duplicated block (13 lines × 4) client/container_prune.go:17— client/container_prune.go:17-29 | client/image_prune.go:17-29 | client/network_prune.go:17-29 | client/volume_prune.go:17-29 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/container_prune.go:17` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (7 lines × 6) daemon/logger/loggertest/logreader.go:246— daemon/logger/loggertest/logreader.go:246-253 | daemon/logger/loggertest/logreader.go:271-278 | daemon/logger/loggertest/logreader.go:297-303 | daemon/logger/loggertest/logreader.go:322-328 | daemon/logger/loggertest/logreader.go:348-355 | daemon/logger/loggertest/logreader.go:375-382 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `daemon/logger/loggertest/logreader.go:246` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (6 lines × 3) daemon/logger/loggertest/logreader.go:125— daemon/logger/loggertest/logreader.go:125-130 | daemon/logger/loggertest/logreader.go:132-137 | daemon/logger/loggertest/logreader.go:139-144 — 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 `daemon/logger/loggertest/logreader.go:125` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication· Members sharing a duplicated core (6 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (6 members, 50+ identical tokens) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:530— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:530-564 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:567-599 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:602-628 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:631-674 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:677-710 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:713-760 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication· Edited copies of one member (5 members, 11+ corresponding lines) · ×1
Edited copies of one member (5 members, 11+ corresponding lines) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:79— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:79-90 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:92-103 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:105-115 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:117-127 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:136-146 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
Duplicated block (10–11 lines × 3) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:169— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:169-179 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:185-195 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:203-212 — 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 `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:169` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:197` calls `deleteTableKey` and `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:180` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (3–7 lines × 6) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:544— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:544-546 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:582-584 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:605-611 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:634-640 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:680-686 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:717-723 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:544` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:581` calls `close` and `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:541` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (7 lines × 5) libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83— libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83-90 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:96-103 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:109-115 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:121-127 | libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:140-146 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:83` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `port` in one and `networkName` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
No DR/backup evidence — A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
Swallowed exception (empty catch) pkg/progress/progress.go:44— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
X3 · Exception handling· Lost error (reports an error that is nil on this path) · ×1
Lost error (reports an error that is nil on this path) pkg/process/process_windows.go:38— `if err == nil` reports `err` on the one path where it is nil, and the path where the call failed goes on without ever reading it: the comparison is inverted. The real failure is lost and a nil error (or a panic on `err.Error()`) is reported in its place. Test `err != nil` here.
Orphaned file libcontainerd/local/local_windows.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file daemon/oci_linux.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file daemon/container_operations.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/controller.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file daemon/logger/awslogs/cloudwatchlogs.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file api/server/router/container/container_routes.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/agent.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/cmd/networkdb-test/dbclient/ndbClient.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file daemon/network.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file testutil/daemon/daemon.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/cnmallocator/networkallocator.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/networkdb/networkdb.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file distribution/push_v2.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file volume/service/store.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file builder/builder-next/adapters/containerimage/pull.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file REDACTED:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/drivers/windows/windows.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file api/types/types.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/service_linux.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libcontainerd/remote/client.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file libnetwork/iptables/iptables.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file builder/dockerfile/dispatchers.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Duplicated predicate daemon/containerd/cache.go:156— `!isValidParent(target, parent) || !isValidConfig(cfg, target.History[lenHistory])` appears character-identically in 2 files — daemon/containerd/cache.go, image/cache/cache.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:479— `!n.getController().isSwarmNode() || n.Scope() != scope.Swarm || !n.driverIsMultihost()` appears character-identically in 2 files — REDACTED, libnetwork/network.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/oci_linux.go:633— `!strings.HasPrefix(m.Source, daemon.root) && !strings.HasPrefix(daemon.root, m.Source)` appears character-identically in 2 files — daemon/oci_linux.go, daemon/volumes_linux.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/archive_unix.go:137— `!toVolume && container.HostConfig.ReadonlyRootfs` appears character-identically in 2 files — daemon/archive_unix.go, daemon/archive_windows.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate api/server/router/container/container_routes.go:164— `!tty && versions.GreaterThanOrEqualTo(httputils.VersionFromContext(ctx), "1.42")` appears character-identically in 2 files — api/server/router/container/container_routes.go, api/server/router/swarm/helpers.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate container/container_unix.go:357— `container.HostConfig.AutoRemove && !hostConfig.RestartPolicy.IsNone()` appears character-identically in 2 files — container/container_unix.go, container/container_windows.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/container_operations.go:989— `container.RemovalInProgress || container.Dead` appears character-identically in 2 files — daemon/container_operations.go, daemon/start.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate libnetwork/drivers/bridge/bridge_store.go:54— `err != nil && err != datastore.ErrKeyNotFound` appears character-identically in 5 files — libnetwork/drivers/bridge/bridge_store.go, libnetwork/drivers/ipvlan/ipvlan_store.go, libnetwork/drivers/macvlan/macvlan_store.go, libnetwork/drivers/windows/windows_store.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/containerd/image_builder.go:88— `err != nil && opts.PullOption == backend.PullOptionNoPull` appears character-identically in 2 files — daemon/containerd/image_builder.go, daemon/images/image_builder.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/containerd/image_builder.go:161— `errdefs.IsNotFound(err) && img != nil && platform != nil` appears character-identically in 2 files — daemon/containerd/image_builder.go, daemon/images/image_builder.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/image_pull.go:38— `errdefs.IsUnauthorized(err) && options.PrivilegeFunc != nil` appears character-identically in 4 files — client/image_pull.go, client/image_push.go, client/image_search.go, client/plugin_install.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate client/request.go:153— `errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded)` appears character-identically in 6 files — client/request.go, daemon/containerd/image_import.go, daemon/containerd/image_prune.go, daemon/containerd/progress.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate distribution/pull.go:129— `fallbackErr.transportOK && endpoint.URL.Scheme == "https"` appears character-identically in 2 files — distribution/pull.go, distribution/push.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:1165— `fi.IsDir() && hdr.Typeflag == tar.TypeDir` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/dockerd/daemon.go:559— `flags.Changed("config-file") || !os.IsNotExist(err)` appears character-identically in 2 files — cmd/dockerd/daemon.go, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/images/image_prune.go:76— `len(i.referenceStore.References(dgst)) == 0 && len(i.imageStore.Children(id)) != 0` appears character-identically in 2 files — daemon/images/image_prune.go, daemon/images/service.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate libnetwork/drivers/bridge/bridge_linux.go:630— `len(ipV4Data) == 0 || ipV4Data[0].Pool.String() == "0.0.0.0/0"` appears character-identically in 5 files — libnetwork/drivers/bridge/bridge_linux.go, libnetwork/drivers/ipvlan/ipvlan_network.go, libnetwork/drivers/macvlan/macvlan_network.go, libnetwork/drivers/overlay/ov_network.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go:153— `opts != nil && len(opts.StorageOpt) != 0` appears character-identically in 3 files — daemon/graphdriver/fuse-overlayfs/fuseoverlayfs.go, daemon/graphdriver/overlay2/overlay.go, daemon/graphdriver/vfs/driver.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate daemon/containerd/cache.go:174— `parent == nil || len(parent.History) == 0 && len(parent.RootFS.DiffIDs) == 0` appears character-identically in 2 files — daemon/containerd/cache.go, image/cache/cache.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:496— `resources.NanoCPUs < 0 || resources.NanoCPUs > int64(sysinfo.NumCPU())*1e9` appears character-identically in 2 files — REDACTED, daemon/daemon_windows.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate volume/mounts/linux_parser.go:252— `volumeDriver != "" && spec.Type == mount.TypeVolume` appears character-identically in 2 files — volume/mounts/linux_parser.go, volume/mounts/windows_parser.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Fat interface: Backend (29 methods) api/server/router/swarm/backend.go:13— `Backend` declares 29 methods: `Init`, `Join`, `Leave`, `Inspect`, `Update`, `GetUnlockKey`, `UnlockSwarm`, `GetServices`, `GetService`, `CreateService`, `UpdateService`, `RemoveService`, `ServiceLogs`, `GetNodes`, `GetNode`, `UpdateNode`, `RemoveNode`, `GetTasks`, `GetTask`, `GetSecrets`, `CreateSecret`, `RemoveSecret`, `GetSecret`, `UpdateSecret`, `GetConfigs`, `CreateConfig`, `RemoveConfig`, `GetConfig`, `UpdateConfig`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ContainerAPIClient (32 methods) client/interface.go:48— `ContainerAPIClient` declares 32 methods: `ContainerAttach`, `ContainerCommit`, `ContainerCreate`, `ContainerDiff`, `ContainerExecAttach`, `ContainerExecCreate`, `ContainerExecInspect`, `ContainerExecResize`, `ContainerExecStart`, `ContainerExport`, `ContainerInspect`, `ContainerInspectWithRaw`, `ContainerKill`, `ContainerList`, `ContainerLogs`, `ContainerPause`, `ContainerRemove`, `ContainerRename`, `ContainerResize`, `ContainerRestart`, `ContainerStatPath`, `ContainerStats`, `ContainerStatsOneShot`, `ContainerStart`, `ContainerStop`, `ContainerTop`, `ContainerUnpause`, `ContainerUpdate`, `ContainerWait`, `CopyFromContainer`, `CopyToContainer`, `ContainersPrune`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageAPIClient (17 methods) client/interface.go:89— `ImageAPIClient` declares 17 methods: `ImageBuild`, `BuildCachePrune`, `BuildCancel`, `ImageCreate`, `ImageHistory`, `ImageDelta`, `ImageImport`, `ImageInspectWithRaw`, `ImageList`, `ImageLoad`, `ImagePull`, `ImagePush`, `ImageRemove`, `ImageSearch`, `ImageSave`, `ImageTag`, `ImagesPrune`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
Fat interface: ImageService (38 methods) daemon/image_service.go:27— `ImageService` declares 38 methods: `PullImage`, `PushImage`, `CreateImage`, `ImageDelete`, `ExportImage`, `PerformWithBaseFS`, `LoadImage`, `Images`, `LogImageEvent`, `CountImages`, `ImagesPrune`, `ImportImage`, `TagImage`, `GetImage`, `ImageHistory`, `CommitImage`, `SquashImage`, `PrepareSnapshot`, `GetImageManifest`, `GetImageAndReleasableLayer`, `CreateLayer`, `LayerStoreStatus`, `GetLayerMountID`, `ReleaseLayer`, `LayerDiskUsage`, `GetContainerLayerSize`, `Mount`, `Unmount`, `Changes`, `GetLayerFolders`, `MakeImageCache`, `CommitBuildStep`, `DeltaCreate`, `DistributionServices`, `Children`, `Cleanup`, `StorageDriver`, `UpdateConfig`. Counted over the exported method specs the interface itself declares, once per name; an embedded interface is a role it composes, judged on its own declaration, and is not counted here. A wide interface forces every implementer and caller to depend on methods they don't use (the Interface-Segregation 'I' in SOLID). Split it into focused role-interfaces.
ED3 · Event naming· Event not named in past tense · ×4
Event not named in past tense: EventCreate plugin/events.go:22— `EventCreate` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
Event not named in past tense: EventRemove plugin/events.go:48— `EventRemove` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
Event not named in past tense: EventDisable plugin/events.go:62— `EventDisable` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
Event not named in past tense: EventEnable plugin/events.go:76— `EventEnable` reads as an instruction, not a fact that happened: events describe something that already occurred. Name new events for the fact that occurred (e.g. `OrderPlaced`). Do not rename this one if it is already stored or published: its type name is written with every event recorded under it, so a rename can break replay of the stored stream and every subscriber that reads it, and a clearer name does not pay for that. If it has never been written or sent, renaming it now is safe.
D34 · Knowledge Freshness· Most significant orphaned file · ×3
Most significant orphaned file libnetwork/network.go:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file REDACTED:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Most significant orphaned file libnetwork/drivers/bridge/bridge_linux.go:1— One of the orphaned files carrying the most lost knowledge — ranked by size weighted by the file's role in the codebase, the same weighting behind the score above, so core code outranks equally large plumbing. A reasonable place to start a read-through before the aggregate risk above bites.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 7 significant file(s) lose their only recent owner: REDACTED, container/container.go, image/store.go, distribution/config.go, pkg/ioutils/readers.go, pkg/ioutils/fswriters.go, pkg/tarsplitutils/tarstream.go. Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 2 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (9 single-owned of 511 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 511 of the 1263 production source files in this repository met that bar). They are anonymized user #2 (1 file(s)), anonymized user #3 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: image/tarexport/load.go, daemon/top_unix.go.
No ADRs found pkg/plugins/pluginrpc-gen/main.go:1— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `pkg/plugins/pluginrpc-gen/main.go` makes this repository a deployable product (line 1).
D21 · Naming Consistency· `blockMAX` spells `MAX` where 21 names in the project spell it `Max` · ×1
`blockMAX` spells `MAX` where 21 names in the project spell it `Max` libnetwork/bitmap/sequence.go:16— 21 of 22 names in project gopath.local/repository spell the token `Max` (21 of 22; unit: names in project gopath.local/repository containing `Max`). Peers: config.DefaultMaxConcurrentDownloads (REDACTED:30); config.DefaultMaxConcurrentUploads (REDACTED:34); daemon.linuxMaxCPUShares (REDACTED:59); daemon.configureMaxThreads (REDACTED:774); daemon.windowsMaxCPUShares (daemon/daemon_windows.go:40). Rename to `blockMax`. [rule N6]
D21 · Naming Consistency· `setDefaultVLAN` spells `VLAN` where 12 names in the project spell it `Vlan` · ×1
`setDefaultVLAN` spells `VLAN` where 12 names in the project spell it `Vlan` libnetwork/drivers/overlay/ov_network.go:490— 12 of 13 names in project gopath.local/repository spell the token `Vlan` (12 of 13; unit: names in project gopath.local/repository containing `Vlan`). Peers: network.CreateVlanInterface (integration/network/helpers.go:25); ipvlan.createIPVlan (libnetwork/drivers/ipvlan/ipvlan_setup.go:23); ipvlan.setIPVlanMode (libnetwork/drivers/ipvlan/ipvlan_setup.go:61); ipvlan.setIPVlanFlag (libnetwork/drivers/ipvlan/ipvlan_setup.go:75); ipvlan.createVlanLink (libnetwork/drivers/ipvlan/ipvlan_setup.go:95). Rename to `setDefaultVlan`. [rule N6]
D21 · Naming Consistency· `defaultIPv4Dns` spells `Dns` where 33 names in the project spell it `DNS` · ×1
`defaultIPv4Dns` spells `Dns` where 33 names in the project spell it `DNS` libnetwork/resolvconf/resolvconf.go:77— 33 of 35 names in project gopath.local/repository spell the token `DNS` (33 of 35; unit: names in project gopath.local/repository containing `DNS`). Peers: buildkit.getDNSConfig (builder/builder-next/executor_linux.go:169); Container.InitDNSHostConfig (container/container.go:582); daemon.buildEndpointDNSNames (daemon/container_operations.go:622); daemon.buildCreateEndpointOptions(daemonDNS) (daemon/network.go:612); windows.DisableDNS (libnetwork/drivers/windows/labels.go:41). Rename to `defaultIPv4DNS`. [rule N6]
D21 · Naming Consistency· `defaultIPv6Dns` spells `Dns` where 33 names in the project spell it `DNS` · ×1
`defaultIPv6Dns` spells `Dns` where 33 names in the project spell it `DNS` libnetwork/resolvconf/resolvconf.go:78— 33 of 35 names in project gopath.local/repository spell the token `DNS` (33 of 35; unit: names in project gopath.local/repository containing `DNS`). Peers: buildkit.getDNSConfig (builder/builder-next/executor_linux.go:169); Container.InitDNSHostConfig (container/container.go:582); daemon.buildEndpointDNSNames (daemon/container_operations.go:622); daemon.buildCreateEndpointOptions(daemonDNS) (daemon/network.go:612); windows.DisableDNS (libnetwork/drivers/windows/labels.go:41). Rename to `defaultIPv6DNS`. [rule N6]
D28 · Secrets (history)· Rotate the exposed credentials · ×1
Concentrated knowledge decay — 513 of 533 significant files have no living knowledge, while the repository is still being changed at a low rate (4 commit(s) in the last 90 days) — so this is one repo-wide knowledge-decay state, not 513 separate risks. Counted over 533 of the 1263 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over. The code moved on without the people who understood these files: document them or schedule a read-through before the next change lands in them.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M2 · Architecture documentation· Architecture diagram out of date · ×1
Architecture diagram out of date vendor/github.com/containerd/containerd/runtime/v2/README.md:206— `vendor/github.com/containerd/containerd/runtime/v2/README.md` draws the system's parts, and the drawing no longer matches the code: it leaves out `containerd-shim-runc-v2`, which the repository has beside the units it does draw. A diagram of a system that no longer exists misleads the reader it was drawn for, so it is not credited as documenting the shape.
README/code drift project/README.md:14— project/README.md links to `./RELEASE-CHECKLIST.md`, but `project/RELEASE-CHECKLIST.md` does not exist. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
No dependency-update automation REDACTED:5— `REDACTED` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
X2 · Cancellation propagation· Not all functions that make a request accept a context.Context · ×1
Not all functions that make a request accept a context.Context — Only 2/14 functions that make a cancellable request (net/http, net.Dial) accept a context.Context or pass one on, so a request keeps running after whatever wanted it has given up — a cancelled request, a shutdown, an expired deadline. Take `ctx context.Context` as the first parameter and build the request with it (`http.NewRequestWithContext`, `DialContext`); where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Outdated: github.com/cpuguy83/go-md2man/v2 — `github.com/cpuguy83/go-md2man/v2` is required at v2.0.4 in REDACTED, but v2.0.7 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/cpuguy83/go-md2man/v2@v2.0.7 && go mod tidy` and commit the updated REDACTED and go.sum.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1eb45-493a-7a3e-98a3-b0d1b10434a7 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 155 · Warnings: 1875 · Recommendations: 604 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 17-11-2026 @ 20:49 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.