Public report — etcd, published 6 Aug 2026. Concrete security findings (CVE IDs, secret matches, dependency versions) are hidden in this version; ask the repo owner for the full report.
Watchdog 06-08-2026 @ 05:40 UTC Public
Code Health Audit

Etcd-Io/etcd

No baseline yet — first run
68% Adequate
CriticalWeakAdequateStrongExemplary
upper third — near Strong

Medium · 80,983 LoC · rebuild ~1.6 person-years · weakest lens: Security (61%)

Grounded in facts. Every number here is computed, not narrated — reproducible, tool-backed, and traceable to a line of code. How to trust this ▸

25/27dimensions tool-verifieddeterministic · confidence 1.0 · 2 LLM-assisted, advisory
305findings with an exact file:lineof 321 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
27/95dimensions across the health lenses80983 LoC — wide & deep

Executive summary

Read through the Production lens — the standard calibration. *Green* means good enough to run in production. The score is absolute and comparable across repos.

etcd-io/etcd is sound in substance but carries real gaps (68%). It is not in crisis, but the issues below raise the cost of changing it — friction its consumers ultimately inherit.

It is strongest in Architecture (100%) — the structure is clean and changes stay contained. Readiness (81%) is solid too.

The area that most needs attention is Security (61%) — exposure to security and compliance incidents is elevated. Maturity (66%) is the next concern — onboarding is slow — key decisions and the architecture aren't written down, so contributors have to reverse-engineer the intent.

Leadership focus, highest impact first: 'Testing' section to the root README (Documentation (README)); Record significant decisions one document per decision (Architecture documentation); 9 Secret finding(s) (Secrets (history)).

For scale: Medium (~80,983 production lines); rebuilding it from scratch would take roughly ~1.6 person-years (~1–3 engineers). Approximate, ±~30%.

It builds on a genuinely strong Architecture foundation (100%); the priorities above are the highest-leverage way to bring the rest up to that level.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Security 61% · 47% weightMaturity 66% · 26% weightCode Health 77% · 14% weightReadiness 81% · 8% weightArchitecture 100% · 4% weight

Raise Security 61 → 70 (the Healthy floor) ⇒ headline 68 → ~71.

Code composition — where the lines go
Tests 100%
Rebuild cost & value ~ Modeled — €76,000–€380,000
Cost to rebuild€76,000–€380,000 (0.8–2.4 person-years (1,269–4,025 h), ~1–3 engineers)
Domain complexityStandard — harder problems cost more per line
Quality factor1.0× (at 68% quality) — the last 20% of quality is most of the work
Size & shapeMedium · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)

This codebase represents roughly ~1.6 person-years of build effort (about ~€230,000 to rebuild). Its weakest lens is Security at 61% — the part of that asset most exposed by the findings below.

How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.0) — standard service × a 1.0× quality factor, at €60–95/h; indicative, ±~30% · size measured directly from source · effort from total production LoC as straight-line logic (the tier split is a C#-only syntax walk), a conservative lower bound. Indicative only — most sensitive to the hourly rate and the domain tier (both tunable in config).

Top priorities

The highest-leverage moves; the full ranked list is in the Roadmap below.

1
Resolve the 9 Secret finding(s) in Secrets (history) — start with server.key.insecure (9).
+3.9 pts · Low effort · Secrets (history)
2
Add a 'Testing' section to the root README — how to run the test suite.
+5.0 pts · Medium effort · Documentation (README)
3
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).
+5.0 pts · Medium effort · Architecture documentation

Diagnosis — what's actually going on

The top fix pays for itself · High · Economics
The top-ranked fix costs roughly 1–3 engineer-days once. Not doing it costs about 3.2–21.1 engineer-days every year, paid as drag on the ~63,198 lines this team changes annually — a bill that arrives whether or not anyone books it. On those figures the fix breaks even in roughly 1–11 months and is free after that. Method, stated so this is not read as a quotation: debt from the ranked task's effort band; interest = annual changed lines (measured, annualised from the 90-day window) ÷ an ASSUMED 150–400 lines per engineer-day × the 2–5% drag implied by the code-quality signals; breaking point = debt ÷ annual interest. A modelled planning range built from measured inputs and one named assumption — not a quotation, a valuation, or a certified figure.
Evidence: D15 churn: 15,583 line(s) changed over a 90-day window ⇒ ~63,198/year · D1/D2/D4 code quality: averaging 7.3/10 ⇒ a 2–5% drag on each change · top-ranked remediation: Low effort ⇒ about 1–3 engineer-day(s)
→ Do the top-ranked fix now if this code will still be yours in 11 months.
Value concentrated against a weak lens · Medium · Value at risk
This is a Medium asset (~1.6 person-years to rebuild), and its weakest lens is Security at 61%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
Evidence: valuation: Medium, ~1.6 person-years rebuild (80,983 LoC) · weakest lens: Security 61%
→ Direct remediation budget at Security first — highest risk-reduction per euro on an asset this size.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Add a 'Testing' section to the root README — how to run the test suite. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Add a 'Testing' section to the root README — how to run the test suite.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 7.3/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 2–5% more than in clean code, and the tax compounds as the codebase grows. (A modelled estimate, not a measured fact.)
Evidence: D1/D2/D4 code quality: averaging 7.3/10 across the code-quality signals actually measured
→ Pay it down where churn is highest — the hotspots — not everywhere; that's where the tax is actually paid.

Architecture — module dependency matrix

130 modules, 501 dependencies — 2 dependency cycles, shown as the red cell(s) above the diagonal. Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)

…lient/pkg/v3/fileutil…d/client/pkg/v3/types…cd.io/etcd/pkg/v3/adt…cd/pkg/v3/featuregate….io/etcd/pkg/v3/proxy…io/etcd/pkg/v3/report…/etcd/pkg/v3/schedule…d.io/etcd/pkg/v3/wait…v3/etcdserver/version…client/v3/concurrency…/client/v3/kubernetes…etcd/client/v3/mirror…t/v3/naming/endpoints…o/etcd/server/v3/auth…ver/v3/etcdserver/api…tcdserver/api/v2store…/v3/etcdserver/cindex…/etcd/server/v3/lease…server/v3/storage/wal…dctl/v3/ctlv3/command…cdserver/api/etcdhttp…server/api/membership…tcd/server/v3/storage…erver/v3/storage/mvcc…r/v3/etcdserver/apply…ver/v3/storage/schema…/etcdserver/api/v3rpc…/server/v3/etcdserver…er/v3/storage/backend…d/etcdutl/v3/snapshot…cd/etcdutl/v3/etcdutl…3/etcdserver/api/snap…cdserver/api/rafthttp…lient/pkg/v3/testutil…/v3/internal/resolver…tcd.io/etcd/client/v3…etcd.io/etcd/cache/v3…cd/pkg/v3/grpctesting…/etcd/server/v3/embed…oxy/grpcproxy/adapter…lient/pkg/v3/fileutil1…d/client/pkg/v3/types2…cd.io/etcd/pkg/v3/adt3…cd/pkg/v3/featuregate4….io/etcd/pkg/v3/proxy5…io/etcd/pkg/v3/report6…/etcd/pkg/v3/schedule7…d.io/etcd/pkg/v3/wait8…v3/etcdserver/version9…client/v3/concurrency10…/client/v3/kubernetes11…etcd/client/v3/mirror12…t/v3/naming/endpoints13…o/etcd/server/v3/auth14…ver/v3/etcdserver/api15…tcdserver/api/v2store16…/v3/etcdserver/cindex17…/etcd/server/v3/lease18…server/v3/storage/wal19…dctl/v3/ctlv3/command20…cdserver/api/etcdhttp21…server/api/membership22…tcd/server/v3/storage23…erver/v3/storage/mvcc24…r/v3/etcdserver/apply25…ver/v3/storage/schema26…/etcdserver/api/v3rpc27…/server/v3/etcdserver28…er/v3/storage/backend29…d/etcdutl/v3/snapshot30…cd/etcdutl/v3/etcdutl31…3/etcdserver/api/snap32…cdserver/api/rafthttp33…lient/pkg/v3/testutil34…/v3/internal/resolver35…tcd.io/etcd/client/v336…etcd.io/etcd/cache/v337…cd/pkg/v3/grpctesting38…/etcd/server/v3/embed39…oxy/grpcproxy/adapter402576611115951145113362132141111210115157212211015252524224432222183424222962986261722124164212262246722221756585251972710692022516416424242244222221624242228422466202212416412226127121211221111181212111421123310811628221911212112211111812121114211233108116282242422442222216242422284224662016221241411121211221111181212111421123310811628225252244222221624242228422466251622124164510510551010555554051051055520105510151550405530104010+90 more modules (most-connected shown)

At a glance — Code Health · 77% · Strong

At a glance — Architecture · 100% · Exemplary

At a glance — Maturity · 66% · Adequate · gated by M2

At a glance — Readiness · 81% · Strong

At a glance — Security · 61% · Adequate · gated by D28, D36

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2021 — Security Misconfiguration32High / Critical
A02:2021 — Cryptographic Failures10High / Critical
A06:2021 — Vulnerable & Outdated Components1Medium

Roadmap

Begin by updating the root README to include a clear guide on how to run the test suite. Next, establish a centralized repository for architecture decisions, ensuring each is dated and outlines the context, decision, and consequences. Simultaneously, address the nine security findings related to secrets, starting with server.key.insecure. Continue by resolving the single network egress confinement issue and the twenty-two medium-severity IaC and container security findings, prioritizing etcd.yml, vulcand.yml, and the Dockerfile.

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

Do thisHelpsEffortDimension
Resolve the 9 Secret finding(s) in Secrets (history) — start with server.key.insecure (9).+3.9 ptsLowSecrets (history)
Add a 'Testing' section to the root README — how to run the test suite.+5.0 ptsMediumDocumentation (README)
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).+5.0 ptsMediumArchitecture documentation
Resolve the 1 No network policy finding(s) in Network Egress Confinement.+2.3 ptsLowNetwork Egress Confinement
Resolve the 1 The container images section claims these are not used to build the… finding(s) in Documentation Quality — start with README.md.+1.8 ptsLowDocumentation Quality
Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with server.go, store.go.+1.7 ptsLowKnowledge Freshness
Resolve the 1 No SBOM finding(s) in Supply-chain Provenance & Signing.+1.5 ptsLowSupply-chain Provenance & Signing
Resolve the 1 No artifact signing finding(s) in Supply-chain Provenance & Signing.+1.5 ptsLowSupply-chain Provenance & Signing

File quality

Per-file score 0–10 — a quality signature. Of 125 files carrying findings, judged against the Production bar: 2% slop · 56% mixed · 42% near-clean.

FileScoreBandWorst signal
hack/kubernetes-deploy/etcd.yml1.6SlopIaC & Container Security: High IaC: KSV-0014
Dockerfile2.2SlopIaC & Container Security: High IaC: DS-0002
hack/kubernetes-deploy/vulcand.yml3.1SlopIaC & Container Security: High IaC: KSV-0014
server/embed/etcd.go5.0MixedChange Coupling: Boundary-crossing change coupling: etcd.go ↔ etcd_features.go
server/storage/wal/wal.go7.0MixedCyclomatic Complexity: WAL.ReadAll (cyclomatic 26)
server/etcdserver/api/rafthttp/stream.go7.0MixedCyclomatic Complexity: streamWriter.run (cyclomatic 23)
server/etcdserver/server.go7.0MixedCyclomatic Complexity: EtcdServer.run (cyclomatic 17)
client/v3/watch.go7.0MixedCyclomatic Complexity: watchGRPCStream.run (cyclomatic 44)
server/etcdserver/v3_server.go7.0MixedCyclomatic Complexity: EtcdServer.LeaseRenew (cyclomatic 18)
pkg/proxy/server.go7.1MixedCyclomatic Complexity: server.ioCopy (cyclomatic 41)
etcdutl/snapshot/v3_snapshot.go7.1MixedCyclomatic Complexity: v3Manager.copyAndVerifyDB (cyclomatic 18)
server/embed/config.go7.1MixedCyclomatic Complexity: Config.Validate (cyclomatic 39)
server/etcdserver/api/membership/cluster.go7.1MixedCyclomatic Complexity: RaftCluster.ValidateConfigurationChange (cyclomatic 26)
etcdctl/ctlv3/command/check.go7.1MixedCyclomatic Complexity: command.newCheckDatascaleCommand (cyclomatic 18)
server/etcdserver/api/v3rpc/watch.go7.2MixedCyclomatic Complexity: serverWatchStream.sendLoop (cyclomatic 36)
client/pkg/transport/listener.go7.2MixedCyclomatic Complexity: TLSInfo.baseConfig (cyclomatic 35)
tools/check-grpc-experimental/main.go7.2MixedCyclomatic Complexity: main.checkFileForExperimental (cyclomatic 29)
server/embed/serve.go7.2MixedCyclomatic Complexity: serveCtx.serve (cyclomatic 28)
server/etcdserver/api/v3rpc/interceptor.go7.2MixedCyclomatic Complexity: v3rpc.logUnaryRequestStats (cyclomatic 24)
server/proxy/grpcproxy/lease.go7.2MixedCyclomatic Complexity: leaseProxy.LeaseKeepAlive (cyclomatic 16)

Methodology & how to trust this report

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

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

What we checked — 27 dimensions across the health lenses
D1D2D3D4D13D15D16D19D21D28D29D31D34D35D36D37D38D40D41M1M2M3M4P1P3P4P6

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

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 019fd596-9c0d-77b4-b685-fbccbeb45cdb.

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

Run transparency — what happened this run

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

  • D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity (jscpd) — it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D13 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D19 Documentation Quality: Documentation quality is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
  • D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (3): D19, D21, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score (documentation, ADR quality, naming, comment value, onboarding) — D25 sets the ADR-conformance fraction over sampled code, D22 judges API accuracy over a sample. These are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

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

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

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

Maturity: DocumentedVerifiedPrevented · effective 6.8 / 10 · rule-coverage 100% · ceiling Prevented

59 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was command.parseWatchArgs at 46. A further 3 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 uberApplier.dispatch at 34 — they are counted neither in the figure above nor in this dimension's score.

main.main (cyclomatic 19) · ×2tools/check-grpc-experimental/main.go:43
command.parseWatchArgs (cyclomatic 46)etcdctl/ctlv3/command/watch_command.go:200
watchGRPCStream.run (cyclomatic 44)client/v3/watch.go:512
server.ioCopy (cyclomatic 41)pkg/proxy/server.go:426
Config.Validate (cyclomatic 39)server/embed/config.go:942

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

What to do

  1. Resolve the 2 main.main (cyclomatic 19) finding(s) in Cyclomatic Complexity — start with main.go (2). — One of this dimension's main actionable groups (2 warning-level).
  2. Resolve the 1 command.parseWatchArgs (cyclomatic 46) finding(s) in Cyclomatic Complexity — start with watch_command.go. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 watchGRPCStream.run (cyclomatic 44) finding(s) in Cyclomatic Complexity — start with watch.go. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity5.2 / 10Adequate✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 5.2 / 10 · rule-coverage 100% · ceiling Prevented

131 method(s) exceeded the cognitive complexity threshold of 15; the worst was watchGRPCStream.run at 99.

watchGRPCStream.run (cognitive 99)client/v3/watch.go:512
serverWatchStream.sendLoop (cognitive 91)server/etcdserver/api/v3rpc/watch.go:411
Config.setupLogging (cognitive 81)server/embed/config_logging.go:46
raftNode.start (cognitive 81)server/etcdserver/raft.go:174
serverWatchStream.recvLoop (cognitive 80)server/etcdserver/api/v3rpc/watch.go:249

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

What to do

  1. Resolve the 1 watchGRPCStream.run (cognitive 99) finding(s) in Cognitive Complexity — start with watch.go. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 serverWatchStream.sendLoop (cognitive 91) finding(s) in Cognitive Complexity — start with watch.go. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Config.setupLogging (cognitive 81) finding(s) in Cognitive Complexity — start with config_logging.go. — One of this dimension's main actionable groups (1 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes9.2 / 10Exemplary✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 9.2 / 10 · rule-coverage 100% · ceiling Prevented

18 god class(es) detected.

FileTooLong: etcdserver/server.go · ×10server/etcdserver/server.go:0
TooManyMethods: EtcdServer · ×8server/etcdserver/server.go:208

✓ On the Gold path — maintain.

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

D4 · Code Duplication9.8 / 10Exemplary✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Verified

41 duplicated block group(s) detected.

Duplicated block (10 lines × 2) · ×8tools/etcd-dump-db/main.go:105
Duplicated block (11 lines × 2) · ×5tools/etcd-dump-db/main.go:84
Duplicated block (9 lines × 2) · ×5etcdctl/ctlv3/command/completion_command.go:70
Duplicated block (7 lines × 2) · ×5client/v3/maintenance.go:231
Duplicated block (12 lines × 2) · ×3server/etcdserver/api/v3discovery/discovery.go:279

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

✓ On the Gold path — maintain.

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

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

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

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

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D15 · Churn × Complexity Hotspots9.9 / 10Exemplary✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 9.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: server/storage/wal/wal.go (6×26=156); server/etcdserver/api/membership/cluster.go (5×26=130); server/etcdserver/server.go (7×17=119)

Hotspot: server/storage/wal/wal.go · ×10server/storage/wal/wal.go

✓ On the Gold path — maintain.

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

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

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

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

Maturity: DocumentedVerifiedPrevented · effective 9.5 / 10 · rule-coverage 100% · ceiling Documented

16 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pkg/adt/interval_tree.go.

Off-boarding risk: anonymized user #1 · ×3
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.

D19 · Documentation Quality / 10Strong◐ Sampled · advisory

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

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

Maturity: DocumentedVerifiedPrevented · effective Strong / 10 · rule-coverage 100% · ceiling Documented

etcd's documentation is comprehensive and well-structured: the README for each package (README.md, security/README.md, etcdutl/README.md) gives a clear description of its purpose plus usage examples. The architecture/design docs are sparse but present; the main document is Documentation/README.md that serves as an internal contributor guide directing users to the public etcd.io documentation site. There are no missing sections in any visible file despite the clipped body. The etcd project's documentation is comprehensive and well-structured across READMEs, architecture/design docs, and XML doc coverage. The main strengths are the detailed installation/usage sections for each tool (etcd-dump-db, benchmark), a dedicated robustness-testing document covering Antithesis integration with test setup, Docker Compose orchestration, and reproducible failure examples, and an alpha Prometheus-mixin README that is well-qualified despite its note. The architecture doc on red-black trees and the TLS/hack directories also contribute to clarity.

The container images section claims these are not used to build the project but does not link to the actual dependency-updating machinery or GitHub actions that do bump versions, leaving the reader unsure how this is integrated into the CI workflow.tools/container-images/README.md

What to do

  1. Resolve the 1 The container images section claims these are not used to build the… finding(s) in Documentation Quality — start with README.md. — One of this dimension's main actionable groups (1 recommendation-level).

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

D21 · Naming Consistency / 10Exemplary◐ Sampled · advisory

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

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

Maturity: DocumentedVerifiedPrevented · effective Exemplary / 10 · rule-coverage 100% · ceiling Verified

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

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

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

Method: Git-history secret scan via gitleaks detect over full history in an isolated checkout; each match flagged High. Exhaustive; degrades cleanly when tool absent.

Maturity: DocumentedVerifiedPrevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

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

Secret: private-key · ×9hack/scripts-dev/docker-dns/certs-common-name/server.key.insecure:1detected by gitleaks finding
Rotate the exposed credentials — git history can't be un-committed

What to do

  1. Resolve the 9 Secret finding(s) in Secrets (history) — start with server.key.insecure (9). — One of this dimension's main actionable groups (9 issue-level).
  2. Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).

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

D29 · Static Analysis (SAST)10.0 / 10Exemplary○ Nothing flagged

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

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

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

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

semgrep found no security issues.

✓ On the Gold path — maintain.

Detailed fixes: d29_recommendation.md.

D31 · IaC & Container Security4.5 / 10Weak✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 4.5 / 10 · rule-coverage 100% · ceiling Documented

71 finding(s): 0 critical, 5 high, 28 medium, 38 low.

High IaC: DS-0002 · ×3Dockerfiledetected by trivy finding
Medium IaC: KSV-0001 · ×22hack/kubernetes-deploy/etcd.ymldetected by trivy finding
Low IaC: DS-0005 · ×7Dockerfiledetected by trivy finding

What to do

  1. Resolve the 22 Medium IaC finding(s) in IaC & Container Security — start with etcd.yml (12), vulcand.yml (5), Dockerfile (5). — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 3 High IaC finding(s) in IaC & Container Security — start with Dockerfile, etcd.yml, vulcand.yml. — One of this dimension's main actionable groups (3 issue-level).
  3. Resolve the 7 Low IaC finding(s) in IaC & Container Security — start with etcd.yml (5), Dockerfile (2). — One of this dimension's main actionable groups (7 recommendation-level).

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

D34 · Knowledge Freshness7.1 / 10Strong✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 7.1 / 10 · rule-coverage 100% · ceiling Documented

86 of 305 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pkg/proxy/server.go.

Orphaned knowledge · ×2pkg/proxy/server.go
Further orphaned files (smaller)

What to do

  1. Resolve the 2 Orphaned knowledge finding(s) in Knowledge Freshness — start with server.go, store.go. — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling10.0 / 10Exemplary✓ Tool-verified

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

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

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling; coupling through a build step, config, or non-source file isn't seen.

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: etcd.go↔etcd_features.go 67%

Boundary-crossing change coupling: etcd.go ↔ etcd_features.goserver/embed/etcd.go

✓ On the Gold path — maintain.

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

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

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

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

Maturity: DocumentedVerifiedPrevented · effective 2.5 / 10 · rule-coverage 100% · ceiling Documented

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

No build provenance
No artifact signing
No SBOM

What to do

  1. Resolve the 1 No build provenance finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 No artifact signing finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 No SBOM finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 recommendation-level).

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

D37 · Vulnerability-disclosure Policy10.0 / 10Exemplary✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D38 · OSV Dependency Vulnerabilities9.8 / 10Exemplary✓ Tool-verified

What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.

Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.

Maturity: DocumentedVerifiedPrevented · effective 9.8 / 10 · rule-coverage 100% · ceiling Documented

1 finding(s): 0 critical, 0 high, 1 medium, 0 low.

Medium vulnerability: GO-2026-5932etcdutl/go.moddetected by osv-scanner finding

✓ On the Gold path — maintain.

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

D40 · Network Egress Confinement6.0 / 10Adequate✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

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

No network policy

What to do

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

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

D41 · Kernel & Syscall Confinement6.0 / 10Adequate✓ Tool-verified

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

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

Maturity: DocumentedVerifiedPrevented · effective 6.0 / 10 · rule-coverage 100% · ceiling Documented

0/2 syscall-confinement controls present (seccomp, AppArmor/SELinux).

No seccomp profile
No AppArmor/SELinux confinement

What to do

  1. Resolve the 1 No seccomp profile finding(s) in Kernel & Syscall Confinement. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 No AppArmor/SELinux confinement finding(s) in Kernel & Syscall Confinement. — One of this dimension's main actionable groups (1 recommendation-level).

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

Frontend & cross-cutting dimensions

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

M1 · Documentation (README)6.3 / 10Adequate✓ Tool-verified

Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.

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

  • 240 code files changed in the last 6 months but the README was not touched — it may no longer reflect the system.

What to do

  • Add a 'Testing' section to the root README — how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
  • Add a README to the 5 of 11 project(s) that lack one — worth up to 0.9 pts.
  • Review the README against recent changes; refresh the parts that drifted.
M2 · Architecture documentation3.0 / 10Weak✓ Tool-verified

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

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

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

What to do

  • Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree with `NNNN-title.md` names is the most discoverable form).
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the repo is organised deliberately — src/test separation and consistent project naming.

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

M4 · Documentation accuracy10.0 / 10Exemplary◐ Sampled · advisory

Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).

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

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

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

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

P3 · Security & performance tooling9.0 / 10Exemplary✓ Tool-verified

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

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

What to do

  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P4 · Deployment & Rollback10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

What to do

  • Stamp a version in your build/package manifest (e.g. csproj <Version>, package.json, pyproject.toml, Cargo.toml, or a VERSION file) or tag releases with semver so builds and releases are traceable.

Reference — by lens

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

LensScoreRatingImpact
Code Health77%StrongSolid.
Architecture100%ExemplaryStrongest area.
Maturity66%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness81%StrongSolid.
Security61%Adequate — gated by D28, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Not included — 68 check(s) not relevant to this codebase

These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — no DI registrations detected
  • AX10 Code composition — not assessed — code composition is computed by ROLE over a document set that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX2 Stateful singletons — no singleton implementations detected
  • AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX4 Dependency direction — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • D10 Test Quality — ~102631 lines of test source are present (.go) but the test-quality collector reads C# only, so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included
  • D12 Dependency Hygiene — Dependency hygiene not measured — dependency manifest found but not parsed for hygiene
  • D14 License Compliance — Not scored — this repository's package manifest is not parsed for licence data yet. A gap in the analyzer's language coverage, NOT a finding that the repository's licenses are compliant (a Go module (go.mod/go.sum)), which this pass does not parse yet — so this dimension asserts nothing about this repository's licensing in either direction.
  • D17 Explicit Debt — explicit-debt markers are read through a C# workspace today, so they were not read for this repository's language — this asserts nothing about how many markers the code carries. Not scored — this is a gap in the analyzer, not a finding about this repository
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D20 ADR Quality — N/A — ADRs are expected on deployable products with a user-facing host, not consumed libraries; no ADR log is required here.
  • D22 Internal API Consistency — No exposed public API
  • D23 Boundary Type-Coupling — Production source is present (.go) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
  • D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
  • D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Go module (go.mod/go.sum) — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
  • D32 Data Compliance (PII/GDPR) — No PII/GDPR-handling patterns detected (p/gdpr ruleset) — no data-compliance surface to assess.
  • D33 JS/npm Dependency Vulnerabilities — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
  • D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
  • D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is mostly .go, which this pass does not read, so cohesion was not assessed for this repository. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • 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
  • D9 Test Distribution — Test source is present (.go) but the test-pyramid classifier reads C# only, so its unit/integration/BDD/E2E split couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • DM1 Domain Modelling — applicable but not scored (2 of 2 signals for this style — below the bar we score at): 1 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit); 5 strongly-typed id(s)
  • ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this check looks for (6 event-sourced shape(s) (event folds / event-recording aggregates))
  • ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this check looks for (6 Go aggregate(s) recording domain events (own events-slice append / raise-record))
  • GD1 Unfinished & placeholder code — no source files
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
  • P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
  • P8 Schema migrations — not assessed — schema-migration practice is read from a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository

Appendix A — Findings (grouped)

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

Issue — 15 finding(s)
D28 · Secrets (history) · Secret · ×9
  • Secret: private-key hack/scripts-dev/docker-dns/certs-common-name/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-static-ip/certs-metrics-proxy/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-static-ip/certs/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns-srv/certs-gateway/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns-srv/certs-wildcard/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns-srv/certs/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns/certs-gateway/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns/certs-wildcard/server.key.insecure:1 — matched rule 'private-key'
  • Secret: private-key hack/scripts-dev/docker-dns/certs/server.key.insecure:1 — matched rule 'private-key'
D31 · IaC & Container Security · High IaC · ×3
  • High IaC: DS-0002 Dockerfile — Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: this image's final stage has no shell, no package manager and no `/etc/passwd`, so there is no account to create and a `USER` naming one would not resolve. Use the numeric form instead — `USER 65532:65532` before the entrypoint (65532 is the conventional nonroot uid) — and give that uid ownership of anything the process writes by copying it in with `COPY --chown=65532:65532` from the build stage, including any `VOLUME` path. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
  • High IaC: KSV-0014 hack/kubernetes-deploy/etcd.yml — Root file system is not read-only
  • High IaC: KSV-0014 hack/kubernetes-deploy/vulcand.yml — Root file system is not read-only
D34 · Knowledge Freshness · Orphaned knowledge · ×2
  • Orphaned knowledge pkg/proxy/server.go — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge server/etcdserver/api/v2store/store.go — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D35 · Change Coupling · Boundary-crossing change coupling · ×1
  • Boundary-crossing change coupling: etcd.go ↔ etcd_features.go server/embed/etcd.go — `server/embed/etcd.go` (context embed) and `server/features/etcd_features.go` (context features) sit in DIFFERENT parts of the tree yet change together 67% of the time (8 of the 12 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) — 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.
Warning — 282 finding(s)
D31 · IaC & Container Security · Medium IaC · ×22
  • Medium IaC: KSV-0001 hack/kubernetes-deploy/etcd.yml — Can elevate its own privileges
  • Medium IaC: KSV-0012 hack/kubernetes-deploy/etcd.yml — Runs as root user One securityContext edit clears this facet's near-duplicate rules together: KSV-0012, KSV-0020, KSV-0021.
  • Medium IaC: KSV-0013 hack/kubernetes-deploy/etcd.yml — Image tag ":latest" used
  • Medium IaC: KSV-0104 hack/kubernetes-deploy/etcd.yml — Seccomp policies disabled One securityContext edit clears this facet's near-duplicate rules together: KSV-0030, KSV-0104.
  • Medium IaC: KSV-0125 hack/kubernetes-deploy/etcd.yml — Restrict container images to trusted registries
  • Medium IaC: KSV-0001 hack/kubernetes-deploy/vulcand.yml — Can elevate its own privileges
  • Medium IaC: KSV-0012 hack/kubernetes-deploy/vulcand.yml — Runs as root user One securityContext edit clears this facet's near-duplicate rules together: KSV-0012, KSV-0020, KSV-0021.
  • Medium IaC: KSV-0104 hack/kubernetes-deploy/vulcand.yml — Seccomp policies disabled One securityContext edit clears this facet's near-duplicate rules together: KSV-0030, KSV-0104.
  • Medium IaC: KSV-0125 hack/kubernetes-deploy/vulcand.yml — Restrict container images to trusted registries
  • Medium IaC: CKV_K8S_37 hack/kubernetes-deploy/vulcand.yml:2 — Minimize the admission of containers with capabilities assigned
  • Medium IaC: CKV_K8S_21 hack/kubernetes-deploy/etcd.yml:2 — The default namespace should not be used
  • Medium IaC: CKV_K8S_37 hack/kubernetes-deploy/etcd.yml:15 — Minimize the admission of containers with capabilities assigned
  • Medium IaC: CKV_K8S_21 hack/kubernetes-deploy/etcd.yml:51 — The default namespace should not be used
  • Medium IaC: CKV_K8S_37 hack/kubernetes-deploy/etcd.yml:70 — Minimize the admission of containers with capabilities assigned
  • Medium IaC: CKV_K8S_21 hack/kubernetes-deploy/etcd.yml:106 — The default namespace should not be used
  • Medium IaC: CKV_K8S_37 hack/kubernetes-deploy/etcd.yml:125 — Minimize the admission of containers with capabilities assigned
  • Medium IaC: CKV_K8S_21 hack/kubernetes-deploy/etcd.yml:161 — The default namespace should not be used
  • Medium IaC: CKV_DOCKER_3 tools/container-images/devcontainer/Dockerfile:1 — Ensure that a user for the container has been created
  • Medium IaC: CKV_DOCKER_4 Dockerfile:7 — Ensure that COPY is used instead of ADD in Dockerfiles
  • Medium IaC: CKV_DOCKER_4 Dockerfile:8 — Ensure that COPY is used instead of ADD in Dockerfiles
  • Medium IaC: CKV_DOCKER_4 Dockerfile:9 — Ensure that COPY is used instead of ADD in Dockerfiles
  • Medium IaC: CKV_DOCKER_3 Dockerfile:1 — Ensure that a user for the container has been created
D15 · Churn × Complexity Hotspots · Hotspot · ×10
  • Hotspot: server/storage/wal/wal.go server/storage/wal/wal.go — server/storage/wal/wal.go changed 6 times in last 90 days, max complexity 26. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: server/etcdserver/api/membership/cluster.go server/etcdserver/api/membership/cluster.go — server/etcdserver/api/membership/cluster.go changed 5 times in last 90 days, max complexity 26. 1 of those changes was a fix/bug commit, and the other 4 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
  • Hotspot: server/etcdserver/server.go server/etcdserver/server.go — server/etcdserver/server.go changed 7 times in last 90 days, max complexity 17. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: server/etcdserver/api/rafthttp/stream.go server/etcdserver/api/rafthttp/stream.go — server/etcdserver/api/rafthttp/stream.go changed 5 times in last 90 days, max complexity 23. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: server/etcdserver/api/v3rpc/watch.go server/etcdserver/api/v3rpc/watch.go — server/etcdserver/api/v3rpc/watch.go changed 3 times in last 90 days, max complexity 36. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
  • Hotspot: server/etcdserver/raft.go server/etcdserver/raft.go — server/etcdserver/raft.go changed 3 times in last 90 days, max complexity 31. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: server/etcdserver/v3_server.go server/etcdserver/v3_server.go — server/etcdserver/v3_server.go changed 3 times in last 90 days, max complexity 31. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
  • Hotspot: tools/etcd-dump-logs/main.go tools/etcd-dump-logs/main.go — tools/etcd-dump-logs/main.go changed 5 times in last 90 days, max complexity 17. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: etcdutl/snapshot/v3_snapshot.go etcdutl/snapshot/v3_snapshot.go — etcdutl/snapshot/v3_snapshot.go changed 4 times in last 90 days, max complexity 18. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
  • Hotspot: etcdctl/ctlv3/command/get_command.go etcdctl/ctlv3/command/get_command.go — etcdctl/ctlv3/command/get_command.go changed 2 times in last 90 days, max complexity 32. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
D3 · God Classes · FileTooLong · ×10
  • FileTooLong: etcdserver/server.go server/etcdserver/server.go:0 — FileTooLong — 1448 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: etcdserver/v3_server.go server/etcdserver/v3_server.go:0 — FileTooLong — 817 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: embed/config.go server/embed/config.go:0 — FileTooLong — 781 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: auth/store.go server/auth/store.go:0 — FileTooLong — 741 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: proxy/server.go pkg/proxy/server.go:0 — FileTooLong — 656 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: wal/wal.go server/storage/wal/wal.go:0 — FileTooLong — 629 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: v3/watch.go client/v3/watch.go:0 — FileTooLong — 619 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: embed/etcd.go server/embed/etcd.go:0 — FileTooLong — 605 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: membership/cluster.go server/etcdserver/api/membership/cluster.go:0 — FileTooLong — 590 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: etcdserver/bootstrap.go server/etcdserver/bootstrap.go:0 — FileTooLong — 512 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
D3 · God Classes · TooManyMethods · ×8
  • TooManyMethods: EtcdServer server/etcdserver/server.go:208 — TooManyMethods — 161 methods, declared across 5 files: etcdserver/server.go (103), etcdserver/v3_server.go (47), etcdserver/interface.go (7), etcdserver/corrupt.go (3), +1 more file(s). That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: authStore server/auth/store.go:244 — TooManyMethods — 39 methods, declared across 2 files: auth/store.go (37), auth/range_perm_cache.go (2). That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. Most of these members implement auth.AuthStore (31 of 39 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: simplePrinter etcdctl/ctlv3/command/printer_simple.go:30 — TooManyMethods — 37 methods. Most of these members implement command.printer (37 of 37 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: Op client/v3/op.go:32 — TooManyMethods — 35 methods. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: RaftCluster server/etcdserver/api/membership/cluster.go:43 — TooManyMethods — 35 methods. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: printerRPC etcdctl/ctlv3/command/printer.go:94 — TooManyMethods — 34 methods. Most of these members implement command.printer (34 of 34 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: server pkg/proxy/server.go:143 — TooManyMethods — 34 methods. Most of these members implement proxy.Server (30 of 34 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
  • TooManyMethods: applierV3backend server/etcdserver/apply/backend.go:36 — TooManyMethods — 31 methods. Most of these members implement apply.applierV3 (30 of 31 members), so moving them onto a smaller type would remove them from that contract rather than reduce it. To reduce it, split the contract instead: give each cohesive group of operations its own smaller interface and its own implementing type. Where the contract has to stay whole, move the work behind these members into collaborator types, so what is left here is a forward per member rather than a responsibility per member.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×8
  • Duplicated block (10 lines × 2) tools/etcd-dump-db/main.go:105 — tools/etcd-dump-db/main.go:105-114 | tools/etcd-dump-db/main.go:123-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 `tools/etcd-dump-db/main.go:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 2) client/v3/concurrency/mutex.go:54 — client/v3/concurrency/mutex.go:54-63 | client/v3/concurrency/mutex.go:77-86 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) etcdctl/ctlv3/command/downgrade_command.go:80 — etcdctl/ctlv3/command/downgrade_command.go:80-89 | etcdctl/ctlv3/command/downgrade_command.go:106-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) etcdctl/ctlv3/command/elect_command.go:110 — etcdctl/ctlv3/command/elect_command.go:110-119 | etcdctl/ctlv3/command/lock_command.go:83-92 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `etcdctl/ctlv3/command/elect_command.go:110` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10 lines × 2) pkg/adt/interval_tree.go:293 — pkg/adt/interval_tree.go:293-303 | pkg/adt/interval_tree.go:656-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/adt/interval_tree.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 (10 lines × 2) server/storage/schema/membership.go:193 — server/storage/schema/membership.go:193-202 | server/storage/schema/membership.go:213-223 — both copies are in the same file, so extract the 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 `server/storage/schema/membership.go:193` 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) tools/rw-heatmaps/pkg/chart/heatmaps.go:137 — tools/rw-heatmaps/pkg/chart/heatmaps.go:137-146 | tools/rw-heatmaps/pkg/chart/heatmaps.go:219-228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/rw-heatmaps/pkg/chart/heatmaps.go:137` 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) tools/rw-heatmaps/pkg/chart/line_chart.go:188 — tools/rw-heatmaps/pkg/chart/line_chart.go:188-197 | tools/rw-heatmaps/pkg/chart/line_chart.go:202-211 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×5
  • Duplicated block (11 lines × 2) tools/etcd-dump-db/main.go:84 — tools/etcd-dump-db/main.go:84-94 | tools/etcd-dump-db/main.go:144-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/etcd-dump-db/main.go:84` it begins part-way through the construct above it, so those 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/v3/experimental/recipes/priority_queue.go:69 — client/v3/experimental/recipes/priority_queue.go:69-79 | client/v3/experimental/recipes/queue.go:66-76 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. 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) client/v3/kubernetes/client.go:88 — client/v3/kubernetes/client.go:88-100 | client/v3/kubernetes/client.go:114-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `client/v3/kubernetes/client.go:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) server/lease/leasehttp/http.go:81 — server/lease/leasehttp/http.go:81-91 | server/lease/leasehttp/http.go:112-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/lease/leasehttp/http.go:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) server/proxy/grpcproxy/lease.go:64 — server/proxy/grpcproxy/lease.go:64-74 | server/proxy/grpcproxy/watch.go:66-76 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `server/proxy/grpcproxy/lease.go:64` 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×5
  • Duplicated block (9 lines × 2) etcdctl/ctlv3/command/completion_command.go:70 — etcdctl/ctlv3/command/completion_command.go:70-78 | etcdutl/etcdutl/completion_commmand.go:70-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `etcdctl/ctlv3/command/completion_command.go:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) etcdctl/ctlv3/command/elect_command.go:69 — etcdctl/ctlv3/command/elect_command.go:69-77 | etcdctl/ctlv3/command/elect_command.go:103-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.
  • Duplicated block (9 lines × 2) etcdctl/ctlv3/command/member_command.go:188 — etcdctl/ctlv3/command/member_command.go:188-196 | etcdctl/ctlv3/command/member_command.go:251-259 — both copies are in the same file, so extract the 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 `etcdctl/ctlv3/command/member_command.go:188` it begins part-way through the construct above it, so those 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) server/etcdserver/server.go:1461 — server/etcdserver/server.go:1461-1469 | server/etcdserver/v3_server.go:671-680 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `server/etcdserver/server.go:1461` 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 (9 lines × 2) server/etcdserver/v3_server.go:892 — server/etcdserver/v3_server.go:892-900 | server/etcdserver/v3_server.go:917-925 — both copies are in the same file, so extract the 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 `server/etcdserver/v3_server.go:892` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×5
  • Duplicated block (7 lines × 2) client/v3/maintenance.go:231 — client/v3/maintenance.go:231-237 | client/v3/maintenance.go:274-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) etcdctl/ctlv3/command/check.go:191 — etcdctl/ctlv3/command/check.go:191-197 | etcdctl/ctlv3/command/check.go:373-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 `etcdctl/ctlv3/command/check.go:191` 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) server/etcdserver/api/rafthttp/http.go:107 — server/etcdserver/api/rafthttp/http.go:107-113 | server/etcdserver/api/rafthttp/http.go:215-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/etcdserver/api/rafthttp/http.go:107` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) server/etcdserver/corrupt.go:137 — server/etcdserver/corrupt.go:137-143 | server/etcdserver/corrupt.go:148-154 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/etcdserver/corrupt.go:137` it begins part-way through the construct above it, so those 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) tools/rw-heatmaps/pkg/chart/heatmaps.go:279 — tools/rw-heatmaps/pkg/chart/heatmaps.go:279-285 | tools/rw-heatmaps/pkg/chart/heatmaps.go:305-311 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×3
  • Duplicated block (12 lines × 2) server/etcdserver/api/v3discovery/discovery.go:279 — server/etcdserver/api/v3discovery/discovery.go:279-290 | server/etcdserver/api/v3discovery/discovery.go:386-397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/etcdserver/api/v3discovery/discovery.go:279` it begins part-way through the construct above it, so those 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) server/etcdserver/cluster_util.go:265 — server/etcdserver/cluster_util.go:265-276 | server/etcdserver/cluster_util.go:405-416 — both copies are in the same file, so extract the 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 `server/etcdserver/cluster_util.go:265` it begins part-way through the construct above it, so those 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) tools/rw-heatmaps/pkg/chart/heatmaps.go:93 — tools/rw-heatmaps/pkg/chart/heatmaps.go:93-105 | tools/rw-heatmaps/pkg/chart/heatmaps.go:172-183 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `tools/rw-heatmaps/pkg/chart/heatmaps.go:93` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×3
  • Duplicated block (8 lines × 2) server/etcdserver/api/rafthttp/stream.go:198 — server/etcdserver/api/rafthttp/stream.go:198-205 | server/etcdserver/api/rafthttp/stream.go:227-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) server/etcdserver/api/v3election/election.go:61 — server/etcdserver/api/v3election/election.go:61-68 | server/etcdserver/api/v3election/election.go:111-118 — both copies are in the same file, so extract the block into 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) server/etcdserver/api/v3rpc/interceptor.go:191 — server/etcdserver/api/v3rpc/interceptor.go:191-198 | server/etcdserver/api/v3rpc/interceptor.go:207-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 `server/etcdserver/api/v3rpc/interceptor.go:191` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×3
  • Duplicated block (6 lines × 2) etcdctl/ctlv3/command/printer_fields.go:93 — etcdctl/ctlv3/command/printer_fields.go:93-98 | etcdctl/ctlv3/command/printer_simple.go:68-73 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `etcdctl/ctlv3/command/printer_fields.go:93` 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) server/etcdserver/api/membership/cluster.go:563 — server/etcdserver/api/membership/cluster.go:563-568 | server/etcdserver/api/membership/cluster.go:572-577 — both copies are in the same file, so extract the 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 `server/etcdserver/api/membership/cluster.go:563` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) server/etcdserver/api/rafthttp/remote.go:64 — server/etcdserver/api/rafthttp/remote.go:64-69 | server/etcdserver/api/rafthttp/remote.go:75-80 — both copies are in the same file, so extract the 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 `server/etcdserver/api/rafthttp/remote.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. 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.
D1 · Cyclomatic Complexity · main.main (cyclomatic 19) · ×2
  • main.main (cyclomatic 19) tools/check-grpc-experimental/main.go:43 — main.main has cyclomatic complexity 19 (threshold 15). Of this number, 11 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.
  • main.main (cyclomatic 19) tools/etcd-dump-metrics/main.go:43 — main.main has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×2
  • Duplicated block (14 lines × 2) server/proxy/grpcproxy/lease.go:162 — server/proxy/grpcproxy/lease.go:162-175 | server/proxy/grpcproxy/watch.go:113-129 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `server/proxy/grpcproxy/lease.go:162` it begins part-way through the construct above it, so those 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) server/storage/wal/wal.go:649 — server/storage/wal/wal.go:649-662 | server/storage/wal/wal.go:723-736 — both copies are in the same file, so extract the 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 `server/storage/wal/wal.go:649` 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×2
  • Duplicated block (13 lines × 2) server/auth/store.go:625 — server/auth/store.go:625-637 | server/auth/store.go:738-750 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/auth/store.go:625` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) server/etcdserver/cluster_util.go:245 — server/etcdserver/cluster_util.go:245-257 | server/etcdserver/cluster_util.go:385-397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `server/etcdserver/cluster_util.go:245` 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.
D1 · Cyclomatic Complexity · command.parseWatchArgs (cyclomatic 46) · ×1
  • command.parseWatchArgs (cyclomatic 46) etcdctl/ctlv3/command/watch_command.go:200 — command.parseWatchArgs has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · watchGRPCStream.run (cyclomatic 44) · ×1
  • watchGRPCStream.run (cyclomatic 44) client/v3/watch.go:512 — watchGRPCStream.run has cyclomatic complexity 44 (threshold 15). Of this number, 38 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.
D1 · Cyclomatic Complexity · server.ioCopy (cyclomatic 41) · ×1
  • server.ioCopy (cyclomatic 41) pkg/proxy/server.go:426 — server.ioCopy has cyclomatic complexity 41 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · Config.Validate (cyclomatic 39) · ×1
  • Config.Validate (cyclomatic 39) server/embed/config.go:942 — Config.Validate has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · serverWatchStream.sendLoop (cyclomatic 36) · ×1
  • serverWatchStream.sendLoop (cyclomatic 36) server/etcdserver/api/v3rpc/watch.go:411 — serverWatchStream.sendLoop has cyclomatic complexity 36 (threshold 15). Of this number, 33 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.
D1 · Cyclomatic Complexity · TLSInfo.baseConfig (cyclomatic 35) · ×1
  • TLSInfo.baseConfig (cyclomatic 35) client/pkg/transport/listener.go:368 — TLSInfo.baseConfig has cyclomatic complexity 35 (threshold 15). Of this number, 23 points are the body's own statements and 12 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.
D1 · Cyclomatic Complexity · serverWatchStream.recvLoop (cyclomatic 34) · ×1
  • serverWatchStream.recvLoop (cyclomatic 34) server/etcdserver/api/v3rpc/watch.go:249 — serverWatchStream.recvLoop has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · command.getGetOp (cyclomatic 32) · ×1
  • command.getGetOp (cyclomatic 32) etcdctl/ctlv3/command/get_command.go:122 — command.getGetOp has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · embed.configureClientListeners (cyclomatic 31) · ×1
  • embed.configureClientListeners (cyclomatic 31) server/embed/etcd.go:645 — embed.configureClientListeners has cyclomatic complexity 31 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Config.setupLogging (cyclomatic 31) · ×1
  • Config.setupLogging (cyclomatic 31) server/embed/config_logging.go:46 — Config.setupLogging has cyclomatic complexity 31 (threshold 15). Of this number, 28 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.
D1 · Cyclomatic Complexity · raftNode.start (cyclomatic 31) · ×1
  • raftNode.start (cyclomatic 31) server/etcdserver/raft.go:174 — raftNode.start has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 177). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · main.checkFileForExperimental (cyclomatic 29) · ×1
  • main.checkFileForExperimental (cyclomatic 29) tools/check-grpc-experimental/main.go:220 — main.checkFileForExperimental has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 9 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 255). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · configYAML.configFromFile (cyclomatic 29) · ×1
  • configYAML.configFromFile (cyclomatic 29) server/embed/config.go:782 — configYAML.configFromFile has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · serveCtx.serve (cyclomatic 28) · ×1
  • serveCtx.serve (cyclomatic 28) server/embed/serve.go:119 — serveCtx.serve has cyclomatic complexity 28 (threshold 15). Of this number, 26 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.
D1 · Cyclomatic Complexity · cmd.rangeFunc (cyclomatic 27) · ×1
  • cmd.rangeFunc (cyclomatic 27) tools/benchmark/cmd/range.go:71 — cmd.rangeFunc has cyclomatic complexity 27 (threshold 15). Of this number, 22 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.
D1 · Cyclomatic Complexity · server.listenAndServe (cyclomatic 27) · ×1
  • server.listenAndServe (cyclomatic 27) pkg/proxy/server.go:285 — server.listenAndServe has cyclomatic complexity 27 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · clientv3.newClient (cyclomatic 26) · ×1
  • clientv3.newClient (cyclomatic 26) client/v3/client.go:362 — clientv3.newClient has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RaftCluster.ValidateConfigurationChange (cyclomatic 26) · ×1
  • RaftCluster.ValidateConfigurationChange (cyclomatic 26) server/etcdserver/api/membership/cluster.go:306 — RaftCluster.ValidateConfigurationChange has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WAL.ReadAll (cyclomatic 26) · ×1
  • WAL.ReadAll (cyclomatic 26) server/storage/wal/wal.go:472 — WAL.ReadAll has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.printRec (cyclomatic 25) · ×1
  • main.printRec (cyclomatic 25) tools/etcd-dump-logs/raw.go:87 — main.printRec has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.main (cyclomatic 24) · ×1
  • main.main (cyclomatic 24) tools/local-tester/bridge/bridge.go:196 — main.main has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · command.makeMirror (cyclomatic 24) · ×1
  • command.makeMirror (cyclomatic 24) etcdctl/ctlv3/command/make_mirror_command.go:142 — command.makeMirror 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.
D1 · Cyclomatic Complexity · v3rpc.logUnaryRequestStats (cyclomatic 24) · ×1
  • v3rpc.logUnaryRequestStats (cyclomatic 24) server/etcdserver/api/v3rpc/interceptor.go:91 — v3rpc.logUnaryRequestStats has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · streamWriter.run (cyclomatic 23) · ×1
  • streamWriter.run (cyclomatic 23) server/etcdserver/api/rafthttp/stream.go:160 — streamWriter.run has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · etcdmain.startEtcdOrProxyV2 (cyclomatic 22) · ×1
  • etcdmain.startEtcdOrProxyV2 (cyclomatic 22) server/etcdmain/etcd.go:43 — etcdmain.startEtcdOrProxyV2 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.
D1 · Cyclomatic Complexity · embed.StartEtcd (cyclomatic 21) · ×1
  • embed.StartEtcd (cyclomatic 21) server/embed/etcd.go:110 — embed.StartEtcd has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 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.
D1 · Cyclomatic Complexity · v3rpc.checkIntervals (cyclomatic 21) · ×1
  • v3rpc.checkIntervals (cyclomatic 21) server/etcdserver/api/v3rpc/key.go:236 — v3rpc.checkIntervals has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.parse (cyclomatic 20) · ×1
  • main.parse (cyclomatic 20) tools/etcd-dump-metrics/metrics.go:122 — main.parse has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · watchGRPCStream.serveSubstream (cyclomatic 20) · ×1
  • watchGRPCStream.serveSubstream (cyclomatic 20) client/v3/watch.go:789 — watchGRPCStream.serveSubstream has cyclomatic complexity 20 (threshold 15). Of this number, 17 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.
D1 · Cyclomatic Complexity · leaseHandler.ServeHTTP (cyclomatic 20) · ×1
  • leaseHandler.ServeHTTP (cyclomatic 20) server/lease/leasehttp/http.go:58 — leaseHandler.ServeHTTP has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wal.Verify (cyclomatic 20) · ×1
  • wal.Verify (cyclomatic 20) server/storage/wal/wal.go:704 — wal.Verify has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · msgAppV2Encoder.encode (cyclomatic 19) · ×1
  • msgAppV2Encoder.encode (cyclomatic 19) server/etcdserver/api/rafthttp/msgappv2_codec.go:87 — msgAppV2Encoder.encode has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · wal.Create (cyclomatic 19) · ×1
  • wal.Create (cyclomatic 19) server/storage/wal/wal.go:101 — wal.Create has cyclomatic complexity 19 (threshold 15). Of this number, 17 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.
D1 · Cyclomatic Complexity · Cache.Watch (cyclomatic 18) · ×1
  • Cache.Watch (cyclomatic 18) cache/cache.go:116 — Cache.Watch has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 143). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · command.newCheckDatascaleCommand (cyclomatic 18) · ×1
  • command.newCheckDatascaleCommand (cyclomatic 18) etcdctl/ctlv3/command/check.go:315 — command.newCheckDatascaleCommand has cyclomatic complexity 18 (threshold 15). 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: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · command.epHealthCommandFunc (cyclomatic 18) · ×1
  • command.epHealthCommandFunc (cyclomatic 18) etcdctl/ctlv3/command/ep_command.go:95 — command.epHealthCommandFunc has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 118). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · v3Manager.copyAndVerifyDB (cyclomatic 18) · ×1
  • v3Manager.copyAndVerifyDB (cyclomatic 18) etcdutl/snapshot/v3_snapshot.go:436 — v3Manager.copyAndVerifyDB has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · EtcdServer.LeaseRenew (cyclomatic 18) · ×1
  • EtcdServer.LeaseRenew (cyclomatic 18) server/etcdserver/v3_server.go:488 — EtcdServer.LeaseRenew has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · main.readUsingReadAll (cyclomatic 17) · ×1
  • main.readUsingReadAll (cyclomatic 17) tools/etcd-dump-logs/main.go:116 — main.readUsingReadAll has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Election.observe (cyclomatic 17) · ×1
  • Election.observe (cyclomatic 17) client/v3/concurrency/election.go:173 — Election.observe has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · command.newCheckPerfCommand (cyclomatic 17) · ×1
  • command.newCheckPerfCommand (cyclomatic 17) etcdctl/ctlv3/command/check.go:143 — command.newCheckPerfCommand has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 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.
D1 · Cyclomatic Complexity · v3Manager.Status (cyclomatic 17) · ×1
  • v3Manager.Status (cyclomatic 17) etcdutl/snapshot/v3_snapshot.go:118 — v3Manager.Status has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 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.
D1 · Cyclomatic Complexity · EtcdServer.run (cyclomatic 17) · ×1
  • EtcdServer.run (cyclomatic 17) server/etcdserver/server.go:755 — EtcdServer.run has cyclomatic complexity 17 (threshold 15). Of this number, 9 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.
D1 · Cyclomatic Complexity · watcher.send (cyclomatic 17) · ×1
  • watcher.send (cyclomatic 17) server/proxy/grpcproxy/watcher.go:55 — watcher.send has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · decoder.decodeRecord (cyclomatic 17) · ×1
  • decoder.decodeRecord (cyclomatic 17) server/storage/wal/decoder.go:88 — decoder.decodeRecord has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · cmd.stmFunc (cyclomatic 16) · ×1
  • cmd.stmFunc (cyclomatic 16) tools/benchmark/cmd/stm.go:72 — cmd.stmFunc has cyclomatic complexity 16 (threshold 15). 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, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · watcher.Watch (cyclomatic 16) · ×1
  • watcher.Watch (cyclomatic 16) client/v3/watch.go:304 — watcher.Watch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · v3Manager.Restore (cyclomatic 16) · ×1
  • v3Manager.Restore (cyclomatic 16) etcdutl/snapshot/v3_snapshot.go:257 — v3Manager.Restore has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · accessController.ServeHTTP (cyclomatic 16) · ×1
  • accessController.ServeHTTP (cyclomatic 16) server/embed/serve.go:446 — accessController.ServeHTTP has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · etcdmain.startGateway (cyclomatic 16) · ×1
  • etcdmain.startGateway (cyclomatic 16) server/etcdmain/gateway.go:93 — etcdmain.startGateway has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · etcdmain.checkArgs (cyclomatic 16) · ×1
  • etcdmain.checkArgs (cyclomatic 16) server/etcdmain/grpc_proxy.go:292 — etcdmain.checkArgs has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · streamReader.dial (cyclomatic 16) · ×1
  • streamReader.dial (cyclomatic 16) server/etcdserver/api/rafthttp/stream.go:569 — streamReader.dial has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · apply.checkTxnReqsPermission (cyclomatic 16) · ×1
  • apply.checkTxnReqsPermission (cyclomatic 16) server/etcdserver/apply/auth.go:140 — apply.checkTxnReqsPermission has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EtcdServer.applyConfChange (cyclomatic 16) · ×1
  • EtcdServer.applyConfChange (cyclomatic 16) server/etcdserver/server.go:1996 — EtcdServer.applyConfChange has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · EtcdServer.rangeStream (cyclomatic 16) · ×1
  • EtcdServer.rangeStream (cyclomatic 16) server/etcdserver/v3_server.go:197 — EtcdServer.rangeStream has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · leaseProxy.LeaseKeepAlive (cyclomatic 16) · ×1
  • leaseProxy.LeaseKeepAlive (cyclomatic 16) server/proxy/grpcproxy/lease.go:137 — leaseProxy.LeaseKeepAlive has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 3 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.
D1 · Cyclomatic Complexity · WAL.cut (cyclomatic 16) · ×1
  • WAL.cut (cyclomatic 16) server/storage/wal/wal.go:785 — WAL.cut has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · watchGRPCStream.run (cognitive 99) · ×1
  • watchGRPCStream.run (cognitive 99) client/v3/watch.go:512 — watchGRPCStream.run has cognitive complexity 99 (threshold 15). Drivers by points: if/else 83, match/switch 8, boolean chains 4, loops 4 (nesting depth added 64). Of this number, 91 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.
D2 · Cognitive Complexity · serverWatchStream.sendLoop (cognitive 91) · ×1
  • serverWatchStream.sendLoop (cognitive 91) server/etcdserver/api/v3rpc/watch.go:411 — serverWatchStream.sendLoop has cognitive complexity 91 (threshold 15). Drivers by points: if/else 67, loops 15, boolean chains 7, match/switch 2 (nesting depth added 55). Of this number, 87 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.
D2 · Cognitive Complexity · Config.setupLogging (cognitive 81) · ×1
  • Config.setupLogging (cognitive 81) server/embed/config_logging.go:46 — Config.setupLogging has cognitive complexity 81 (threshold 15). Drivers by points: if/else 65, loops 12, match/switch 4 (nesting depth added 50). Of this number, 73 points are the body's own statements and 8 belong to one function literal inside it that branches. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · raftNode.start (cognitive 81) · ×1
  • raftNode.start (cognitive 81) server/etcdserver/raft.go:174 — raftNode.start has cognitive complexity 81 (threshold 15). Drivers by points: if/else 62, match/switch 14, loops 4, boolean chains 1 (nesting depth added 54). Most of this is not in the body itself: 0 of the 81 points are its own statements and the rest belongs to one function literal inside it that branches (line 177). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · serverWatchStream.recvLoop (cognitive 80) · ×1
  • serverWatchStream.recvLoop (cognitive 80) server/etcdserver/api/v3rpc/watch.go:249 — serverWatchStream.recvLoop has cognitive complexity 80 (threshold 15). Drivers by points: if/else 56, match/switch 22, boolean chains 1, loops 1 (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · command.parseWatchArgs (cognitive 73) · ×1
  • command.parseWatchArgs (cognitive 73) etcdctl/ctlv3/command/watch_command.go:200 — command.parseWatchArgs has cognitive complexity 73 (threshold 15). Drivers by points: if/else 56, loops 10, boolean chains 7 (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.
D2 · Cognitive Complexity · server.ioCopy (cognitive 73) · ×1
  • server.ioCopy (cognitive 73) pkg/proxy/server.go:426 — server.ioCopy has cognitive complexity 73 (threshold 15). Drivers by points: match/switch 42, if/else 30, loops 1 (nesting depth added 45). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · server.listenAndServe (cognitive 63) · ×1
  • server.listenAndServe (cognitive 63) pkg/proxy/server.go:285 — server.listenAndServe has cognitive complexity 63 (threshold 15). Drivers by points: match/switch 43, if/else 19, loops 1 (nesting depth added 43). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · main.checkFileForExperimental (cognitive 61) · ×1
  • main.checkFileForExperimental (cognitive 61) tools/check-grpc-experimental/main.go:220 — main.checkFileForExperimental has cognitive complexity 61 (threshold 15). Drivers by points: if/else 44, loops 8, match/switch 5, boolean chains 4 (nesting depth added 35). Of this number, 17 points are the body's own statements and 44 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RaftCluster.ValidateConfigurationChange (cognitive 58) · ×1
  • RaftCluster.ValidateConfigurationChange (cognitive 58) server/etcdserver/api/membership/cluster.go:306 — RaftCluster.ValidateConfigurationChange has cognitive complexity 58 (threshold 15). Drivers by points: if/else 39, loops 17, boolean chains 1, match/switch 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · serveCtx.serve (cognitive 54) · ×1
  • serveCtx.serve (cognitive 54) server/embed/serve.go:119 — serveCtx.serve has cognitive complexity 54 (threshold 15). Drivers by points: if/else 50, boolean chains 2, match/switch 2 (nesting depth added 27). Of this number, 48 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamWriter.run (cognitive 52) · ×1
  • streamWriter.run (cognitive 52) server/etcdserver/api/rafthttp/stream.go:160 — streamWriter.run has cognitive complexity 52 (threshold 15). Drivers by points: if/else 45, match/switch 5, boolean chains 1, loops 1 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TLSInfo.baseConfig (cognitive 48) · ×1
  • TLSInfo.baseConfig (cognitive 48) client/pkg/transport/listener.go:368 — TLSInfo.baseConfig has cognitive complexity 48 (threshold 15). Drivers by points: if/else 37, loops 6, boolean chains 5 (nesting depth added 13). Of this number, 24 points are the body's own statements and 24 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.
D2 · Cognitive Complexity · main.main (cognitive 47) · ×1
  • main.main (cognitive 47) tools/etcd-dump-metrics/main.go:43 — main.main has cognitive complexity 47 (threshold 15). Drivers by points: if/else 40, loops 6, boolean chains 1 (nesting depth added 28). Of this number, 31 points are the body's own statements and 16 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.parse (cognitive 47) · ×1
  • main.parse (cognitive 47) tools/etcd-dump-metrics/metrics.go:122 — main.parse has cognitive complexity 47 (threshold 15). Drivers by points: if/else 36, loops 9, 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.
D2 · Cognitive Complexity · command.makeMirror (cognitive 47) · ×1
  • command.makeMirror (cognitive 47) etcdctl/ctlv3/command/make_mirror_command.go:142 — command.makeMirror has cognitive complexity 47 (threshold 15). Drivers by points: if/else 32, loops 9, boolean chains 3, match/switch 3 (nesting depth added 25). Of this number, 46 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · embed.configureClientListeners (cognitive 46) · ×1
  • embed.configureClientListeners (cognitive 46) server/embed/etcd.go:645 — embed.configureClientListeners has cognitive complexity 46 (threshold 15). Drivers by points: if/else 31, boolean chains 9, loops 6 (nesting depth added 16). Of this number, 43 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.
D2 · Cognitive Complexity · v3rpc.checkIntervals (cognitive 43) · ×1
  • v3rpc.checkIntervals (cognitive 43) server/etcdserver/api/v3rpc/key.go:236 — v3rpc.checkIntervals has cognitive complexity 43 (threshold 15). Drivers by points: if/else 35, loops 7, boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Election.observe (cognitive 41) · ×1
  • Election.observe (cognitive 41) client/v3/concurrency/election.go:173 — Election.observe has cognitive complexity 41 (threshold 15). Drivers by points: if/else 21, loops 13, match/switch 6, boolean chains 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WAL.ReadAll (cognitive 41) · ×1
  • WAL.ReadAll (cognitive 41) server/storage/wal/wal.go:472 — WAL.ReadAll has cognitive complexity 41 (threshold 15). Drivers by points: if/else 34, boolean chains 3, match/switch 3, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watchGRPCStream.serveSubstream (cognitive 40) · ×1
  • watchGRPCStream.serveSubstream (cognitive 40) client/v3/watch.go:789 — watchGRPCStream.serveSubstream has cognitive complexity 40 (threshold 15). Drivers by points: if/else 37, match/switch 2, loops 1 (nesting depth added 23). Of this number, 37 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.
D2 · Cognitive Complexity · Config.Validate (cognitive 40) · ×1
  • Config.Validate (cognitive 40) server/embed/config.go:942 — Config.Validate has cognitive complexity 40 (threshold 15). Drivers by points: if/else 31, boolean chains 6, loops 2, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · msgAppV2Encoder.encode (cognitive 39) · ×1
  • msgAppV2Encoder.encode (cognitive 39) server/etcdserver/api/rafthttp/msgappv2_codec.go:87 — msgAppV2Encoder.encode has cognitive complexity 39 (threshold 15). Drivers by points: if/else 35, loops 2, boolean chains 1, match/switch 1 (nesting depth added 22). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · configYAML.configFromFile (cognitive 37) · ×1
  • configYAML.configFromFile (cognitive 37) server/embed/config.go:782 — configYAML.configFromFile has cognitive complexity 37 (threshold 15). Drivers by points: if/else 32, loops 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3rpc.logUnaryRequestStats (cognitive 37) · ×1
  • v3rpc.logUnaryRequestStats (cognitive 37) server/etcdserver/api/v3rpc/interceptor.go:91 — v3rpc.logUnaryRequestStats has cognitive complexity 37 (threshold 15). Drivers by points: if/else 26, loops 8, boolean chains 2, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · intervalTree.deleteFixup (cognitive 36) · ×1
  • intervalTree.deleteFixup (cognitive 36) pkg/adt/interval_tree.go:361 — intervalTree.deleteFixup has cognitive complexity 36 (threshold 15). Drivers by points: if/else 32, boolean chains 3, 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.
D2 · Cognitive Complexity · cmd.rangeFunc (cognitive 35) · ×1
  • cmd.rangeFunc (cognitive 35) tools/benchmark/cmd/range.go:71 — cmd.rangeFunc has cognitive complexity 35 (threshold 15). Drivers by points: if/else 23, boolean chains 4, loops 4, match/switch 4 (nesting depth added 9). Of this number, 25 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.main (cognitive 35) · ×1
  • main.main (cognitive 35) tools/check-grpc-experimental/main.go:43 — main.main has cognitive complexity 35 (threshold 15). Drivers by points: if/else 31, loops 3, boolean chains 1 (nesting depth added 17). Most of this is not in the body itself: 12 of the 35 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.
D2 · Cognitive Complexity · main.printRec (cognitive 35) · ×1
  • main.printRec (cognitive 35) tools/etcd-dump-logs/raw.go:87 — main.printRec has cognitive complexity 35 (threshold 15). Drivers by points: if/else 20, match/switch 7, boolean chains 4, loops 4 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · apply.checkTxnReqsPermission (cognitive 34) · ×1
  • apply.checkTxnReqsPermission (cognitive 34) server/etcdserver/apply/auth.go:140 — apply.checkTxnReqsPermission has cognitive complexity 34 (threshold 15). Drivers by points: if/else 31, match/switch 2, loops 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtcdServer.LeaseRenew (cognitive 34) · ×1
  • EtcdServer.LeaseRenew (cognitive 34) server/etcdserver/v3_server.go:488 — EtcdServer.LeaseRenew has cognitive complexity 34 (threshold 15). Drivers by points: if/else 29, loops 3, boolean chains 1, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fileutil.purgeFile (cognitive 31) · ×1
  • fileutil.purgeFile (cognitive 31) client/pkg/fileutil/purge.go:44 — fileutil.purgeFile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, loops 6, match/switch 2 (nesting depth added 18). Most of this is not in the body itself: 1 of the 31 points is its own statement and the rest belongs to one function literal inside it that branches (line 55). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · clientv3.newClient (cognitive 31) · ×1
  • clientv3.newClient (cognitive 31) client/v3/client.go:362 — clientv3.newClient has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, boolean chains 5 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · command.epHealthCommandFunc (cognitive 31) · ×1
  • command.epHealthCommandFunc (cognitive 31) etcdctl/ctlv3/command/ep_command.go:95 — command.epHealthCommandFunc has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17, loops 7, match/switch 5, boolean chains 2 (nesting depth added 14). 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 118). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · etcdmain.startEtcdOrProxyV2 (cognitive 31) · ×1
  • etcdmain.startEtcdOrProxyV2 (cognitive 31) server/etcdmain/etcd.go:43 — etcdmain.startEtcdOrProxyV2 has cognitive complexity 31 (threshold 15). Drivers by points: if/else 26, match/switch 3, boolean chains 2 (nesting depth added 11). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · leaseHandler.ServeHTTP (cognitive 31) · ×1
  • leaseHandler.ServeHTTP (cognitive 31) server/lease/leasehttp/http.go:58 — leaseHandler.ServeHTTP has cognitive complexity 31 (threshold 15). Drivers by points: if/else 23, match/switch 5, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · command.getGetOp (cognitive 30) · ×1
  • command.getGetOp (cognitive 30) etcdctl/ctlv3/command/get_command.go:122 — command.getGetOp has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, boolean chains 3, match/switch 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · leaseProxyStream.keepAliveLoop (cognitive 30) · ×1
  • leaseProxyStream.keepAliveLoop (cognitive 30) server/proxy/grpcproxy/lease.go:276 — leaseProxyStream.keepAliveLoop has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18, match/switch 7, loops 5 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mvcc.restoreIntoIndex (cognitive 30) · ×1
  • mvcc.restoreIntoIndex (cognitive 30) server/storage/mvcc/kvstore.go:434 — mvcc.restoreIntoIndex has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, loops 4, boolean chains 1 (nesting depth added 17). Most of this is not in the body itself: 0 of the 30 points are its own statements and the rest belongs to one function literal inside it that branches (line 436). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · v3Manager.Status (cognitive 29) · ×1
  • v3Manager.Status (cognitive 29) etcdutl/snapshot/v3_snapshot.go:118 — v3Manager.Status has cognitive complexity 29 (threshold 15). Drivers by points: if/else 27, loops 2 (nesting depth added 12). Most of this is not in the body itself: 3 of the 29 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.
D2 · Cognitive Complexity · msgAppV2Decoder.decode (cognitive 29) · ×1
  • msgAppV2Decoder.decode (cognitive 29) server/etcdserver/api/rafthttp/msgappv2_codec.go:179 — msgAppV2Decoder.decode has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26, loops 2, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamReader.decodeLoop (cognitive 29) · ×1
  • streamReader.decodeLoop (cognitive 29) server/etcdserver/api/rafthttp/stream.go:471 — streamReader.decodeLoop has cognitive complexity 29 (threshold 15). Drivers by points: if/else 24, match/switch 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtcdServer.rangeStream (cognitive 29) · ×1
  • EtcdServer.rangeStream (cognitive 29) server/etcdserver/v3_server.go:197 — EtcdServer.rangeStream has cognitive complexity 29 (threshold 15). Drivers by points: if/else 27, boolean chains 1, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.main (cognitive 28) · ×1
  • main.main (cognitive 28) tools/local-tester/bridge/bridge.go:196 — main.main has cognitive complexity 28 (threshold 15). Drivers by points: if/else 25, boolean chains 2, loops 1 (nesting depth added 4). 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: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · wal.Repair (cognitive 28) · ×1
  • wal.Repair (cognitive 28) server/storage/wal/repair.go:32 — wal.Repair has cognitive complexity 28 (threshold 15). Drivers by points: if/else 24, match/switch 2, 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.
D2 · Cognitive Complexity · lessor.recvKeepAliveLoop (cognitive 27) · ×1
  • lessor.recvKeepAliveLoop (cognitive 27) client/v3/lease.go:456 — lessor.recvKeepAliveLoop has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, loops 5, match/switch 2 (nesting depth added 17). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamReader.run (cognitive 27) · ×1
  • streamReader.run (cognitive 27) server/etcdserver/api/rafthttp/stream.go:396 — streamReader.run has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, match/switch 3, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.readUsingReadAll (cognitive 26) · ×1
  • main.readUsingReadAll (cognitive 26) tools/etcd-dump-logs/main.go:116 — main.readUsingReadAll has cognitive complexity 26 (threshold 15). Drivers by points: if/else 19, boolean chains 3, loops 2, match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · decoder.decodeRecord (cognitive 26) · ×1
  • decoder.decodeRecord (cognitive 26) server/storage/wal/decoder.go:88 — decoder.decodeRecord has cognitive complexity 26 (threshold 15). Drivers by points: if/else 24, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Cache.Watch (cognitive 25) · ×1
  • Cache.Watch (cognitive 25) cache/cache.go:116 — Cache.Watch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14, match/switch 10, loops 1 (nesting depth added 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 143). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · transport.isHostInDNS (cognitive 25) · ×1
  • transport.isHostInDNS (cognitive 25) client/pkg/transport/listener_tls.go:254 — transport.isHostInDNS has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16, loops 9 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · txn.executeTxn (cognitive 25) · ×1
  • txn.executeTxn (cognitive 25) server/etcdserver/txn/txn.go:135 — txn.executeTxn has cognitive complexity 25 (threshold 15). Drivers by points: if/else 22, match/switch 2, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TCPProxy.runMonitor (cognitive 25) · ×1
  • TCPProxy.runMonitor (cognitive 25) server/proxy/tcpproxy/userspace.go:196 — TCPProxy.runMonitor has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, loops 4, match/switch 2 (nesting depth added 17). Most of this is not in the body itself: 10 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.
D2 · Cognitive Complexity · wal.Verify (cognitive 25) · ×1
  • wal.Verify (cognitive 25) server/storage/wal/wal.go:704 — wal.Verify has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, boolean chains 3, match/switch 2, loops 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.
D2 · Cognitive Complexity · main.listEntriesType (cognitive 24) · ×1
  • main.listEntriesType (cognitive 24) tools/etcd-dump-logs/main.go:350 — main.listEntriesType has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21, loops 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · endpointManager.watch (cognitive 24) · ×1
  • endpointManager.watch (cognitive 24) client/v3/naming/endpoints/endpoints_impl.go:125 — endpointManager.watch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14, match/switch 6, loops 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · embed.StartEtcd (cognitive 24) · ×1
  • embed.StartEtcd (cognitive 24) server/embed/etcd.go:110 — embed.StartEtcd has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 3, boolean chains 2 (nesting depth added 4). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · etcdserver.getClusterFromRemotePeers (cognitive 24) · ×1
  • etcdserver.getClusterFromRemotePeers (cognitive 24) server/etcdserver/cluster_util.go:70 — etcdserver.getClusterFromRemotePeers has cognitive complexity 24 (threshold 15). Drivers by points: if/else 23, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EventHistory.scan (cognitive 24) · ×1
  • EventHistory.scan (cognitive 24) server/etcdserver/api/v2store/event_history.go:58 — EventHistory.scan has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtcdServer.applyConfChange (cognitive 24) · ×1
  • EtcdServer.applyConfChange (cognitive 24) server/etcdserver/server.go:1996 — EtcdServer.applyConfChange has cognitive complexity 24 (threshold 15). Drivers by points: if/else 22, boolean chains 1, 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.
D2 · Cognitive Complexity · EtcdServer.leaseTimeToLive (cognitive 24) · ×1
  • EtcdServer.leaseTimeToLive (cognitive 24) server/etcdserver/v3_server.go:636 — EtcdServer.leaseTimeToLive has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, loops 6 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watchableStore.moveVictims (cognitive 24) · ×1
  • watchableStore.moveVictims (cognitive 24) server/storage/mvcc/watchable_store.go:285 — watchableStore.moveVictims has cognitive complexity 24 (threshold 15). Drivers by points: if/else 18, loops 5, boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · leasingKV.monitorLease (cognitive 23) · ×1
  • leasingKV.monitorLease (cognitive 23) client/v3/leasing/kv.go:159 — leasingKV.monitorLease has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, loops 6, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watcher.Watch (cognitive 23) · ×1
  • watcher.Watch (cognitive 23) client/v3/watch.go:304 — watcher.Watch has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, match/switch 5, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etcdmain.startGateway (cognitive 23) · ×1
  • etcdmain.startGateway (cognitive 23) server/etcdmain/gateway.go:93 — etcdmain.startGateway has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, loops 6 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.readRaw (cognitive 22) · ×1
  • main.readRaw (cognitive 22) tools/etcd-dump-logs/raw.go:36 — main.readRaw has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, boolean chains 2, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · command.newCheckPerfCommand (cognitive 22) · ×1
  • command.newCheckPerfCommand (cognitive 22) etcdctl/ctlv3/command/check.go:143 — command.newCheckPerfCommand has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, loops 10 (nesting depth added 3). Of this number, 18 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · simplePrinter.RoleGet (cognitive 22) · ×1
  • simplePrinter.RoleGet (cognitive 22) etcdctl/ctlv3/command/printer_simple.go:206 — simplePrinter.RoleGet has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 4, loops 2 (nesting depth added 6). Of this number, 18 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.
D2 · Cognitive Complexity · etcdmain.startGRPCProxy (cognitive 22) · ×1
  • etcdmain.startGRPCProxy (cognitive 22) server/etcdmain/grpc_proxy.go:190 — etcdmain.startGRPCProxy has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rafthttp.startPeer (cognitive 22) · ×1
  • rafthttp.startPeer (cognitive 22) server/etcdserver/api/rafthttp/peer.go:131 — rafthttp.startPeer has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, match/switch 4, loops 2 (nesting depth added 12). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 174, 192, 135). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · pipeline.handle (cognitive 22) · ×1
  • pipeline.handle (cognitive 22) server/etcdserver/api/rafthttp/pipeline.go:94 — pipeline.handle has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, boolean chains 2, match/switch 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.
D2 · Cognitive Complexity · TCPProxy.pick (cognitive 22) · ×1
  • TCPProxy.pick (cognitive 22) server/proxy/tcpproxy/userspace.go:99 — TCPProxy.pick has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14, loops 5, match/switch 2, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watcher.send (cognitive 22) · ×1
  • watcher.send (cognitive 22) server/storage/mvcc/watchable_store.go:577 — watcher.send has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, loops 7, boolean chains 1, match/switch 1 (nesting depth added 11). 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.
D2 · Cognitive Complexity · command.memberAddCommandFunc (cognitive 21) · ×1
  • command.memberAddCommandFunc (cognitive 21) etcdctl/ctlv3/command/member_command.go:126 — command.memberAddCommandFunc has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, loops 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3Manager.copyAndVerifyDB (cognitive 21) · ×1
  • v3Manager.copyAndVerifyDB (cognitive 21) etcdutl/snapshot/v3_snapshot.go:436 — v3Manager.copyAndVerifyDB has cognitive complexity 21 (threshold 15). Drivers by points: if/else 19, 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.
D2 · Cognitive Complexity · command.newCheckDatascaleCommand (cognitive 20) · ×1
  • command.newCheckDatascaleCommand (cognitive 20) etcdctl/ctlv3/command/check.go:315 — command.newCheckDatascaleCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11, loops 9 (nesting depth added 3). Of this number, 17 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · command.userAddCommandFunc (cognitive 20) · ×1
  • command.userAddCommandFunc (cognitive 20) etcdctl/ctlv3/command/user_command.go:128 — command.userAddCommandFunc has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · command.watchInteractiveFunc (cognitive 20) · ×1
  • command.watchInteractiveFunc (cognitive 20) etcdctl/ctlv3/command/watch_command.go:95 — command.watchInteractiveFunc has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, match/switch 2, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · intervalTree.insertFixup (cognitive 20) · ×1
  • intervalTree.insertFixup (cognitive 20) pkg/adt/interval_tree.go:520 — intervalTree.insertFixup has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etcdhttp.writeError (cognitive 20) · ×1
  • etcdhttp.writeError (cognitive 20) server/etcdserver/api/etcdhttp/utils.go:40 — etcdhttp.writeError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, match/switch 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · membership.IsMetaStoreOnly (cognitive 20) · ×1
  • membership.IsMetaStoreOnly (cognitive 20) server/etcdserver/api/membership/storev2.go:45 — membership.IsMetaStoreOnly has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corruptionChecker.checkPeerHashes (cognitive 20) · ×1
  • corruptionChecker.checkPeerHashes (cognitive 20) server/etcdserver/corrupt.go:302 — corruptionChecker.checkPeerHashes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watcher.send (cognitive 20) · ×1
  • watcher.send (cognitive 20) server/proxy/grpcproxy/watcher.go:55 — watcher.send has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cmd.mvccPutFunc (cognitive 19) · ×1
  • cmd.mvccPutFunc (cognitive 19) tools/benchmark/cmd/mvcc-put.go:72 — cmd.mvccPutFunc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, loops 7 (nesting depth added 8). Of this number, 17 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.
D2 · Cognitive Complexity · cmd.mixedTxnFunc (cognitive 19) · ×1
  • cmd.mixedTxnFunc (cognitive 19) tools/benchmark/cmd/txn_mixed.go:72 — cmd.mixedTxnFunc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 4 (nesting depth added 6). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 118, 102). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · main.scanKeys (cognitive 19) · ×1
  • main.scanKeys (cognitive 19) tools/etcd-dump-db/scan.go:25 — main.scanKeys has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 3, boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · intervalTree.Insert (cognitive 19) · ×1
  • intervalTree.Insert (cognitive 19) pkg/adt/interval_tree.go:442 — intervalTree.Insert has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExpectProcess.ExpectFunc (cognitive 19) · ×1
  • ExpectProcess.ExpectFunc (cognitive 19) pkg/expect/expect.go:162 — ExpectProcess.ExpectFunc has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, loops 4, match/switch 3 (nesting depth added 8). Of this number, 12 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.
D2 · Cognitive Complexity · Trace.logInfo (cognitive 19) · ×1
  • Trace.logInfo (cognitive 19) pkg/traceutil/trace.go:199 — Trace.logInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, loops 8, boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · embed.configurePeerListeners (cognitive 19) · ×1
  • embed.configurePeerListeners (cognitive 19) server/embed/etcd.go:531 — embed.configurePeerListeners has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 2, boolean chains 1 (nesting depth added 7). Of this number, 14 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.
D2 · Cognitive Complexity · accessController.ServeHTTP (cognitive 19) · ×1
  • accessController.ServeHTTP (cognitive 19) server/embed/serve.go:446 — accessController.ServeHTTP has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3rpc.monitorLeader (cognitive 19) · ×1
  • v3rpc.monitorLeader (cognitive 19) server/etcdserver/api/v3rpc/interceptor.go:315 — v3rpc.monitorLeader has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12, loops 5, match/switch 2 (nesting depth added 12). Most of this is not in the body itself: 0 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 320). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · LeaseServer.leaseKeepAlive (cognitive 19) · ×1
  • LeaseServer.leaseKeepAlive (cognitive 19) server/etcdserver/api/v3rpc/lease.go:111 — LeaseServer.leaseKeepAlive has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Read.requestCurrentIndex (cognitive 19) · ×1
  • Read.requestCurrentIndex (cognitive 19) server/etcdserver/read/read.go:148 — Read.requestCurrentIndex has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 5, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · EtcdServer.run (cognitive 19) · ×1
  • EtcdServer.run (cognitive 19) server/etcdserver/server.go:755 — EtcdServer.run has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 2, loops 1 (nesting depth added 5). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 769, 797). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · wal.Create (cognitive 19) · ×1
  • wal.Create (cognitive 19) server/storage/wal/wal.go:101 — wal.Create has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19 (nesting depth added 1). Of this number, 17 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Client.unaryClientInterceptor (cognitive 18) · ×1
  • Client.unaryClientInterceptor (cognitive 18) client/v3/retry_interceptor.go:41 — Client.unaryClientInterceptor has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, loops 1 (nesting depth added 9). Most of this is not in the body itself: 0 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 43). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · command.getDelOp (cognitive 18) · ×1
  • command.getDelOp (cognitive 18) etcdctl/ctlv3/command/del_command.go:63 — command.getDelOp has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · flags.verifyEnv (cognitive 18) · ×1
  • flags.verifyEnv (cognitive 18) pkg/flags/flag.go:73 — flags.verifyEnv has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · etcdserver.promoteMemberHTTP (cognitive 18) · ×1
  • etcdserver.promoteMemberHTTP (cognitive 18) server/etcdserver/cluster_util.go:296 — etcdserver.promoteMemberHTTP has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, 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.
D2 · Cognitive Complexity · etcdserver.NewServer (cognitive 18) · ×1
  • etcdserver.NewServer (cognitive 18) server/etcdserver/server.go:295 — etcdserver.NewServer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, loops 2 (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · rafthttp.monitorProbingStatus (cognitive 18) · ×1
  • rafthttp.monitorProbingStatus (cognitive 18) server/etcdserver/api/rafthttp/probing_status.go:60 — rafthttp.monitorProbingStatus has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 2, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · node.Remove (cognitive 18) · ×1
  • node.Remove (cognitive 18) server/etcdserver/api/v2store/node.go:206 — node.Remove has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corruptionChecker.InitialCheck (cognitive 18) · ×1
  • corruptionChecker.InitialCheck (cognitive 18) server/etcdserver/corrupt.go:90 — corruptionChecker.InitialCheck has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · raftNode.processMessages (cognitive 18) · ×1
  • raftNode.processMessages (cognitive 18) server/etcdserver/raft.go:357 — raftNode.processMessages has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 3, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · backend.defragdb (cognitive 18) · ×1
  • backend.defragdb (cognitive 18) server/storage/backend/backend.go:616 — backend.defragdb has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, loops 1 (nesting depth added 8). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · store.restore (cognitive 18) · ×1
  • store.restore (cognitive 18) server/storage/mvcc/kvstore.go:317 — store.restore has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · watchableStore.syncWatchers (cognitive 18) · ×1
  • watchableStore.syncWatchers (cognitive 18) server/storage/mvcc/watchable_store.go:347 — watchableStore.syncWatchers has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cmd.watchLatencyFunc (cognitive 17) · ×1
  • cmd.watchLatencyFunc (cognitive 17) tools/benchmark/cmd/watch_latency.go:63 — cmd.watchLatencyFunc has cognitive complexity 17 (threshold 15). Drivers by points: loops 10, if/else 7 (nesting depth added 8). 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, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · srv.GetCluster (cognitive 17) · ×1
  • srv.GetCluster (cognitive 17) client/pkg/srv/srv.go:35 — srv.GetCluster has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 2, boolean chains 1 (nesting depth added 5). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 51). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TLSInfo.ClientConfig (cognitive 17) · ×1
  • TLSInfo.ClientConfig (cognitive 17) client/pkg/transport/listener.go:562 — TLSInfo.ClientConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · lessor.closeRequireLeader (cognitive 17) · ×1
  • lessor.closeRequireLeader (cognitive 17) client/v3/lease.go:383 — lessor.closeRequireLeader has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, loops 5, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · auth.getMergedPerms (cognitive 17) · ×1
  • auth.getMergedPerms (cognitive 17) server/auth/range_perm_cache.go:24 — auth.getMergedPerms has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, loops 3, match/switch 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.parse (cognitive 17) · ×1
  • config.parse (cognitive 17) server/etcdmain/config.go:124 — config.parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, loops 4, 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.
D2 · Cognitive Complexity · etcdserver.recoverSnapshot (cognitive 17) · ×1
  • etcdserver.recoverSnapshot (cognitive 17) server/etcdserver/bootstrap.go:413 — etcdserver.recoverSnapshot has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · streamReader.dial (cognitive 17) · ×1
  • streamReader.dial (cognitive 17) server/etcdserver/api/rafthttp/stream.go:569 — streamReader.dial has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 4, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Periodic.Run (cognitive 17) · ×1
  • Periodic.Run (cognitive 17) server/etcdserver/api/v3compactor/periodic.go:100 — Periodic.Run has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 2, match/switch 2, loops 1 (nesting depth added 7). Most of this is not in the body itself: 0 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 105). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · storeTxnCommon.rangeKeys (cognitive 17) · ×1
  • storeTxnCommon.rangeKeys (cognitive 17) server/storage/mvcc/kvstore_txn.go:73 — storeTxnCommon.rangeKeys has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, loops 3, match/switch 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chart.addValues (cognitive 17) · ×1
  • chart.addValues (cognitive 17) tools/rw-heatmaps/pkg/chart/line_chart.go:176 — chart.addValues has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cmd.processRow (cognitive 17) · ×1
  • cmd.processRow (cognitive 17) tools/testgrid-analysis/cmd/data.go:72 — cmd.processRow has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · cmd.stmFunc (cognitive 16) · ×1
  • cmd.stmFunc (cognitive 16) tools/benchmark/cmd/stm.go:72 — cmd.stmFunc has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, loops 6, boolean chains 2, match/switch 1 (nesting depth added 4). 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.
D2 · Cognitive Complexity · Cache.validateRange (cognitive 16) · ×1
  • Cache.validateRange (cognitive 16) cache/cache.go:478 — Cache.validateRange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 3, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · demux.updateStoreLocked (cognitive 16) · ×1
  • demux.updateStoreLocked (cognitive 16) cache/demux.go:199 — demux.updateStoreLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · transport.SelfCert (cognitive 16) · ×1
  • transport.SelfCert (cognitive 16) client/pkg/transport/listener.go:220 — transport.SelfCert has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DoubleBarrier.Leave (cognitive 16) · ×1
  • DoubleBarrier.Leave (cognitive 16) client/v3/experimental/recipes/double_barrier.go:112 — DoubleBarrier.Leave has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · leasing.evalCmp (cognitive 16) · ×1
  • leasing.evalCmp (cognitive 16) client/v3/leasing/util.go:36 — leasing.evalCmp has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, match/switch 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · v3Manager.Restore (cognitive 16) · ×1
  • v3Manager.Restore (cognitive 16) etcdutl/snapshot/v3_snapshot.go:257 — v3Manager.Restore has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Etcd.Close (cognitive 16) · ×1
  • Etcd.Close (cognitive 16) server/embed/etcd.go:414 — Etcd.Close has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, loops 7, 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.
D2 · Cognitive Complexity · etcdserver.openWALFromSnapshot (cognitive 16) · ×1
  • etcdserver.openWALFromSnapshot (cognitive 16) server/etcdserver/bootstrap.go:628 — etcdserver.openWALFromSnapshot has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Snapshotter.ReleaseSnapDBs (cognitive 16) · ×1
  • Snapshotter.ReleaseSnapDBs (cognitive 16) server/etcdserver/api/snap/snapshotter.go:257 — Snapshotter.ReleaseSnapDBs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · corruptionChecker.PeriodicCheck (cognitive 16) · ×1
  • corruptionChecker.PeriodicCheck (cognitive 16) server/etcdserver/corrupt.go:179 — corruptionChecker.PeriodicCheck has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 2, loops 1 (nesting depth added 4). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D38 · OSV Dependency Vulnerabilities · Medium vulnerability · ×1
  • Medium vulnerability: GO-2026-5932 etcdutl/go.mod — golang.org/x/crypto 0.54.0 (golang.org/x/crypto/openpgp, golang.org/x/crypto/openpgp/packet, golang.org/x/crypto/openpgp/armor, +4 more): GO-2026-5932 — no fixed version has been published yet. Track the advisory; golang.org/x/crypto is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so the action is on the dependency that requires it — upgrade or replace that dependent. Before doing either, check whether any affected package above is actually linked here: `go list -deps ./... | grep -F -e golang.org/x/crypto/openpgp` lists it whether your own code imports it or a dependency pulls it in — a module can be in the build list for one sub-package while the vulnerable one is never reached, in which case there is nothing to remove and tracking the advisory is the whole action. (in 4 dependency files)
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) server/auth/options.go:135 — server/auth/options.go:135-155 | server/auth/options.go:173-193 — both copies are in the same file, so extract the 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 `server/auth/options.go:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×1
  • Duplicated block (17 lines × 2) server/etcdserver/api/v2store/node.go:273 — server/etcdserver/api/v2store/node.go:273-290 | server/etcdserver/api/v2store/node_extern.go:44-60 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×1
  • Duplicated block (15 lines × 2) client/v3/experimental/recipes/priority_queue.go:50 — client/v3/experimental/recipes/priority_queue.go:50-64 | client/v3/experimental/recipes/queue.go:47-61 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `client/v3/experimental/recipes/priority_queue.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.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) etcdctl/ctlv3/command/printer_table.go:30 — etcdctl/ctlv3/command/printer_table.go:30-36 | etcdctl/ctlv3/command/printer_table.go:41-47 | etcdctl/ctlv3/command/printer_table.go:52-58 | etcdctl/ctlv3/command/printer_table.go:63-69 | etcdutl/etcdutl/printer_table.go:30-36 | etcdutl/etcdutl/printer_table.go:41-47 — there are 6 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 6 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×1
  • Duplicated block (5 lines × 2) server/etcdserver/api/rafthttp/stream.go:540 — server/etcdserver/api/rafthttp/stream.go:540-544 | server/etcdserver/api/rafthttp/stream.go:551-555 — both copies are in the same file, so extract the 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 `server/etcdserver/api/rafthttp/stream.go:540` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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.
Recommendation — 22 finding(s)
D31 · IaC & Container Security · Low IaC · ×7
  • Low IaC: DS-0005 Dockerfile — ADD instead of COPY
  • Low IaC: DS-0026 Dockerfile — No HEALTHCHECK defined Without one the runtime only knows whether the process is alive, not whether it is serving, so a wedged container is restarted by nobody. The step: add a `HEALTHCHECK` to the image that probes the service the way a client would — this image already declares `EXPOSE 2379`, so a request to `localhost:2379` on the service's own health or root route, exiting non-zero when it does not answer, is the probe — and give it an `--interval`, a `--timeout` and a `--start-period` long enough to cover startup. If the image ships no HTTP client, probe with whatever the runtime already has, or declare the check in the orchestrator instead and say so here.
  • Low IaC: KCV-0042 hack/kubernetes-deploy/etcd.yml — Ensure that the --cert-file and --key-file arguments are set as appropriate
  • Low IaC: KCV-0043 hack/kubernetes-deploy/etcd.yml — Ensure that the --client-cert-auth argument is set to true
  • Low IaC: KCV-0045 hack/kubernetes-deploy/etcd.yml — Ensure that the --peer-cert-file and --peer-key-file arguments are set as appropriate
  • Low IaC: KCV-0046 hack/kubernetes-deploy/etcd.yml — Ensure that the --peer-client-cert-auth argument is set to true
  • Low IaC: KSV-0003 hack/kubernetes-deploy/etcd.yml — Default capabilities: some containers do not drop all One securityContext edit clears this facet's near-duplicate rules together: KSV-0003, KSV-0004, KSV-0106.
D16 · Bus Factor · Off-boarding risk · ×3
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 5 significant file(s) lose their only recent owner: server/etcdserver/api/rafthttp/transport.go, server/etcdserver/api/rafthttp/peer.go, server/etcdserver/read/read.go, server/etcdserver/api/rafthttp/msgappv2_codec.go, server/etcdserver/api/rafthttp/remote.go. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 3 significant file(s) lose their only recent owner: server/embed/serve.go, client/pkg/transport/listener_tls.go, server/storage/quota.go. Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 3 significant file(s) lose their only recent owner: client/v3/leasing/util.go, client/v3/mirror/syncer.go, server/proxy/grpcproxy/watcher.go. Pair on, review, or document these before any departure.
D11 · Test Reliability · Test reliability not included · ×1
  • Test reliability not included — Test source is present (.go) but the built-in reliability runner does not support this repository's ecosystem, so flakiness couldn't be assessed. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 4 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 (16 single-owned of 300 analysed files in total, counted over production source files of roughly 100 lines or more, excluding tests, vendored, generated and example/demo trees, largest first). They are anonymized user #4 (2 file(s)), anonymized user #5 (1 file(s)), anonymized user #6 (1 file(s)), anonymized user #7 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above.
D19 · Documentation Quality · The container images section claims these are not used to build the project but does not link to the actual dependency-updating machinery or GitHub actions that do bump versions, leaving the reader unsure how this is integrated into the CI workflow. · ×1
  • The container images section claims these are not used to build the project but does not link to the actual dependency-updating machinery or GitHub actions that do bump versions, leaving the reader unsure how this is integrated into the CI workflow. tools/container-images/README.md — Add a brief sentence stating which tools actually drive version bumps (e.g. Dependabot) and where to find the GitHub action definition.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • Rotate the exposed credentials — git history can't be un-committed — Some of these secrets are in git HISTORY: deleting the file does not remove them (the commit persists on every clone, fork and backup). The remediation is to ROTATE each historically-exposed credential and treat it as compromised — not to delete the file. Rewriting history is disruptive and unreliable across existing forks. (Working-tree-only secrets — no commit — can instead be removed from the file and moved to a secret store.)
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 84 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than listed individually (86 orphaned of 305 analysed files in total, counted over production source files of roughly 100 lines or more, excluding tests, vendored, generated and example/demo trees, largest first).
D36 · Supply-chain Provenance & Signing · No build provenance · ×1
  • No build provenance — No SLSA provenance generation or build attestation found in CI — nothing binds a released artifact to the build that produced it, so a consumer cannot tell your artifact from a substituted one. On GitHub Actions, `actions/attest-build-provenance` (or slsa-github-generator) emits one from the job's own OIDC identity; elsewhere, run `cosign attest` over the released artifact from the release pipeline and publish the attestation beside it.
D36 · Supply-chain Provenance & Signing · No artifact signing · ×1
  • No artifact signing — No artifact signing found in CI — sign your released artifacts with whatever your ecosystem ships (`cosign sign` over the image digest your pipeline pushes, so a consumer can `cosign verify` what they pull, cosign/sigstore for container images) so consumers can verify what you built.
D36 · Supply-chain Provenance & Signing · No SBOM · ×1
  • No SBOM — No SBOM generation or committed SBOM found — produce one with what your ecosystem ships (`cyclonedx-gomod` over the module graph — or Go's own build info, which already records the module set in the binary, `syft` (or `anchore/sbom-action` in CI) over the source tree or released image). Publish it as a release asset (`*.spdx.json` / `*.cdx.json`) so consumers can see what they are installing.
D40 · Network Egress Confinement · No network policy · ×1
  • No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
D41 · Kernel & Syscall Confinement · No seccomp profile · ×1
  • No seccomp profile — Workloads do not set a seccomp profile (RuntimeDefault or a Localhost profile). Seccomp blocks the syscalls a container never needs, shrinking the kernel attack surface a container escape would use.
D41 · Kernel & Syscall Confinement · No AppArmor/SELinux confinement · ×1
  • No AppArmor/SELinux confinement — Workloads declare no AppArmor or SELinux profile. A mandatory-access-control profile confines what a compromised container can touch on the host, complementing seccomp's syscall filter.
D8 · Code Coverage · Coverage not included · ×1
  • Coverage not included — suite not readable by the collector — Coverage NOT READ here — but this repository measures it: a Codecov configuration (codecov.yml) shows that coverage is collected and tracked in your own CI. The built-in collector has no runner for this ecosystem (.go), so the analyzer could not read the number — a gap in the analyzer's language coverage, not an unmeasured repo. Not scored. To have the real number read, produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored.
Info — 2 finding(s)
D12 · Dependency Hygiene · Dependency hygiene not measured · ×1
  • Dependency hygiene not measured — dependency manifest found but not parsed for hygiene — This repository's dependency manifest (a Go module (go.mod/go.sum)) was found, but this pass cannot parse it for hygiene, so no package was assessed. Zero packages read is NOT a clean dependency tree, so this is NOT SCORED — a gap in the analyzer, not a verdict about this repository. This row is about dependency HYGIENE — outdated, deprecated or unmaintained direct dependencies; known CVEs in the same dependency graph are a separate question, reported under D38 wherever the manifest is OSV-readable.
D22 · Internal API Consistency · No exposed public API · ×1
  • No exposed public API — No intentionally-exposed types (IsPackable or .Contracts) to evaluate.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaksgitleaks detect --no-banner --report-format json --report-path /dev/stdout --exit-code 0 --source .15artifacts/raw/gitleaks-history.json
D29 · Static Analysis (SAST)semgrepsemgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --json --quiet --timeout 0 --metrics off .0
D30 · Dependency Vulnerabilitiesnone (no readable dependency manifest)none (no readable dependency manifest): not present in this environment0
D31 · IaC & Container Securitytrivytrivy config --format json --quiet .71artifacts/raw/trivy-config.json
D32 · Data Compliance (PII/GDPR)semgrepsemgrep: not applicable — No PII/GDPR-handling patterns detected (p/gdpr ruleset) — no data-compliance surface to assess.0
D33 · JS/npm Dependency Vulnerabilitiestrivytrivy: not applicable — No JS/npm manifest or lockfile found outside build output (package.json, package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb); no JS dependencies to scan.0
D38 · OSV Dependency Vulnerabilitiesosv-scannerosv-scanner --format json --recursive .1artifacts/raw/osv-scanner.json
D42 · Runtime Threat Enforcementruntime-hardeningruntime-hardening: not applicable — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.0

Run 019fd596-9c0d-77b4-b685-fbccbeb45cdb · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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