Public report — caddy, 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.
474findings with an exact file:lineof 482 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
31/94dimensions across the health lenses60886 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.
caddyserver/caddy carries serious gaps (50%). Several issues below can materially affect correctness, security, or the cost of changing it — and propagate to everything that depends on it.
It is strongest in Architecture (100%) — the structure is clean and changes stay contained. Security (76%) is solid too.
The area that most needs attention is Accessibility (43%) — it raises ongoing delivery and operational cost. Readiness (47%) is the next concern — releases are harder to depend on — versioning, release notes and dependency hygiene are thin, so consumers can't easily tell what changed or trust an upgrade.
Leadership focus, highest impact first: text alternative — alt on images (alt="" for purely decorative… (Text alternatives); Give every control a programmatic label (a <label for> /… (Forms & labels); accessibility in the test suite you already have (A11y enforcement).
For scale: Medium (~60,886 production lines); rebuilding it from scratch would take roughly ~0.7 person-years (~1–2 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 headlineWidth is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.
0.7× (at 50% quality) — the last 20% of quality is most of the work
Size & shape
Medium · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~0.7 person-years of build effort (about ~€100,000 to rebuild). Its weakest lens is Accessibility at 43% — the part of that asset most exposed by the findings below.
How we model this: boilerplate at a scaffolding rate + logic × domain Standard (×1.2) — CQRS × a 0.7× 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 2 Leaked secret finding(s) in Secret Scanning — start with caddy.localhost.key, a.caddy.localhost.key.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Value concentrated against a weak lens · High · Value at risk
This is a Medium asset (~0.7 person-years to rebuild), and its weakest lens is Accessibility at 43%. The operational and business risk on an asset this size concentrates there — that's where remediation buys the most protection.
→ Direct remediation budget at Accessibility first — highest risk-reduction per euro on an asset this size.
The top fix pays for itself · High · Economics
The top-ranked fix costs roughly 1–3 engineer-days once. Not doing it costs about 11.1–66.6 engineer-days every year, paid as drag on the ~50,346 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–3 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 9–20% 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: 12,414 line(s) changed over a 90-day window ⇒ ~50,346/year · D1/D2/D4 code quality: averaging 4.5/10 ⇒ a 9–20% 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 3 months.
Highest-leverage move · Medium · Leverage
Of everything flagged, the best return on effort is: Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
A velocity tax on every change · Medium · Economics
The code-quality signals (complexity, duplication, cohesion) average 4.5/10, which acts as a tax on every change in the weaker areas: modifications there plausibly cost on the order of 9–20% 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 4.5/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
45 modules, 132 dependencies — 1 dependency cycle, 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.)
At a glance — Code Health · 55% · Adequate · gated by D1, D2
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A03:2021 — Injection
35
High / Critical
A02:2021 — Cryptographic Failures
2
High / Critical
A06:2021 — Vulnerable & Outdated Components
2
Medium
Roadmap
Begin by adding text alternatives for images, SVGs, and video to ensure content is accessible. Next, provide programmatic labels for all form controls and buttons to improve form usability. Enforce accessibility standards in your test suite and CI pipeline to prevent future regressions. Finally, address page structure issues by adding language declarations, titles, and landmarks, and immediately resolve the two leaked secret findings.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with caddy.localhost.key, a.caddy.localhost.key.
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Enforce accessibility in the test suite you already have: assert the accessibility invariants over the HTML your app renders — parse the rendered output in an existing test, or drive a real browser from one — and gate that test in CI so a regression blocks the merge.
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.
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. 29 of 31 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.6 — the weighted average across measured dimensions; it falls as more of the score leans on LLM-assisted judgement and rises when it's fully tool-backed.
Every figure here is one of three kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact; ◐ Advisory — an LLM prose judgement. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10; ◐ Sampled · advisory marks an LLM verdict over a bounded sample — advisory, never a deterministic measurement.
What we checked — 31 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 474 of 482 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D30 Dependency Vulnerabilities — scanner not present in this environment — The backing tool was not installed where this scan ran, so this dimension was not scored. Install the tool (or run in the hosted environment, where it is always present) for a graded result.
Repo exclusion declarations (.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").
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.
AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A clean result is "no unlabelled native control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AC7 A11y enforcement: Enforcement is scored from in-repo config/CI evidence only — an a11y gate enforced in external tooling with no in-repo trace can't be credited, and a configured linter is presence, not proof the rules actually run or block a merge.
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.
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.
122 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Handler.UnmarshalCaddyfile at 238. A further 2 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 caddy.ToString at 18 — they are counted neither in the figure above nor in this dimension's score.
+ 117 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 Handler.UnmarshalCaddyfile (cyclomatic 238) finding(s) in Cyclomatic Complexity — start with caddyfile.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 httpcaddyfile.parseTLS (cyclomatic 121) finding(s) in Cyclomatic Complexity — start with builtins.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 ServerType.serversFromPairings (cyclomatic 118) finding(s) in Cyclomatic Complexity — start with httptype.go. — One of this dimension's main actionable groups (1 warning-level).
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.
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.
+ 204 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 1 Handler.UnmarshalCaddyfile (cognitive 512) finding(s) in Cognitive Complexity — start with caddyfile.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 ServerType.serversFromPairings (cognitive 322) finding(s) in Cognitive Complexity — start with httptype.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 ServerType.buildTLSApp (cognitive 283) finding(s) in Cognitive Complexity — start with tlsapp.go. — One of this dimension's main actionable groups (1 warning-level).
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.
Do you agree with this assessment?
D3 · God Classes8.6 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
Resolve the 15 FileTooLong finding(s) in God Classes — start with caddyfile.go, httptype.go, matchers.go. — One of this dimension's main actionable groups (15 warning-level).
Resolve the 3 TooManyMethods finding(s) in God Classes — start with dispenser.go, filterencoder.go, appendencoder.go. — One of this dimension's main actionable groups (3 warning-level).
Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Copy-pasted code that should be shared instead.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), density-scored per KLoC of production code. Deterministic.
What it measures: Whether 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.
Resolve the 2 Leaked secret finding(s) in Secret Scanning — start with caddy.localhost.key, a.caddy.localhost.key. — One of this dimension's main actionable groups (2 issue-level).
Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.
Detailed fixes: d13_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Resolve the 10 Hotspot finding(s) in Churn × Complexity Hotspots — start with httptype.go, app.go, reverseproxy.go. — One of this dimension's main actionable groups (10 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.4 / 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.
9 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is modules/caddytls/sessiontickets.go.
Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic doc sample (READMEs plus first 25 architecture docs), with two-pass stability filtering. Advisory, sampled.
The README is a single landing page with links to releases, documentation, and community, plus an attachment of the Caddy logo and a brief module README. The body is clipped mid-sentence inside a GitHub Actions badge, so any outline sections listed (e.g., Warp, features, install) are present but not shown; the visible content is thin and lacks concrete installation, configuration, or usage guidance for the caddyhttp encode module.
This README lists benchmark payloads but gives no explanation of what each payload represents or how to run the benchmarks.modules/caddyhttp/encode/testdata/README.md
What to do
Resolve the 1 This README lists benchmark payloads but gives no explanation of what… 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.
What it measures: Whether names — types, methods, variables — are clear and consistent.
Method: Judged by language model at low temperature (0.0-0.1) on a deterministic random symbol sample (fixed size, not exhaustive), with disclosed confidence band. Advisory, sampled.
What it measures: Whether 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.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
High: dependabot-missing-cooldown · ×7.github/dependabot.yml:4detected by semgrep finding
Medium: math-random-used · ×16modules/caddyhttp/caddyauth/basicauth.go:22detected by semgrep finding
Low: missing-ssl-minversion · ×12caddyconfig/httploader.go:186detected by semgrep finding
What to do
Resolve the 16 Medium finding(s) in Static Analysis (SAST) — start with browse.html (6), basicauth.go, errors.go. — One of this dimension's main actionable groups (16 warning-level).
Resolve the 12 Low finding(s) in Static Analysis (SAST) — start with streaming.go (4), httploader.go (3), caddytest.go. — One of this dimension's main actionable groups (12 recommendation-level).
Resolve the 7 High finding(s) in Static Analysis (SAST) — start with release-proposal.yml (6), dependabot.yml. — One of this dimension's main actionable groups (7 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
15 of 157 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is modules/logging/appendencoder.go.
Further orphaned files (smaller)
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling; coupling through a build step, config, or non-source file isn't seen.
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.
Resolve the 1 No build provenance 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.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.
Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.
Medium vulnerability: GO-2026-5932go.moddetected by osv-scanner finding
Medium CVE: GO-2025-4006go.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.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC1 · Text alternatives1.0 / 10Critical✓ Tool-verified
Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.
An image with no alt (and no aria-label/aria-labelledby) is unreadable to assistive tech. Add alt — alt="" if it's purely decorative. — browse.html:31
What to do
Add a text alternative — alt on images (alt="" for purely decorative ones), a title or aria-label on meaningful svg, an aria-label or inner fallback content on canvas, and a captions <track> on video.
Do you agree with this assessment?
AC2 · Forms & labels4.2 / 10Weak✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
A link with no text, aria-label or labelled child (e.g. an icon-only link) has no accessible name, so assistive tech can't say where it goes. Add visible text or an aria-label. (×9) — browse.html:861, browse.html:871, browse.html:881, …
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. — browse.html:991
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
The page declares no language, so assistive tech can't pick the right pronunciation. Add lang (e.g. lang="en"). — browse.html:0
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Do you agree with this assessment?
AC7 · A11y enforcement4.0 / 10Weak✓ Tool-verified
Other · Accessibility — Whether accessibility is ENFORCED in the toolchain — an accessibility checker configured over the markup (an a11y lint rule set, e.g. eslint-plugin-jsx-a11y or vuejs-accessibility where the project lints JavaScript) and an automated accessibility assertion wired into tests or CI (axe/pa11y/Lighthouse or an equivalent) — on the Documented→Verified→Prevented ladder.
Method: Repo config/CI scan: an accessibility checker configured over the markup (an a11y lint rule set such as eslint-plugin-jsx-a11y / vuejs-accessibility where JavaScript is linted) and an automated accessibility assertion in tests or CI (axe/pa11y/Lighthouse or equivalent), graded on the Documented→Verified→Prevented rungs. Deterministic, presence/rung detection.
No accessibility enforcement found — no automated accessibility check runs over the HTML your app renders. Assert the accessibility invariants over that HTML in the test suite you already have (parse the output and assert, or drive a browser), and gate that test in CI so a regression blocks the merge.
What to do
Enforce accessibility in the test suite you already have: assert the accessibility invariants over the HTML your app renders — parse the rendered output in an existing test, or drive a real browser from one — and gate that test in CI so a regression blocks the merge.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
Maturity · Maturity — Whether the repo and its projects have a README, and whether it's substantive and current.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
What to do
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.
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).
Maturity · Maturity — Whether the README actually describes the code that exists (LLM-judged, advisory).
Method: Judged by language model at low temperature: README accuracy versus actual projects, within a disclosed tolerance. Advisory, not a measured number.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
What to do
Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
Readiness · Readiness — Whether releases are automated and safely reversible (probes, rolling updates, approval gates) — from manifests/pipeline files, not the live environment.
Method: Filesystem scan: deployment manifests/IaC (K8s YAML, Helm, Terraform) for rolling updates, probes, approval gates, migration hooks. Exhaustive, deterministic.
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.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 13 of 55 WCAG 2.2 Level A/AA success criteria (24%; ≈26% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 42 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
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.
Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Not included — 63 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.
AC4 Keyboard semantics — No interactive element found in the parsed markup — AC4 not applicable here.
AX1 Captive dependencies — no DI registrations detected
AX10 Code composition — not assessed — code composition is computed by ROLE over a document set that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
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 — ~29777 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, .php) 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.
D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Terraform, Kubernetes/Helm, CloudFormation); nothing to scan.
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.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
D5 Coupling — Inter-project coupling could not be assessed — no analyzable project graph was found for this repository. Not scored: a gap in the analyzer's reach, not a verdict about this repository. (Coupling here is Martin afferent/efferent/instability plus reference cycles across a project-reference graph, read today from .NET project files; other ecosystems' module graphs are not read yet.)
D6 Cohesion (LCOM4) — Cohesion (LCOM4) is measured over a C#/VB class graph, and this repository's production source is mostly .go, .php, 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 strongly-typed id(s); 4 value object(s)
ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this check looks for (1 CQRS handler(s))
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this check looks for
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 — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
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.
High: dependabot-missing-cooldown .github/dependabot.yml:4— This Dependabot configuration does not set a cooldown period. Newly published packages can be malicious or unstable. Add a `cooldown` block with `default-days: 7` to each `package-ecosystem` entry under `updates` to wait 7 days before proposing updates to newly published package versions. Reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#cooldown. This is a semgrep security-AUDIT rule reporting a POLICY that is absent or weaker than its recommendation, not an exploitable defect. Confirm whether the current setting is a deliberate decision for this repository — and apply the change where it is not; where it is (a policy your release process already enforces elsewhere, or one this repository has consciously opted out of), record the decision and leave the configuration as it is. This configuration file has 2 such entries; one cooldown decision clears them all — reported once.
High: run-shell-injection .github/workflows/release-proposal.yml:41— Using variable interpolation `${{...}}` with a workflow input in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A workflow input is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: run-shell-injection .github/workflows/release-proposal.yml:68— Using variable interpolation `${{...}}` with a step output in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A step output is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: github-script-injection .github/workflows/release-proposal.yml:78— Using variable interpolation `${{...}}` with a step output in a `actions/github-script`'s `script:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A step output is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: run-shell-injection .github/workflows/release-proposal.yml:131— Using variable interpolation `${{...}}` with a step output in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A step output is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: github-script-injection .github/workflows/release-proposal.yml:182— Using variable interpolation `${{...}}` with `github` context data in a `actions/github-script`'s `script:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. `github` context data can have arbitrary user input and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
High: run-shell-injection .github/workflows/release-proposal.yml:243— Using variable interpolation `${{...}}` with a step output / an expression value in a `run:` step could allow an attacker to inject their own code into the runner. This would allow them to steal secrets and code. A step output / an expression value is not bounded by this step and should be treated as untrusted. Instead, use an intermediate environment variable with `env:` to store the data and use the environment variable in the `run:` script. Reference it as a shell VARIABLE rather than a `${{ }}` interpolation, using your shell's own syntax (`"$ENVVAR"` in bash, `$env:ENVVAR` in PowerShell), so the value is passed as data and never re-expanded as code.
Leaked secret: private-key caddytest/caddy.localhost.key:1— private-key detected. Treat the value as compromised: it is readable by everyone who has ever had the repository, and deleting the line does not un-publish it. In order — (1) REVOKE it at whatever issued it and issue a replacement, which is the only step that actually closes the exposure; (2) load the replacement at run time from your platform's secret store or the process environment instead of from the tree, so no future value is committable; (3) remove the file or line and add its path to the repository's ignore rules, so it cannot come back; (4) if the value was ever live, purge it from the history as well, since a clone taken before the deletion still carries it. If this is instead a FIXTURE — key material generated for tests and valid nowhere — then the exposure is nil and the fix is to make that legible: generate it in test setup, or keep it under a test-data path, so a reader (and this scan) can tell it from the real thing.
Leaked secret: private-key caddytest/a.caddy.localhost.key:1— private-key detected. Treat the value as compromised: it is readable by everyone who has ever had the repository, and deleting the line does not un-publish it. In order — (1) REVOKE it at whatever issued it and issue a replacement, which is the only step that actually closes the exposure; (2) load the replacement at run time from your platform's secret store or the process environment instead of from the tree, so no future value is committable; (3) remove the file or line and add its path to the repository's ignore rules, so it cannot come back; (4) if the value was ever live, purge it from the history as well, since a clone taken before the deletion still carries it. If this is instead a FIXTURE — key material generated for tests and valid nowhere — then the exposure is nil and the fix is to make that legible: generate it in test setup, or keep it under a test-data path, so a reader (and this scan) can tell it from the real thing.
Boundary-crossing change coupling: directives.go ↔ imports.go caddyconfig/httpcaddyfile/directives.go— `caddyconfig/httpcaddyfile/directives.go` (context caddyconfig) and `modules/caddyhttp/standard/imports.go` (context caddyhttp) sit in DIFFERENT parts of the tree yet change together 50% of the time (6 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.
Medium: math-random-used modules/caddyhttp/caddyauth/basicauth.go:22— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/errors.go:20— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: filepath-clean-misuse modules/caddyhttp/fileserver/browse.go:119— `Clean` is not intended to sanitize against path traversal attacks. This function is for finding the shortest path name equivalent to the given input. Using `Clean` to sanitize file reads may expose this application to path traversal attacks, where an attacker could access arbitrary files on the server. To fix this easily, write this: `filepath.FromSlash(path.Clean("/"+strings.Trim(req.URL.Path, "/")))` However, a better solution is using the `SecureJoin` function in the package `filepath-securejoin`. See https://pkg.go.dev/github.com/cyphar/filepath-securejoin#section-readme.
Medium: unquoted-attribute-var modules/caddyhttp/fileserver/browse.html:313— Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{ expr }}". This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: unquoted-attribute-var modules/caddyhttp/fileserver/browse.html:783— Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{ expr }}". This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: var-in-href modules/caddyhttp/fileserver/browse.html:791— Detected a template variable used in an anchor tag with the 'href' attribute. This allows a malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS) attacks. Emit the link through your template layer's URL construction: a helper that percent-encodes the value and rejects any scheme other than http/https, rather than interpolating it raw. Where the template engine is a third-party generator you do not control, validate the value before it reaches the template. You may also consider setting the Content Security Policy (CSP) header. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: var-in-href modules/caddyhttp/fileserver/browse.html:927— Detected a template variable used in an anchor tag with the 'href' attribute. This allows a malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS) attacks. Emit the link through your template layer's URL construction: a helper that percent-encodes the value and rejects any scheme other than http/https, rather than interpolating it raw. Where the template engine is a third-party generator you do not control, validate the value before it reaches the template. You may also consider setting the Content Security Policy (CSP) header. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: var-in-href modules/caddyhttp/fileserver/browse.html:1065— Detected a template variable used in an anchor tag with the 'href' attribute. This allows a malicious actor to input the 'javascript:' URI and is subject to cross- site scripting (XSS) attacks. Emit the link through your template layer's URL construction: a helper that percent-encodes the value and rejects any scheme other than http/https, rather than interpolating it raw. Where the template engine is a third-party generator you do not control, validate the value before it reaches the template. You may also consider setting the Content Security Policy (CSP) header. This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: unquoted-attribute-var modules/caddyhttp/fileserver/browse.html:1216— Detected a unquoted template variable as an attribute. If unquoted, a malicious actor could inject custom JavaScript handlers. To fix this, add quotes around the template expression, like this: "{{ expr }}". This is a semgrep security-AUDIT rule: it reports that a sensitive construct is present, not that it is exploitable here. Confirm whether this site handles untrusted input or is reachable across a trust boundary — and apply the change where it is; where the construct is required by the platform or protocol it calls into, and carries no untrusted data (a syscall/FFI shim, a build- or debug-gated tool, a fixed local surface), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/fileserver/staticfiles.go:23— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/reverseproxy/httptransport.go:24— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/reverseproxy/selectionpolicies.go:23— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/reverseproxy/streaming.go:27— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddyhttp/reverseproxy/upstreams.go:7— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddypki/acmeserver/acmeserver.go:20— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
Medium: math-random-used modules/caddytls/ech.go:11— `math/rand` is not cryptographically secure — its stream is reproducible from its seed and predictable from observed output — so any value that must be unguessable (a token, nonce, key, salt, session id, password-reset or MFA code) has to come from `crypto/rand`. Where non-cryptographic randomness IS the intent — jitter, backoff, sampling, load spreading, simulation, test fixtures, or output that is deliberately reproducible from a seed — `math/rand` is the correct choice and no change is needed; a package that deliberately offers both should keep its security-sensitive callers on the `crypto/rand` path rather than drop the other one. This is a semgrep security-AUDIT rule: it reports that a sensitive pattern is present, not that it is exploitable here. Confirm whether the flagged value reaches a security decision — a credential, token, nonce, key, salt or session id, or an externally reachable surface — and apply the change where it does; where it provably does not (cosmetic, simulation, or deliberately reproducible use), record the review and leave the code as it is.
FileTooLong: reverseproxy/caddyfile.go modules/caddyhttp/reverseproxy/caddyfile.go:0— FileTooLong — 1018 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: httpcaddyfile/httptype.go caddyconfig/httpcaddyfile/httptype.go:0— FileTooLong — 955 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: caddyhttp/matchers.go modules/caddyhttp/matchers.go:0— FileTooLong — 865 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: reverseproxy/reverseproxy.go modules/caddyhttp/reverseproxy/reverseproxy.go:0— FileTooLong — 802 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: ./admin.go admin.go:0— FileTooLong — 750 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: httpcaddyfile/builtins.go caddyconfig/httpcaddyfile/builtins.go:0— FileTooLong — 698 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: ./caddy.go caddy.go:0— FileTooLong — 626 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: httpcaddyfile/tlsapp.go caddyconfig/httpcaddyfile/tlsapp.go:0— FileTooLong — 626 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: caddytls/ech.go modules/caddytls/ech.go:0— FileTooLong — 606 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: caddyhttp/server.go modules/caddyhttp/server.go:0— FileTooLong — 591 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: caddytls/connpolicy.go modules/caddytls/connpolicy.go:0— FileTooLong — 573 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: caddytls/capools.go modules/caddytls/capools.go:0— FileTooLong — 552 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: cmd/commandfuncs.go cmd/commandfuncs.go:0— FileTooLong — 524 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: reverseproxy/selectionpolicies.go modules/caddyhttp/reverseproxy/selectionpolicies.go:0— FileTooLong — 507 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: caddytls/tls.go modules/caddytls/tls.go:0— FileTooLong — 505 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.
Duplicated block (10 lines × 2) cmd/packagesfuncs.go:72— cmd/packagesfuncs.go:72-81 | cmd/packagesfuncs.go:100-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/packagesfuncs.go:72` 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) modules/caddyhttp/celmatcher.go:741— modules/caddyhttp/celmatcher.go:741-750 | modules/caddyhttp/fileserver/matcher.go:649-658 — 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 `modules/caddyhttp/celmatcher.go:741` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) modules/caddyhttp/celmatcher.go:793— modules/caddyhttp/celmatcher.go:793-802 | modules/caddyhttp/fileserver/matcher.go:701-710 — 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 `modules/caddyhttp/celmatcher.go:793` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) modules/caddyhttp/reverseproxy/upstreams.go:97— modules/caddyhttp/reverseproxy/upstreams.go:97-106 | modules/caddyhttp/reverseproxy/upstreams.go:332-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/upstreams.go:97` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) modules/caddytls/acmeissuer.go:548— modules/caddytls/acmeissuer.go:548-557 | modules/caddytls/acmeissuer.go:564-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/acmeissuer.go:548` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) modules/caddytls/matchers.go:375— modules/caddytls/matchers.go:375-384 | modules/caddytls/matchers.go:490-499 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/matchers.go:375` it begins part-way through the construct above it, so those 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) caddyconfig/httpcaddyfile/builtins.go:347— caddyconfig/httpcaddyfile/builtins.go:347-356 | caddyconfig/httpcaddyfile/builtins.go:436-445 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `caddyconfig/httpcaddyfile/builtins.go:347` it begins part-way through the construct above it, so those 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) caddyconfig/httpcaddyfile/builtins.go:371— caddyconfig/httpcaddyfile/builtins.go:371-380 | caddyconfig/httpcaddyfile/builtins.go:421-430 — both copies are in the same file, so extract the 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) modules/caddyhttp/reverseproxy/caddyfile.go:443— modules/caddyhttp/reverseproxy/caddyfile.go:443-452 | modules/caddyhttp/reverseproxy/caddyfile.go:459-468 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (10 lines × 2) modules/caddyhttp/reverseproxy/caddyfile.go:519— modules/caddyhttp/reverseproxy/caddyfile.go:519-528 | modules/caddyhttp/reverseproxy/caddyfile.go:535-544 — both copies are in the same file, so extract the 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) modules/caddyhttp/reverseproxy/caddyfile.go:551— modules/caddyhttp/reverseproxy/caddyfile.go:551-560 | modules/caddyhttp/reverseproxy/caddyfile.go:583-592 — both copies are in the same file, so extract the 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) modules/caddyhttp/reverseproxy/caddyfile.go:567— modules/caddyhttp/reverseproxy/caddyfile.go:567-576 | modules/caddyhttp/reverseproxy/caddyfile.go:621-630 — both copies are in the same file, so extract the 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) modules/caddyhttp/reverseproxy/caddyfile.go:1283— modules/caddyhttp/reverseproxy/caddyfile.go:1283-1292 | modules/caddyhttp/reverseproxy/caddyfile.go:1296-1305 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/caddyfile.go:1283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Hotspot: caddyconfig/httpcaddyfile/httptype.go caddyconfig/httpcaddyfile/httptype.go— caddyconfig/httpcaddyfile/httptype.go changed 3 times in last 90 days, max complexity 118. 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: modules/caddyhttp/app.go modules/caddyhttp/app.go— modules/caddyhttp/app.go changed 5 times in last 90 days, max complexity 45. 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: modules/caddyhttp/reverseproxy/reverseproxy.go modules/caddyhttp/reverseproxy/reverseproxy.go— modules/caddyhttp/reverseproxy/reverseproxy.go changed 5 times in last 90 days, max complexity 44. 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: modules/caddyhttp/rewrite/rewrite.go modules/caddyhttp/rewrite/rewrite.go— modules/caddyhttp/rewrite/rewrite.go changed 5 times in last 90 days, max complexity 34. 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: modules/caddyhttp/server.go modules/caddyhttp/server.go— modules/caddyhttp/server.go changed 5 times in last 90 days, max complexity 33. 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: modules/caddyhttp/fileserver/staticfiles.go modules/caddyhttp/fileserver/staticfiles.go— modules/caddyhttp/fileserver/staticfiles.go changed 2 times in last 90 days, max complexity 70. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: modules/caddytls/tls.go modules/caddytls/tls.go— modules/caddytls/tls.go changed 3 times in last 90 days, max complexity 45. 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: caddyconfig/caddyfile/parse.go caddyconfig/caddyfile/parse.go— caddyconfig/caddyfile/parse.go changed 2 times in last 90 days, max complexity 53. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: modules/caddytls/connpolicy.go modules/caddytls/connpolicy.go— modules/caddytls/connpolicy.go changed 3 times in last 90 days, max complexity 35. 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: caddyconfig/caddyfile/lexer.go caddyconfig/caddyfile/lexer.go— caddyconfig/caddyfile/lexer.go changed 2 times in last 90 days, max complexity 49. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Duplicated block (9 lines × 2) caddyconfig/httpcaddyfile/httptype.go:680— caddyconfig/httpcaddyfile/httptype.go:680-688 | caddyconfig/httpcaddyfile/httptype.go:691-699 — both copies are in the same file, so extract the 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) modules/caddyhttp/celmatcher.go:535— modules/caddyhttp/celmatcher.go:535-543 | modules/caddyhttp/celmatcher.go:573-581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:100— modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:100-108 | modules/caddyhttp/reverseproxy/caddyfile.go:1050-1058 — 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 `modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:100` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) modules/caddyhttp/reverseproxy/healthchecks.go:274— modules/caddyhttp/reverseproxy/healthchecks.go:274-282 | modules/caddyhttp/reverseproxy/healthchecks.go:302-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. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/healthchecks.go:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) modules/caddyhttp/staticerror.go:65— modules/caddyhttp/staticerror.go:65-73 | modules/caddyhttp/staticresp.go:144-152 — 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 `modules/caddyhttp/staticerror.go:65` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) modules/caddytls/capools.go:238— modules/caddytls/capools.go:238-246 | modules/caddytls/capools.go:323-331 — both copies are in the same file, so extract the 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) modules/caddytls/leafpemloader.go:38— modules/caddytls/leafpemloader.go:38-46 | modules/caddytls/leafstorageloader.go:74-82 — 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 `modules/caddytls/leafpemloader.go:38` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) modules/caddytls/matchers.go:332— modules/caddytls/matchers.go:332-340 | modules/caddytls/matchers.go:456-464 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/matchers.go:332` 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) modules/logging/appendencoder.go:103— modules/logging/appendencoder.go:103-111 | modules/logging/filterencoder.go:121-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 `modules/logging/appendencoder.go:103` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) modules/caddypki/acmeserver/caddyfile.go:96— modules/caddypki/acmeserver/caddyfile.go:96-104 | modules/caddypki/acmeserver/caddyfile.go:115-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddypki/acmeserver/caddyfile.go:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) caddyconfig/httpcaddyfile/addresses.go:137— caddyconfig/httpcaddyfile/addresses.go:137-153 | caddyconfig/httpcaddyfile/addresses.go:200-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. Read the line range as the matched WINDOW rather than a finished unit: at `caddyconfig/httpcaddyfile/addresses.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 (12 lines × 2) caddyconfig/load.go:74— caddyconfig/load.go:74-85 | caddyconfig/load.go:138-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12 lines × 2) modules/caddyhttp/celmatcher.go:501— modules/caddyhttp/celmatcher.go:501-512 | modules/caddyhttp/celmatcher.go:524-535 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/celmatcher.go:501` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) modules/caddyhttp/matchers.go:1310— modules/caddyhttp/matchers.go:1310-1321 | modules/caddyhttp/vars.go:377-388 — 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 `modules/caddyhttp/matchers.go:1310` it begins part-way through the construct above it, so those 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) modules/caddyhttp/matchers.go:1337— modules/caddyhttp/matchers.go:1337-1348 | modules/caddyhttp/vars.go:404-415 — 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 `modules/caddyhttp/matchers.go:1337` it begins part-way through the construct above it, so those 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) modules/logging/appendencoder.go:82— modules/logging/appendencoder.go:82-93 | modules/logging/filterencoder.go:88-99 — 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 `modules/logging/appendencoder.go:82` it begins part-way through the construct above it, so those 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) caddyconfig/httpcaddyfile/builtins.go:69— caddyconfig/httpcaddyfile/builtins.go:69-80 | caddyconfig/httpcaddyfile/options.go:330-341 — 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 `caddyconfig/httpcaddyfile/builtins.go:69` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) modules/caddyhttp/reverseproxy/caddyfile.go:1508— modules/caddyhttp/reverseproxy/caddyfile.go:1508-1519 | modules/caddyhttp/reverseproxy/caddyfile.go:1608-1619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/caddyfile.go:1508` it begins part-way through the construct above it, so those 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) caddy.go:229— caddy.go:229-239 | caddy.go:249-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `caddy.go:229` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 2) cmd/storagefuncs.go:86— cmd/storagefuncs.go:86-96 | cmd/storagefuncs.go:158-168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/storagefuncs.go:86` it begins part-way through the construct above it, so those 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) modules/caddyhttp/matchers.go:1525— modules/caddyhttp/matchers.go:1525-1535 | modules/caddyhttp/routes.go:443-453 — 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 `modules/caddyhttp/matchers.go:1525` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) modules/caddytls/acmeissuer.go:620— modules/caddytls/acmeissuer.go:620-630 | modules/caddytls/zerosslissuer.go:200-210 — 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 `modules/caddytls/acmeissuer.go:620` it begins part-way through the construct above it, so those 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) modules/caddytls/capools.go:274— modules/caddytls/capools.go:274-284 | modules/caddytls/capools.go:359-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/capools.go:274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) modules/caddytls/capools.go:543— modules/caddytls/capools.go:543-553 | modules/caddytls/capools.go:914-924 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/capools.go:543` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) modules/caddytls/connpolicy.go:998— modules/caddytls/connpolicy.go:998-1008 | modules/caddytls/connpolicy.go:1016-1026 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) caddyconfig/httpcaddyfile/options.go:76— caddyconfig/httpcaddyfile/options.go:76-86 | caddyconfig/httpcaddyfile/options.go:91-101 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) listen_unix.go:228— listen_unix.go:228-241 | listen_unix.go:254-267 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `listen_unix.go:228` it begins part-way through the construct above it, so those 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 (14 lines × 2) modules/caddyhttp/matchers.go:1613— modules/caddyhttp/matchers.go:1613-1626 | modules/caddytls/matchers.go:202-215 — 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 `modules/caddyhttp/matchers.go:1613` it begins part-way through the construct above it, so those 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) modules/caddyhttp/replacer.go:341— modules/caddyhttp/replacer.go:341-354 | modules/caddyhttp/replacer.go:362-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/replacer.go:341` it begins part-way through the construct above it, so those 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) modules/caddyhttp/reverseproxy/selectionpolicies.go:539— modules/caddyhttp/reverseproxy/selectionpolicies.go:539-552 | modules/caddyhttp/reverseproxy/selectionpolicies.go:619-632 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/selectionpolicies.go:539` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) modules/caddypki/adminapi.go:96— modules/caddypki/adminapi.go:96-109 | modules/caddypki/adminapi.go:146-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddypki/adminapi.go:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (14 lines × 2) modules/caddypki/command.go:109— modules/caddypki/command.go:109-122 | modules/caddypki/command.go:178-191 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddypki/command.go:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) modules/caddyhttp/celmatcher.go:772— modules/caddyhttp/celmatcher.go:772-784 | modules/caddyhttp/fileserver/matcher.go:680-692 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) modules/caddyhttp/reverseproxy/httptransport.go:868— modules/caddyhttp/reverseproxy/httptransport.go:868-880 | modules/caddytls/capools.go:605-617 — 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 `modules/caddyhttp/reverseproxy/httptransport.go:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (13 lines × 2) modules/caddyhttp/staticresp.go:420— modules/caddyhttp/staticresp.go:420-432 | modules/caddyhttp/fileserver/command.go:193-206 — 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 `modules/caddyhttp/staticresp.go:420` 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) modules/caddytls/acmeissuer.go:652— modules/caddytls/acmeissuer.go:652-664 | modules/caddytls/zerosslissuer.go:226-238 — 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 `modules/caddytls/acmeissuer.go:652` it begins part-way through the construct above it, so those 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) modules/caddytls/automation.go:255— modules/caddytls/automation.go:255-267 | modules/caddytls/automation.go:402-418 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddytls/automation.go:255` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) modules/caddyhttp/headers/headers.go:303— modules/caddyhttp/headers/headers.go:303-311 | modules/caddyhttp/headers/headers.go:330-337 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/headers/headers.go:303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) modules/caddytls/fileloader.go:36— modules/caddytls/fileloader.go:36-43 | modules/caddytls/pemloader.go:36-43 — 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 `modules/caddytls/fileloader.go:36` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) modules/caddyhttp/reverseproxy/caddyfile.go:485— modules/caddyhttp/reverseproxy/caddyfile.go:485-492 | modules/caddyhttp/reverseproxy/caddyfile.go:610-617 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) modules/caddyhttp/reverseproxy/command.go:186— modules/caddyhttp/reverseproxy/command.go:186-193 | modules/caddyhttp/reverseproxy/command.go:208-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/command.go:186` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
TooManyMethods: Dispenser caddyconfig/caddyfile/dispenser.go:29— 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: FilterEncoder modules/logging/filterencoder.go:40— TooManyMethods — 32 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: AppendEncoder modules/logging/appendencoder.go:44— TooManyMethods — 31 methods. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (17 lines × 2) modules/caddyhttp/matchers.go:1210— modules/caddyhttp/matchers.go:1210-1226 | modules/caddyhttp/vars.go:272-288 — 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 `modules/caddyhttp/matchers.go:1210` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) modules/caddytls/fileloader.go:88— modules/caddytls/fileloader.go:88-104 | modules/caddytls/storageloader.go:84-100 — 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 `modules/caddytls/fileloader.go:88` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (17 lines × 2) modules/logging/appendencoder.go:167— modules/logging/appendencoder.go:167-183 | modules/logging/filterencoder.go:216-232 — 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 `modules/logging/appendencoder.go:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) modules/caddyhttp/intercept/intercept.go:250— modules/caddyhttp/intercept/intercept.go:250-264 | modules/caddyhttp/reverseproxy/caddyfile.go:822-836 — 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 `modules/caddyhttp/intercept/intercept.go:250` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) modules/caddyhttp/matchers.go:1645— modules/caddyhttp/matchers.go:1645-1659 | modules/caddytls/matchers.go:234-248 — 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 `modules/caddyhttp/matchers.go:1645` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15 lines × 2) modules/caddyhttp/vars.go:191— modules/caddyhttp/vars.go:191-205 | modules/caddyhttp/vars.go:328-342 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/vars.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.
Duplicated block (7 lines × 2) caddyconfig/httpcaddyfile/httptype.go:562— caddyconfig/httpcaddyfile/httptype.go:562-568 | caddyconfig/httpcaddyfile/httptype.go:1033-1039 — both copies are in the same file, so extract the 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) context.go:231— context.go:231-237 | context.go:249-255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `context.go:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) context.go:507— context.go:507-513 | context.go:535-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 3) modules/caddyhttp/matchers.go:854— modules/caddyhttp/matchers.go:854-864 | modules/caddyhttp/matchers.go:1326-1336 | modules/caddyhttp/vars.go:393-403 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/matchers.go:854` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 3) modules/caddypki/ca.go:113— modules/caddypki/ca.go:113-123 | modules/caddytls/capools.go:409-419 | modules/caddytls/leafstorageloader.go:60-70 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddypki/ca.go:113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) modules/caddyhttp/matchers.go:868— modules/caddyhttp/matchers.go:868-877 | modules/caddyhttp/matchers.go:1341-1350 | modules/caddyhttp/vars.go:408-417 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/matchers.go:868` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 3) modules/caddyhttp/reverseproxy/caddyfile.go:1105— modules/caddyhttp/reverseproxy/caddyfile.go:1105-1114 | modules/caddyhttp/reverseproxy/caddyfile.go:1517-1526 | modules/caddyhttp/reverseproxy/caddyfile.go:1617-1626 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/reverseproxy/caddyfile.go:1105` it begins part-way through the construct above it, so those 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) caddyconfig/httpcaddyfile/httptype.go:1639— caddyconfig/httpcaddyfile/httptype.go:1639-1644 | modules/caddytls/connpolicy.go:1101-1107 — 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 `caddyconfig/httpcaddyfile/httptype.go:1639` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (6 lines × 2) modules/caddyhttp/rewrite/rewrite.go:608— modules/caddyhttp/rewrite/rewrite.go:608-613 | modules/caddyhttp/rewrite/rewrite.go:623-628 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `modules/caddyhttp/rewrite/rewrite.go:608` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Handler.UnmarshalCaddyfile (cyclomatic 238) modules/caddyhttp/reverseproxy/caddyfile.go:143— Handler.UnmarshalCaddyfile has cyclomatic complexity 238 (threshold 15). Of this number, 227 points are the body's own statements and 11 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.
httpcaddyfile.parseTLS (cyclomatic 121) caddyconfig/httpcaddyfile/builtins.go:118— httpcaddyfile.parseTLS has cyclomatic complexity 121 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ServerType.serversFromPairings (cyclomatic 118) caddyconfig/httpcaddyfile/httptype.go:551— ServerType.serversFromPairings has cyclomatic complexity 118 (threshold 15). Of this number, 101 points are the body's own statements and 17 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.
ServerType.buildTLSApp (cyclomatic 118) caddyconfig/httpcaddyfile/tlsapp.go:36— ServerType.buildTLSApp has cyclomatic complexity 118 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HTTPTransport.UnmarshalCaddyfile (cyclomatic 104) modules/caddyhttp/reverseproxy/caddyfile.go:1018— HTTPTransport.UnmarshalCaddyfile has cyclomatic complexity 104 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddyhttp.addHTTPVarsToReplacer (cyclomatic 91) modules/caddyhttp/replacer.go:58— caddyhttp.addHTTPVarsToReplacer has cyclomatic complexity 91 (threshold 15). Most of this is not in the body itself: 1 of the 91 points is its own statement and the rest belongs to one function literal inside it that branches (line 62). 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.
caddyfile.Format (cyclomatic 90) caddyconfig/caddyfile/formatter.go:30— caddyfile.Format has cyclomatic complexity 90 (threshold 15). Of this number, 82 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpcaddyfile.unmarshalCaddyfileServerOptions (cyclomatic 80) caddyconfig/httpcaddyfile/serveroptions.go:66— httpcaddyfile.unmarshalCaddyfileServerOptions has cyclomatic complexity 80 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.automaticHTTPSPhase1 (cyclomatic 78) modules/caddyhttp/autohttps.go:77— App.automaticHTTPSPhase1 has cyclomatic complexity 78 (threshold 15). Of this number, 65 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ACMEIssuer.UnmarshalCaddyfile (cyclomatic 77) modules/caddytls/acmeissuer.go:448— ACMEIssuer.UnmarshalCaddyfile has cyclomatic complexity 77 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileServer.ServeHTTP (cyclomatic 70) modules/caddyhttp/fileserver/staticfiles.go:269— FileServer.ServeHTTP has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpcaddyfile.consolidateConnPolicies (cyclomatic 68) caddyconfig/httpcaddyfile/httptype.go:1091— httpcaddyfile.consolidateConnPolicies has cyclomatic complexity 68 (threshold 15). Of this number, 67 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.
ServerType.Setup (cyclomatic 67) caddyconfig/httpcaddyfile/httptype.go:57— ServerType.Setup has cyclomatic complexity 67 (threshold 15). Of this number, 62 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HTTPTransport.NewTransport (cyclomatic 64) modules/caddyhttp/reverseproxy/httptransport.go:207— HTTPTransport.NewTransport has cyclomatic complexity 64 (threshold 15). Of this number, 39 points are the body's own statements and 25 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpcaddyfile.parseLogHelper (cyclomatic 55) caddyconfig/httpcaddyfile/builtins.go:941— httpcaddyfile.parseLogHelper has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpcaddyfile.fillInGlobalACMEDefaults (cyclomatic 55) caddyconfig/httpcaddyfile/tlsapp.go:516— httpcaddyfile.fillInGlobalACMEDefaults has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser.doImport (cyclomatic 53) caddyconfig/caddyfile/parse.go:356— parser.doImport has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
lexer.next (cyclomatic 49) caddyconfig/caddyfile/lexer.go:107— lexer.next has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
reverseproxy.cmdReverseProxy (cyclomatic 48) modules/caddyhttp/reverseproxy/command.go:87— reverseproxy.cmdReverseProxy has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileWriter.UnmarshalCaddyfile (cyclomatic 46) modules/logging/filewriter.go:379— FileWriter.UnmarshalCaddyfile 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.
App.Provision (cyclomatic 45) modules/caddyhttp/app.go:186— App.Provision has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TLS.Provision (cyclomatic 45) modules/caddytls/tls.go:162— TLS.Provision has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddy.unsyncedConfigAccess (cyclomatic 44) admin.go:1159— caddy.unsyncedConfigAccess has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.Provision (cyclomatic 44) modules/caddyhttp/reverseproxy/reverseproxy.go:262— Handler.Provision has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
httpcaddyfile.parsePKIApp (cyclomatic 42) caddyconfig/httpcaddyfile/pkiapp.go:55— httpcaddyfile.parsePKIApp has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MatchFile.selectFile (cyclomatic 41) modules/caddyhttp/fileserver/matcher.go:333— MatchFile.selectFile has cyclomatic complexity 41 (threshold 15). Of this number, 30 points are the body's own statements and 11 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.
TLS.publishECHConfigs (cyclomatic 40) modules/caddytls/ech.go:314— TLS.publishECHConfigs has cyclomatic complexity 40 (threshold 15). Of this number, 39 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.
caddyhttp.getReqTLSReplacement (cyclomatic 39) modules/caddyhttp/replacer.go:414— caddyhttp.getReqTLSReplacement has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.createAutomationPolicies (cyclomatic 39) modules/caddyhttp/autohttps.go:597— App.createAutomationPolicies has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileServer.UnmarshalCaddyfile (cyclomatic 39) modules/caddyhttp/fileserver/caddyfile.go:67— FileServer.UnmarshalCaddyfile has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
App.Start (cyclomatic 38) modules/caddyhttp/app.go:465— App.Start has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
fastcgi.parsePHPFastCGI (cyclomatic 36) modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:172— fastcgi.parsePHPFastCGI has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
HeaderOps.ApplyTo (cyclomatic 35) modules/caddyhttp/headers/headers.go:220— HeaderOps.ApplyTo has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConnectionPolicy.UnmarshalCaddyfile (cyclomatic 35) modules/caddytls/connpolicy.go:481— ConnectionPolicy.UnmarshalCaddyfile has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.doActiveHealthCheck (cyclomatic 34) modules/caddyhttp/reverseproxy/healthchecks.go:391— Handler.doActiveHealthCheck has cyclomatic complexity 34 (threshold 15). Of this number, 25 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Rewrite.Rewrite (cyclomatic 34) modules/caddyhttp/rewrite/rewrite.go:158— Rewrite.Rewrite 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.
Server.ServeHTTP (cyclomatic 33) modules/caddyhttp/server.go:421— Server.ServeHTTP has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddyhttp.cmdRespond (cyclomatic 31) modules/caddyhttp/staticresp.go:316— caddyhttp.cmdRespond has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TLSConfig.MakeTLSClientConfig (cyclomatic 31) modules/caddyhttp/reverseproxy/httptransport.go:790— TLSConfig.MakeTLSClientConfig 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.
ACMEIssuer.Provision (cyclomatic 31) modules/caddytls/acmeissuer.go:129— ACMEIssuer.Provision has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddycmd.cmdRun (cyclomatic 30) cmd/commandfuncs.go:188— caddycmd.cmdRun has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.reverseProxy (cyclomatic 30) modules/caddyhttp/reverseproxy/reverseproxy.go:991— Handler.reverseProxy has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
acmeserver.parseACMEServer (cyclomatic 30) modules/caddypki/acmeserver/caddyfile.go:45— acmeserver.parseACMEServer has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ZeroSSLIssuer.UnmarshalCaddyfile (cyclomatic 30) modules/caddytls/zerosslissuer.go:138— ZeroSSLIssuer.UnmarshalCaddyfile has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
AUpstreams.UnmarshalCaddyfile (cyclomatic 29) modules/caddyhttp/reverseproxy/caddyfile.go:1562— AUpstreams.UnmarshalCaddyfile 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.
reverseproxy.parseUpstreamDialAddress (cyclomatic 28) modules/caddyhttp/reverseproxy/addresses.go:65— reverseproxy.parseUpstreamDialAddress has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
SRVUpstreams.UnmarshalCaddyfile (cyclomatic 28) modules/caddyhttp/reverseproxy/caddyfile.go:1456— SRVUpstreams.UnmarshalCaddyfile has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ClientAuthentication.UnmarshalCaddyfile (cyclomatic 28) modules/caddytls/connpolicy.go:654— ClientAuthentication.UnmarshalCaddyfile has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
FileWriter.OpenWriter (cyclomatic 28) modules/logging/filewriter.go:187— FileWriter.OpenWriter has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
ConnectionPolicy.buildStandardTLSConfig (cyclomatic 27) modules/caddytls/connpolicy.go:269— ConnectionPolicy.buildStandardTLSConfig has cyclomatic complexity 27 (threshold 15). Of this number, 24 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.
LogEncoderConfig.ZapcoreEncoderConfig (cyclomatic 27) modules/logging/encoders.go:203— LogEncoderConfig.ZapcoreEncoderConfig has cyclomatic complexity 27 (threshold 15). 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, 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.
httpcaddyfile.consolidateAutomationPolicies (cyclomatic 26) caddyconfig/httpcaddyfile/tlsapp.go:969— httpcaddyfile.consolidateAutomationPolicies has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddycmd.cmdListModules (cyclomatic 26) cmd/commandfuncs.go:438— caddycmd.cmdListModules has cyclomatic complexity 26 (threshold 15). Of this number, 18 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.
App.Stop (cyclomatic 26) modules/caddyhttp/app.go:674— App.Stop has cyclomatic complexity 26 (threshold 15). Of this number, 14 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddy.Version (cyclomatic 25) caddy.go:1003— caddy.Version 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.
FileServer.Provision (cyclomatic 25) modules/caddyhttp/fileserver/staticfiles.go:194— FileServer.Provision 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.
Handler.proxyLoopIteration (cyclomatic 25) modules/caddyhttp/reverseproxy/reverseproxy.go:603— Handler.proxyLoopIteration 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.
AutomationPolicy.makeCertMagicConfig (cyclomatic 25) modules/caddytls/automation.go:272— AutomationPolicy.makeCertMagicConfig has cyclomatic complexity 25 (threshold 15). Of this number, 14 points are the body's own statements and 11 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.
FileServer.serveBrowse (cyclomatic 24) modules/caddyhttp/fileserver/browse.go:78— FileServer.serveBrowse 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.
echConfig.UnmarshalBinary (cyclomatic 24) modules/caddytls/ech.go:968— echConfig.UnmarshalBinary has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ServerType.listenersForServerBlockAddress (cyclomatic 23) caddyconfig/httpcaddyfile/addresses.go:270— ServerType.listenersForServerBlockAddress 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.
caddycmd.loadConfigWithLogger (cyclomatic 23) cmd/main.go:146— caddycmd.loadConfigWithLogger 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.
Context.LoadModule (cyclomatic 23) context.go:188— Context.LoadModule 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.
CustomLog.loggerAllowed (cyclomatic 23) logging.go:533— CustomLog.loggerAllowed 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.
App.Emit (cyclomatic 23) modules/caddyevents/app.go:207— App.Emit has cyclomatic complexity 23 (threshold 15). Of this number, 14 points are the body's own statements and 9 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.
Handler.finalizeResponse (cyclomatic 23) modules/caddyhttp/reverseproxy/reverseproxy.go:1218— Handler.finalizeResponse has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Replacer.replace (cyclomatic 23) replacer.go:175— Replacer.replace 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.
httpcaddyfile.newBaseAutomationPolicy (cyclomatic 22) caddyconfig/httpcaddyfile/tlsapp.go:903— httpcaddyfile.newBaseAutomationPolicy has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Transport.UnmarshalCaddyfile (cyclomatic 22) modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:50— Transport.UnmarshalCaddyfile has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.addForwardedHeaders (cyclomatic 22) modules/caddyhttp/reverseproxy/reverseproxy.go:889— Handler.addForwardedHeaders has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
StaticResponse.ServeHTTP (cyclomatic 22) modules/caddyhttp/staticresp.go:181— StaticResponse.ServeHTTP has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Transport.buildEnv (cyclomatic 21) modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:257— Transport.buildEnv has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
forwardauth.parseCaddyfile (cyclomatic 21) modules/caddyhttp/reverseproxy/forwardauth/caddyfile.go:64— forwardauth.parseCaddyfile 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.
Handler.prepareRequest (cyclomatic 21) modules/caddyhttp/reverseproxy/reverseproxy.go:763— Handler.prepareRequest has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
LoadBalancing.tryAgain (cyclomatic 21) modules/caddyhttp/reverseproxy/reverseproxy.go:1342— LoadBalancing.tryAgain 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.
CA.Provision (cyclomatic 21) modules/caddypki/ca.go:99— CA.Provision has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
FilterEncoder.UnmarshalCaddyfile (cyclomatic 21) modules/logging/filterencoder.go:152— FilterEncoder.UnmarshalCaddyfile has cyclomatic complexity 21 (threshold 15). Of this number, 14 points are the body's own statements and 7 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.
ServerType.compileEncodedMatcherSets (cyclomatic 20) caddyconfig/httpcaddyfile/httptype.go:1488— ServerType.compileEncodedMatcherSets 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.
caddycmd.cmdExportStorage (cyclomatic 20) cmd/storagefuncs.go:136— caddycmd.cmdExportStorage 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.
browseTemplateContext.applySortAndLimit (cyclomatic 20) modules/caddyhttp/fileserver/browsetplcontext.go:228— browseTemplateContext.applySortAndLimit has cyclomatic complexity 20 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Handler.ServeHTTP (cyclomatic 20) modules/caddyhttp/reverseproxy/reverseproxy.go:485— Handler.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.
rewrite.parseCaddyfileURI (cyclomatic 20) modules/caddyhttp/rewrite/caddyfile.go:97— rewrite.parseCaddyfileURI 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.
queryOps.do (cyclomatic 20) modules/caddyhttp/rewrite/rewrite.go:562— queryOps.do 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.
caddy.changeConfig (cyclomatic 19) caddy.go:158— caddy.changeConfig 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.
caddy.finishSettingUp (cyclomatic 19) caddy.go:594— caddy.finishSettingUp has cyclomatic complexity 19 (threshold 15). Of this number, 10 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
caddy.listenReusable (cyclomatic 19) listen_unix.go:94— caddy.listenReusable has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
parser.addresses (cyclomatic 19) caddyconfig/caddyfile/parse.go:210— parser.addresses 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.
httpcaddyfile.detectConflictingSchemes (cyclomatic 19) caddyconfig/httpcaddyfile/httptype.go:1031— httpcaddyfile.detectConflictingSchemes has cyclomatic complexity 19 (threshold 15). Of this number, 14 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.
Context.LoadModuleByID (cyclomatic 19) context.go:364— Context.LoadModuleByID has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.doActiveHealthCheckForAllHosts (cyclomatic 19) modules/caddyhttp/reverseproxy/healthchecks.go:297— Handler.doActiveHealthCheckForAllHosts has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 299). 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.
Server.serveHTTP (cyclomatic 19) modules/caddyhttp/server.go:582— Server.serveHTTP 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.
caddytls.tlsCertFromCertAndKeyPEMBundle (cyclomatic 19) modules/caddytls/folderloader.go:106— caddytls.tlsCertFromCertAndKeyPEMBundle 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.
AutomationPolicy.Provision (cyclomatic 19) modules/caddytls/automation.go:182— AutomationPolicy.Provision 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.
ConnectionPolicies.TLSConfig (cyclomatic 19) modules/caddytls/connpolicy.go:98— ConnectionPolicies.TLSConfig has cyclomatic complexity 19 (threshold 15). 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, 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.
parser.directive (cyclomatic 18) caddyconfig/caddyfile/parse.go:636— parser.directive 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.
ServerType.evaluateGlobalOptionsBlock (cyclomatic 18) caddyconfig/httpcaddyfile/httptype.go:370— ServerType.evaluateGlobalOptionsBlock 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.
caddycmd.cmdStart (cyclomatic 18) cmd/commandfuncs.go:45— caddycmd.cmdStart has cyclomatic complexity 18 (threshold 15). Of this number, 14 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.
caddycmd.cmdFmt (cyclomatic 18) cmd/commandfuncs.go:685— caddycmd.cmdFmt 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.
fileserver.cmdFileServer (cyclomatic 18) modules/caddyhttp/fileserver/command.go:86— fileserver.cmdFileServer 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.
FileServer.directoryListing (cyclomatic 18) modules/caddyhttp/fileserver/browsetplcontext.go:37— FileServer.directoryListing 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.
headers.parseCaddyfile (cyclomatic 18) modules/caddyhttp/headers/caddyfile.go:49— headers.parseCaddyfile 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.
Intercept.ServeHTTP (cyclomatic 18) modules/caddyhttp/intercept/intercept.go:115— Intercept.ServeHTTP has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MatchPath.matchPatternWithEscapeSequence (cyclomatic 18) modules/caddyhttp/matchers.go:537— MatchPath.matchPatternWithEscapeSequence 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.
ActiveHealthChecks.Provision (cyclomatic 18) modules/caddyhttp/reverseproxy/healthchecks.go:137— ActiveHealthChecks.Provision has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
CustomCertSelectionPolicy.UnmarshalCaddyfile (cyclomatic 18) modules/caddytls/certselection.go:125— CustomCertSelectionPolicy.UnmarshalCaddyfile 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.
caddy.unsyncedDecodeAndRun (cyclomatic 17) caddy.go:337— caddy.unsyncedDecodeAndRun 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.
caddyhttp.matchHeaders (cyclomatic 17) modules/caddyhttp/matchers.go:1150— caddyhttp.matchHeaders 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.
headers.applyHeaderOp (cyclomatic 17) modules/caddyhttp/headers/caddyfile.go:225— headers.applyHeaderOp 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.
rewrite.buildQueryString (cyclomatic 17) modules/caddyhttp/rewrite/rewrite.go:336— rewrite.buildQueryString has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
TLS.Start (cyclomatic 17) modules/caddytls/tls.go:401— TLS.Start has cyclomatic complexity 17 (threshold 15). Of this number, 11 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.
httpcaddyfile.appendSubrouteToRouteList (cyclomatic 16) caddyconfig/httpcaddyfile/httptype.go:1254— httpcaddyfile.appendSubrouteToRouteList 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.
httpcaddyfile.buildSubroute (cyclomatic 16) caddyconfig/httpcaddyfile/httptype.go:1317— httpcaddyfile.buildSubroute 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.
httpcaddyfile.parseOptOnDemand (cyclomatic 16) caddyconfig/httpcaddyfile/options.go:383— httpcaddyfile.parseOptOnDemand 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.
caddycmd.cmdAdaptConfig (cyclomatic 16) cmd/commandfuncs.go:552— caddycmd.cmdAdaptConfig 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.
caddycmd.parseEnvFile (cyclomatic 16) cmd/main.go:385— caddycmd.parseEnvFile 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.
caddyhttp.CELMatcherDecorator (cyclomatic 16) modules/caddyhttp/celmatcher.go:469— caddyhttp.CELMatcherDecorator has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 470). 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.
caddyhttp.CELValueToMapStrList (cyclomatic 16) modules/caddyhttp/celmatcher.go:669— caddyhttp.CELValueToMapStrList has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Encode.UnmarshalCaddyfile (cyclomatic 16) modules/caddyhttp/encode/caddyfile.go:59— Encode.UnmarshalCaddyfile 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.
MatchPath.MatchWithError (cyclomatic 16) modules/caddyhttp/matchers.go:429— MatchPath.MatchWithError 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.
CustomCertSelectionPolicy.SelectCertificate (cyclomatic 16) modules/caddytls/certselection.go:56— CustomCertSelectionPolicy.SelectCertificate 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.
ClientAuthentication.ConfigureTLSConfig (cyclomatic 16) modules/caddytls/connpolicy.go:834— ClientAuthentication.ConfigureTLSConfig 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.
ECH.rotateECHKeys (cyclomatic 16) modules/caddytls/ech.go:190— ECH.rotateECHKeys has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Handler.UnmarshalCaddyfile (cognitive 512) modules/caddyhttp/reverseproxy/caddyfile.go:143— Handler.UnmarshalCaddyfile has cognitive complexity 512 (threshold 15). Drivers by points: if/else 465, boolean chains 19, loops 16, match/switch 12 (nesting depth added 321). Of this number, 501 points are the body's own statements and 11 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.
ServerType.serversFromPairings (cognitive 322) caddyconfig/httpcaddyfile/httptype.go:551— ServerType.serversFromPairings has cognitive complexity 322 (threshold 15). Drivers by points: if/else 213, loops 85, boolean chains 21, match/switch 3 (nesting depth added 210). Of this number, 284 points are the body's own statements and 38 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.
ServerType.buildTLSApp (cognitive 283) caddyconfig/httpcaddyfile/tlsapp.go:36— ServerType.buildTLSApp has cognitive complexity 283 (threshold 15). Drivers by points: if/else 193, loops 76, boolean chains 14 (nesting depth added 170). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.parseTLS (cognitive 226) caddyconfig/httpcaddyfile/builtins.go:118— httpcaddyfile.parseTLS has cognitive complexity 226 (threshold 15). Drivers by points: if/else 202, loops 12, boolean chains 8, match/switch 4 (nesting depth added 131). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTTPTransport.UnmarshalCaddyfile (cognitive 214) modules/caddyhttp/reverseproxy/caddyfile.go:1018— HTTPTransport.UnmarshalCaddyfile has cognitive complexity 214 (threshold 15). Drivers by points: if/else 202, match/switch 11, loops 1 (nesting depth added 142). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.automaticHTTPSPhase1 (cognitive 179) modules/caddyhttp/autohttps.go:77— App.automaticHTTPSPhase1 has cognitive complexity 179 (threshold 15). Drivers by points: if/else 115, loops 46, boolean chains 16, jumps 2 (nesting depth added 100). Of this number, 162 points are the body's own statements and 17 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.
httpcaddyfile.unmarshalCaddyfileServerOptions (cognitive 177) caddyconfig/httpcaddyfile/serveroptions.go:66— httpcaddyfile.unmarshalCaddyfileServerOptions has cognitive complexity 177 (threshold 15). Drivers by points: if/else 146, loops 19, match/switch 10, boolean chains 2 (nesting depth added 123). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ACMEIssuer.UnmarshalCaddyfile (cognitive 168) modules/caddytls/acmeissuer.go:448— ACMEIssuer.UnmarshalCaddyfile has cognitive complexity 168 (threshold 15). Drivers by points: if/else 165, match/switch 2, loops 1 (nesting depth added 110). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.consolidateConnPolicies (cognitive 165) caddyconfig/httpcaddyfile/httptype.go:1091— httpcaddyfile.consolidateConnPolicies has cognitive complexity 165 (threshold 15). Drivers by points: if/else 135, boolean chains 22, loops 8 (nesting depth added 109). Of this number, 164 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.
caddyfile.Format (cognitive 158) caddyconfig/caddyfile/formatter.go:30— caddyfile.Format has cognitive complexity 158 (threshold 15). Drivers by points: if/else 125, boolean chains 21, match/switch 8, loops 4 (nesting depth added 77). Of this number, 151 points are the body's own statements and 7 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.
httpcaddyfile.parsePKIApp (cognitive 140) caddyconfig/httpcaddyfile/pkiapp.go:55— httpcaddyfile.parsePKIApp has cognitive complexity 140 (threshold 15). Drivers by points: if/else 107, match/switch 18, loops 14, boolean chains 1 (nesting depth added 111). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddyhttp.addHTTPVarsToReplacer (cognitive 133) modules/caddyhttp/replacer.go:58— caddyhttp.addHTTPVarsToReplacer has cognitive complexity 133 (threshold 15). Drivers by points: if/else 121, boolean chains 6, loops 3, match/switch 3 (nesting depth added 79). Most of this is not in the body itself: 0 of the 133 points are its own statements and the rest belongs to one function literal inside it that branches (line 62). 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.
TLS.publishECHConfigs (cognitive 130) modules/caddytls/ech.go:314— TLS.publishECHConfigs has cognitive complexity 130 (threshold 15). Drivers by points: if/else 75, loops 53, boolean chains 2 (nesting depth added 88). Of this number, 129 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.
httpcaddyfile.parseLogHelper (cognitive 128) caddyconfig/httpcaddyfile/builtins.go:941— httpcaddyfile.parseLogHelper has cognitive complexity 128 (threshold 15). Drivers by points: if/else 106, loops 13, match/switch 9 (nesting depth added 83). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileServer.ServeHTTP (cognitive 124) modules/caddyhttp/fileserver/staticfiles.go:269— FileServer.ServeHTTP has cognitive complexity 124 (threshold 15). Drivers by points: if/else 109, boolean chains 12, loops 3 (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.
ServerType.Setup (cognitive 119) caddyconfig/httpcaddyfile/httptype.go:57— ServerType.Setup has cognitive complexity 119 (threshold 15). Drivers by points: if/else 80, loops 31, boolean chains 8 (nesting depth added 54). Of this number, 115 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.
caddy.unsyncedConfigAccess (cognitive 114) admin.go:1159— caddy.unsyncedConfigAccess has cognitive complexity 114 (threshold 15). Drivers by points: if/else 97, match/switch 10, boolean chains 5, jumps 1, loops 1 (nesting depth added 76). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
lexer.next (cognitive 112) caddyconfig/caddyfile/lexer.go:107— lexer.next has cognitive complexity 112 (threshold 15). Drivers by points: if/else 100, boolean chains 11, loops 1 (nesting depth added 64). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.Provision (cognitive 103) modules/caddyhttp/app.go:186— App.Provision has cognitive complexity 103 (threshold 15). Drivers by points: if/else 84, loops 16, boolean chains 3 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
HTTPTransport.NewTransport (cognitive 101) modules/caddyhttp/reverseproxy/httptransport.go:207— HTTPTransport.NewTransport has cognitive complexity 101 (threshold 15). Drivers by points: if/else 85, boolean chains 8, match/switch 8 (nesting depth added 42). Of this number, 60 points are the body's own statements and 41 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileWriter.UnmarshalCaddyfile (cognitive 101) modules/logging/filewriter.go:379— FileWriter.UnmarshalCaddyfile has cognitive complexity 101 (threshold 15). Drivers by points: if/else 78, loops 15, match/switch 8 (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser.doImport (cognitive 100) caddyconfig/caddyfile/parse.go:356— parser.doImport has cognitive complexity 100 (threshold 15). Drivers by points: if/else 71, loops 16, boolean chains 9, match/switch 4 (nesting depth added 46). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.Start (cognitive 100) modules/caddyhttp/app.go:465— App.Start has cognitive complexity 100 (threshold 15). Drivers by points: if/else 73, loops 19, boolean chains 8 (nesting depth added 65). Of this number, 98 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.
HeaderOps.ApplyTo (cognitive 93) modules/caddyhttp/headers/headers.go:220— HeaderOps.ApplyTo has cognitive complexity 93 (threshold 15). Drivers by points: if/else 51, loops 39, match/switch 2, boolean chains 1 (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileServer.UnmarshalCaddyfile (cognitive 87) modules/caddyhttp/fileserver/caddyfile.go:67— FileServer.UnmarshalCaddyfile has cognitive complexity 87 (threshold 15). Drivers by points: if/else 62, match/switch 13, loops 12 (nesting depth added 61). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLS.Provision (cognitive 76) modules/caddytls/tls.go:162— TLS.Provision has cognitive complexity 76 (threshold 15). Drivers by points: if/else 59, loops 12, boolean chains 3, match/switch 2 (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.createAutomationPolicies (cognitive 75) modules/caddyhttp/autohttps.go:597— App.createAutomationPolicies has cognitive complexity 75 (threshold 15). Drivers by points: if/else 66, loops 7, boolean chains 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MatchFile.selectFile (cognitive 75) modules/caddyhttp/fileserver/matcher.go:333— MatchFile.selectFile has cognitive complexity 75 (threshold 15). Drivers by points: if/else 47, loops 21, boolean chains 5, match/switch 2 (nesting depth added 38). Of this number, 60 points are the body's own statements and 15 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.
Handler.Provision (cognitive 73) modules/caddyhttp/reverseproxy/reverseproxy.go:262— Handler.Provision has cognitive complexity 73 (threshold 15). Drivers by points: if/else 67, boolean chains 3, loops 3 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.ServeHTTP (cognitive 73) modules/caddyhttp/server.go:421— Server.ServeHTTP has cognitive complexity 73 (threshold 15). Drivers by points: if/else 61, loops 8, boolean chains 4 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fastcgi.parsePHPFastCGI (cognitive 72) modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:172— fastcgi.parsePHPFastCGI has cognitive complexity 72 (threshold 15). Drivers by points: if/else 65, loops 4, match/switch 3 (nesting depth added 45). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
reverseproxy.cmdReverseProxy (cognitive 66) modules/caddyhttp/reverseproxy/command.go:87— reverseproxy.cmdReverseProxy has cognitive complexity 66 (threshold 15). Drivers by points: if/else 48, loops 9, boolean chains 6, match/switch 3 (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.
ConnectionPolicy.UnmarshalCaddyfile (cognitive 64) modules/caddytls/connpolicy.go:481— ConnectionPolicy.UnmarshalCaddyfile has cognitive complexity 64 (threshold 15). Drivers by points: if/else 60, match/switch 2, boolean chains 1, loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ZeroSSLIssuer.UnmarshalCaddyfile (cognitive 64) modules/caddytls/zerosslissuer.go:138— ZeroSSLIssuer.UnmarshalCaddyfile has cognitive complexity 64 (threshold 15). Drivers by points: if/else 61, match/switch 2, loops 1 (nesting depth added 40). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.fillInGlobalACMEDefaults (cognitive 63) caddyconfig/httpcaddyfile/tlsapp.go:516— httpcaddyfile.fillInGlobalACMEDefaults has cognitive complexity 63 (threshold 15). Drivers by points: if/else 40, boolean chains 23 (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.
Rewrite.Rewrite (cognitive 57) modules/caddyhttp/rewrite/rewrite.go:158— Rewrite.Rewrite has cognitive complexity 57 (threshold 15). Drivers by points: if/else 43, boolean chains 6, loops 4, match/switch 3, jumps 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AUpstreams.UnmarshalCaddyfile (cognitive 56) modules/caddyhttp/reverseproxy/caddyfile.go:1562— AUpstreams.UnmarshalCaddyfile has cognitive complexity 56 (threshold 15). Drivers by points: if/else 46, match/switch 6, loops 4 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ClientAuthentication.UnmarshalCaddyfile (cognitive 56) modules/caddytls/connpolicy.go:654— ClientAuthentication.UnmarshalCaddyfile has cognitive complexity 56 (threshold 15). Drivers by points: if/else 52, loops 2, match/switch 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
acmeserver.parseACMEServer (cognitive 55) modules/caddypki/acmeserver/caddyfile.go:45— acmeserver.parseACMEServer has cognitive complexity 55 (threshold 15). Drivers by points: if/else 38, match/switch 10, loops 7 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectionPolicies.TLSConfig (cognitive 54) modules/caddytls/connpolicy.go:98— ConnectionPolicies.TLSConfig has cognitive complexity 54 (threshold 15). Drivers by points: loops 29, if/else 23, boolean chains 1, jumps 1 (nesting depth added 35). Of this number, 44 points are the body's own statements and 10 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.
Handler.doActiveHealthCheck (cognitive 53) modules/caddyhttp/reverseproxy/healthchecks.go:391— Handler.doActiveHealthCheck has cognitive complexity 53 (threshold 15). Drivers by points: if/else 49, loops 3, boolean chains 1 (nesting depth added 19). Of this number, 38 points are the body's own statements and 15 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.
SRVUpstreams.UnmarshalCaddyfile (cognitive 53) modules/caddyhttp/reverseproxy/caddyfile.go:1456— SRVUpstreams.UnmarshalCaddyfile has cognitive complexity 53 (threshold 15). Drivers by points: if/else 50, match/switch 2, 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.
Context.LoadModule (cognitive 50) context.go:188— Context.LoadModule has cognitive complexity 50 (threshold 15). Drivers by points: if/else 35, loops 13, boolean chains 1, match/switch 1 (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Handler.reverseProxy (cognitive 50) modules/caddyhttp/reverseproxy/reverseproxy.go:991— Handler.reverseProxy has cognitive complexity 50 (threshold 15). Drivers by points: if/else 39, loops 6, boolean chains 5 (nesting depth added 21). Of this number, 49 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.
ACMEIssuer.Provision (cognitive 50) modules/caddytls/acmeissuer.go:129— ACMEIssuer.Provision has cognitive complexity 50 (threshold 15). Drivers by points: if/else 46, boolean chains 2, loops 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddyhttp.getReqTLSReplacement (cognitive 49) modules/caddyhttp/replacer.go:414— caddyhttp.getReqTLSReplacement has cognitive complexity 49 (threshold 15). Drivers by points: if/else 37, match/switch 9, boolean chains 3 (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.
httpcaddyfile.consolidateAutomationPolicies (cognitive 48) caddyconfig/httpcaddyfile/tlsapp.go:969— httpcaddyfile.consolidateAutomationPolicies has cognitive complexity 48 (threshold 15). Drivers by points: if/else 33, loops 9, boolean chains 4, jumps 2 (nesting depth added 26). Of this number, 46 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.
reverseproxy.parseUpstreamDialAddress (cognitive 48) modules/caddyhttp/reverseproxy/addresses.go:65— reverseproxy.parseUpstreamDialAddress has cognitive complexity 48 (threshold 15). Drivers by points: if/else 39, boolean chains 6, match/switch 3 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
RemoteAdmin.enforceAccessControls (cognitive 47) admin.go:668— RemoteAdmin.enforceAccessControls has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24, loops 21, boolean chains 2 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
forwardauth.parseCaddyfile (cognitive 47) modules/caddyhttp/reverseproxy/forwardauth/caddyfile.go:64— forwardauth.parseCaddyfile has cognitive complexity 47 (threshold 15). Drivers by points: if/else 31, loops 13, match/switch 3 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddyhttp.cmdRespond (cognitive 46) modules/caddyhttp/staticresp.go:316— caddyhttp.cmdRespond has cognitive complexity 46 (threshold 15). Drivers by points: if/else 32, loops 8, boolean chains 5, match/switch 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.
Handler.proxyLoopIteration (cognitive 46) modules/caddyhttp/reverseproxy/reverseproxy.go:603— Handler.proxyLoopIteration has cognitive complexity 46 (threshold 15). Drivers by points: if/else 42, loops 3, boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLSConfig.MakeTLSClientConfig (cognitive 45) modules/caddyhttp/reverseproxy/httptransport.go:790— TLSConfig.MakeTLSClientConfig has cognitive complexity 45 (threshold 15). Drivers by points: if/else 32, loops 7, boolean chains 5, match/switch 1 (nesting depth added 17). Of this number, 38 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.
caddy.Version (cognitive 44) caddy.go:1003— caddy.Version has cognitive complexity 44 (threshold 15). Drivers by points: if/else 37, loops 3, match/switch 3, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
App.Stop (cognitive 44) modules/caddyhttp/app.go:674— App.Stop has cognitive complexity 44 (threshold 15). Drivers by points: if/else 27, loops 15, boolean chains 2 (nesting depth added 17). Of this number, 28 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.serveHTTP (cognitive 44) modules/caddyhttp/server.go:582— Server.serveHTTP has cognitive complexity 44 (threshold 15). Drivers by points: if/else 39, loops 4, 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.
caddy.finishSettingUp (cognitive 43) caddy.go:594— caddy.finishSettingUp has cognitive complexity 43 (threshold 15). Drivers by points: if/else 35, match/switch 4, loops 3, boolean chains 1 (nesting depth added 27). Most of this is not in the body itself: 12 of the 43 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 636, 621). 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.
AutomationPolicy.makeCertMagicConfig (cognitive 43) modules/caddytls/automation.go:272— AutomationPolicy.makeCertMagicConfig has cognitive complexity 43 (threshold 15). Drivers by points: if/else 37, boolean chains 6 (nesting depth added 20). Of this number, 16 points are the body's own statements and 27 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.
caddy.listenReusable (cognitive 41) listen_unix.go:94— caddy.listenReusable has cognitive complexity 41 (threshold 15). Drivers by points: if/else 41 (nesting depth added 18). Of this number, 31 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.
ServerType.mapAddressToProtocolToServerBlocks (cognitive 41) caddyconfig/httpcaddyfile/addresses.go:80— ServerType.mapAddressToProtocolToServerBlocks has cognitive complexity 41 (threshold 15). Drivers by points: loops 24, if/else 17 (nesting depth added 27). 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.
caddycmd.cmdRun (cognitive 41) cmd/commandfuncs.go:188— caddycmd.cmdRun has cognitive complexity 41 (threshold 15). Drivers by points: if/else 35, boolean chains 4, match/switch 2 (nesting depth added 12). Of this number, 39 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
queryOps.do (cognitive 41) modules/caddyhttp/rewrite/rewrite.go:562— queryOps.do has cognitive complexity 41 (threshold 15). Drivers by points: if/else 26, loops 14, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddycmd.loadConfigWithLogger (cognitive 40) cmd/main.go:146— caddycmd.loadConfigWithLogger has cognitive complexity 40 (threshold 15). Drivers by points: if/else 37, loops 2, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FilterEncoder.UnmarshalCaddyfile (cognitive 40) modules/logging/filterencoder.go:152— FilterEncoder.UnmarshalCaddyfile has cognitive complexity 40 (threshold 15). Drivers by points: if/else 30, loops 8, match/switch 2 (nesting depth added 20). Of this number, 33 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.
caddycmd.cmdListModules (cognitive 39) cmd/commandfuncs.go:438— caddycmd.cmdListModules has cognitive complexity 39 (threshold 15). Drivers by points: if/else 23, loops 11, boolean chains 5 (nesting depth added 14). Of this number, 27 points are the body's own statements and 12 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.
Transport.UnmarshalCaddyfile (cognitive 39) modules/caddyhttp/reverseproxy/fastcgi/caddyfile.go:50— Transport.UnmarshalCaddyfile has cognitive complexity 39 (threshold 15). Drivers by points: if/else 36, match/switch 2, loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddytls.tlsCertFromCertAndKeyPEMBundle (cognitive 39) modules/caddytls/folderloader.go:106— caddytls.tlsCertFromCertAndKeyPEMBundle has cognitive complexity 39 (threshold 15). Drivers by points: if/else 36, boolean chains 2, 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.
App.Emit (cognitive 38) modules/caddyevents/app.go:207— App.Emit has cognitive complexity 38 (threshold 15). Drivers by points: if/else 27, loops 6, match/switch 5 (nesting depth added 21). Of this number, 34 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.
FileServer.Provision (cognitive 38) modules/caddyhttp/fileserver/staticfiles.go:194— FileServer.Provision has cognitive complexity 38 (threshold 15). Drivers by points: if/else 28, loops 4, boolean chains 3, match/switch 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Handler.doActiveHealthCheckForAllHosts (cognitive 38) modules/caddyhttp/reverseproxy/healthchecks.go:297— Handler.doActiveHealthCheckForAllHosts has cognitive complexity 38 (threshold 15). Drivers by points: if/else 35, boolean chains 2, loops 1 (nesting depth added 20). Most of this is not in the body itself: 1 of the 38 points is its own statement and the rest belongs to one function literal inside it that branches (line 299). 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.
Replacer.replace (cognitive 38) replacer.go:175— Replacer.replace has cognitive complexity 38 (threshold 15). Drivers by points: if/else 30, boolean chains 4, loops 3, jumps 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.
parser.addresses (cognitive 37) caddyconfig/caddyfile/parse.go:210— parser.addresses has cognitive complexity 37 (threshold 15). Drivers by points: if/else 32, boolean chains 4, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerType.evaluateGlobalOptionsBlock (cognitive 37) caddyconfig/httpcaddyfile/httptype.go:370— ServerType.evaluateGlobalOptionsBlock has cognitive complexity 37 (threshold 15). Drivers by points: if/else 33, loops 3, boolean chains 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddycmd.cmdExportStorage (cognitive 37) cmd/storagefuncs.go:136— caddycmd.cmdExportStorage has cognitive complexity 37 (threshold 15). Drivers by points: if/else 35, 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.
MatchPath.matchPatternWithEscapeSequence (cognitive 37) modules/caddyhttp/matchers.go:537— MatchPath.matchPatternWithEscapeSequence has cognitive complexity 37 (threshold 15). Drivers by points: if/else 31, boolean chains 3, match/switch 2, 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.
CustomCertSelectionPolicy.SelectCertificate (cognitive 37) modules/caddytls/certselection.go:56— CustomCertSelectionPolicy.SelectCertificate has cognitive complexity 37 (threshold 15). Drivers by points: if/else 28, loops 7, boolean chains 1, jumps 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
FileWriter.OpenWriter (cognitive 37) modules/logging/filewriter.go:187— FileWriter.OpenWriter has cognitive complexity 37 (threshold 15). Drivers by points: if/else 33, boolean chains 3, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerType.consolidateAddrMappings (cognitive 36) caddyconfig/httpcaddyfile/addresses.go:195— ServerType.consolidateAddrMappings has cognitive complexity 36 (threshold 15). Drivers by points: loops 23, if/else 11, boolean chains 2 (nesting depth added 23). 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.
FileServer.directoryListing (cognitive 36) modules/caddyhttp/fileserver/browsetplcontext.go:37— FileServer.directoryListing has cognitive complexity 36 (threshold 15). Drivers by points: if/else 32, boolean chains 3, loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ConnectionPolicy.buildStandardTLSConfig (cognitive 36) modules/caddytls/connpolicy.go:269— ConnectionPolicy.buildStandardTLSConfig has cognitive complexity 36 (threshold 15). Drivers by points: if/else 30, boolean chains 4, loops 2 (nesting depth added 10). Of this number, 32 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.
MatchPath.MatchWithError (cognitive 35) modules/caddyhttp/matchers.go:429— MatchPath.MatchWithError has cognitive complexity 35 (threshold 15). Drivers by points: if/else 33, boolean chains 1, loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerType.listenersForServerBlockAddress (cognitive 34) caddyconfig/httpcaddyfile/addresses.go:270— ServerType.listenersForServerBlockAddress has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20, loops 10, boolean chains 3, match/switch 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CustomLog.loggerAllowed (cognitive 34) logging.go:533— CustomLog.loggerAllowed has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21, boolean chains 9, loops 4 (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.
FileServer.serveBrowse (cognitive 34) modules/caddyhttp/fileserver/browse.go:78— FileServer.serveBrowse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 28, boolean chains 2, loops 2, match/switch 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CustomCertSelectionPolicy.UnmarshalCaddyfile (cognitive 34) modules/caddytls/certselection.go:125— CustomCertSelectionPolicy.UnmarshalCaddyfile has cognitive complexity 34 (threshold 15). Drivers by points: if/else 28, loops 4, match/switch 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Context.LoadModuleByID (cognitive 33) context.go:364— Context.LoadModuleByID has cognitive complexity 33 (threshold 15). Drivers by points: if/else 33 (nesting depth added 15). Of this number, 31 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.
templates.parseCaddyfile (cognitive 33) modules/caddyhttp/templates/caddyfile.go:36— templates.parseCaddyfile has cognitive complexity 33 (threshold 15). Drivers by points: if/else 27, loops 4, match/switch 2 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerType.compileEncodedMatcherSets (cognitive 32) caddyconfig/httpcaddyfile/httptype.go:1488— ServerType.compileEncodedMatcherSets has cognitive complexity 32 (threshold 15). Drivers by points: if/else 22, boolean chains 5, loops 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ECH.rotateECHKeys (cognitive 32) modules/caddytls/ech.go:190— ECH.rotateECHKeys has cognitive complexity 32 (threshold 15). Drivers by points: if/else 27, loops 3, boolean chains 2 (nesting depth added 17). Of this number, 30 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.
Metrics.scanConfigForHosts (cognitive 31) modules/caddyhttp/metrics.go:232— Metrics.scanConfigForHosts has cognitive complexity 31 (threshold 15). Drivers by points: loops 16, if/else 15 (nesting depth added 22). 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.
Handler.addForwardedHeaders (cognitive 31) modules/caddyhttp/reverseproxy/reverseproxy.go:889— Handler.addForwardedHeaders has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25, boolean chains 3, 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.
ECHDNSPublisher.PublishECHConfigList (cognitive 31) modules/caddytls/ech.go:821— ECHDNSPublisher.PublishECHConfigList has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25, loops 3, boolean chains 2, jumps 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.
TLS.Start (cognitive 31) modules/caddytls/tls.go:401— TLS.Start has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21, loops 4, boolean chains 3, match/switch 3 (nesting depth added 16). Of this number, 16 points are the body's own statements and 15 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.
httpcaddyfile.detectConflictingSchemes (cognitive 30) caddyconfig/httpcaddyfile/httptype.go:1031— httpcaddyfile.detectConflictingSchemes has cognitive complexity 30 (threshold 15). Drivers by points: if/else 24, boolean chains 3, loops 3 (nesting depth added 13). Of this number, 24 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.
Encode.UnmarshalCaddyfile (cognitive 30) modules/caddyhttp/encode/caddyfile.go:59— Encode.UnmarshalCaddyfile has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, loops 2, match/switch 2, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
headers.parseCaddyfile (cognitive 30) modules/caddyhttp/headers/caddyfile.go:49— headers.parseCaddyfile has cognitive complexity 30 (threshold 15). Drivers by points: if/else 29, 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.
rewrite.parseCaddyfileURI (cognitive 30) modules/caddyhttp/rewrite/caddyfile.go:97— rewrite.parseCaddyfileURI has cognitive complexity 30 (threshold 15). Drivers by points: if/else 25, match/switch 3, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddy.changeConfig (cognitive 29) caddy.go:158— caddy.changeConfig has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26, boolean chains 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.parseHandleErrors (cognitive 29) caddyconfig/httpcaddyfile/builtins.go:828— httpcaddyfile.parseHandleErrors has cognitive complexity 29 (threshold 15). Drivers by points: if/else 27, loops 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.appendSubrouteToRouteList (cognitive 29) caddyconfig/httpcaddyfile/httptype.go:1254— httpcaddyfile.appendSubrouteToRouteList has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15, loops 9, boolean chains 4, jumps 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.
httpcaddyfile.parseOptOnDemand (cognitive 29) caddyconfig/httpcaddyfile/options.go:383— httpcaddyfile.parseOptOnDemand has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26, match/switch 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddyhttp.ParseNamedResponseMatcher (cognitive 29) modules/caddyhttp/responsematchers.go:69— caddyhttp.ParseNamedResponseMatcher has cognitive complexity 29 (threshold 15). Drivers by points: if/else 21, loops 4, boolean chains 2, match/switch 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fileserver.cmdFileServer (cognitive 29) modules/caddyhttp/fileserver/command.go:86— fileserver.cmdFileServer has cognitive complexity 29 (threshold 15). Drivers by points: if/else 26, loops 2, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MatchHost.MatchWithError (cognitive 29) modules/caddyhttp/matchers.go:307— MatchHost.MatchWithError has cognitive complexity 29 (threshold 15). Drivers by points: if/else 22, loops 4, boolean chains 2, jumps 1 (nesting depth added 14). Of this number, 27 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Tracing.UnmarshalCaddyfile (cognitive 29) modules/caddyhttp/tracing/module.go:80— Tracing.UnmarshalCaddyfile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 23, loops 4, match/switch 2 (nesting depth added 16). Of this number, 26 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.
httpcaddyfile.buildSubroute (cognitive 28) caddyconfig/httpcaddyfile/httptype.go:1317— httpcaddyfile.buildSubroute has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18, loops 7, match/switch 2, boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddyhttp.matchHeaders (cognitive 28) modules/caddyhttp/matchers.go:1150— caddyhttp.matchHeaders has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14, loops 6, match/switch 4, boolean chains 3, jumps 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.
caddyauth.cmdHashPassword (cognitive 28) modules/caddyhttp/caddyauth/command.go:89— caddyauth.cmdHashPassword has cognitive complexity 28 (threshold 15). Drivers by points: if/else 27, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Authentication.ServeHTTP (cognitive 28) modules/caddyhttp/caddyauth/caddyauth.go:89— Authentication.ServeHTTP has cognitive complexity 28 (threshold 15). Drivers by points: if/else 26, 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.
RequestBody.ServeHTTP (cognitive 28) modules/caddyhttp/requestbody/requestbody.go:67— RequestBody.ServeHTTP has cognitive complexity 28 (threshold 15). Drivers by points: if/else 27, boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LoadBalancing.tryAgain (cognitive 28) modules/caddyhttp/reverseproxy/reverseproxy.go:1342— LoadBalancing.tryAgain has cognitive complexity 28 (threshold 15). Drivers by points: if/else 21, boolean chains 6, 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.
CookieHashSelection.UnmarshalCaddyfile (cognitive 28) modules/caddyhttp/reverseproxy/selectionpolicies.go:742— CookieHashSelection.UnmarshalCaddyfile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 24, match/switch 3, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddycmd.parseEnvFile (cognitive 27) cmd/main.go:385— caddycmd.parseEnvFile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19, boolean chains 4, loops 4 (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.
Intercept.UnmarshalCaddyfile (cognitive 27) modules/caddyhttp/intercept/intercept.go:232— Intercept.UnmarshalCaddyfile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, 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.
maphandler.parseCaddyfile (cognitive 27) modules/caddyhttp/map/caddyfile.go:44— maphandler.parseCaddyfile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, 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.
Handler.finalizeResponse (cognitive 27) modules/caddyhttp/reverseproxy/reverseproxy.go:1218— Handler.finalizeResponse has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17, loops 6, boolean chains 4 (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.
StaticResponse.ServeHTTP (cognitive 27) modules/caddyhttp/staticresp.go:181— StaticResponse.ServeHTTP has cognitive complexity 27 (threshold 15). Drivers by points: if/else 18, boolean chains 6, 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.
CA.Provision (cognitive 27) modules/caddypki/ca.go:99— CA.Provision has cognitive complexity 27 (threshold 15). Drivers by points: if/else 25, boolean chains 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.
caddytls.ParseCaddyfilePreferredChainsOptions (cognitive 27) modules/caddytls/acmeissuer.go:699— caddytls.ParseCaddyfilePreferredChainsOptions has cognitive complexity 27 (threshold 15). Drivers by points: if/else 23, match/switch 2, 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.
AutomationPolicy.Provision (cognitive 27) modules/caddytls/automation.go:182— AutomationPolicy.Provision has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, loops 6, 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.
TLSConfig.unmarshalCaddyfile (cognitive 27) modules/caddytls/capools.go:539— TLSConfig.unmarshalCaddyfile has cognitive complexity 27 (threshold 15). Drivers by points: if/else 21, match/switch 5, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLS.Cleanup (cognitive 27) modules/caddytls/tls.go:478— TLS.Cleanup has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20, loops 4, boolean chains 3 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parser.directive (cognitive 26) caddyconfig/caddyfile/parse.go:636— parser.directive has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, boolean chains 5, 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.
caddyhttp.CELValueToMapStrList (cognitive 26) modules/caddyhttp/celmatcher.go:669— caddyhttp.CELValueToMapStrList has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11, loops 9, match/switch 6 (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.
Transport.buildEnv (cognitive 26) modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:257— Transport.buildEnv has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, loops 4, boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Transport.splitPos (cognitive 26) modules/caddyhttp/reverseproxy/fastcgi/fastcgi.go:433— Transport.splitPos has cognitive complexity 26 (threshold 15). Drivers by points: if/else 18, loops 6, boolean chains 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Handler.ServeHTTP (cognitive 26) modules/caddyhttp/reverseproxy/reverseproxy.go:485— Handler.ServeHTTP has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21, boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
httpcaddyfile.parseSegmentAsConfig (cognitive 25) caddyconfig/httpcaddyfile/directives.go:356— httpcaddyfile.parseSegmentAsConfig has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, loops 10 (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.
Intercept.ServeHTTP (cognitive 25) modules/caddyhttp/intercept/intercept.go:115— Intercept.ServeHTTP has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, boolean chains 3, loops 2 (nesting depth added 6). Of this number, 15 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
push.parseCaddyfile (cognitive 25) modules/caddyhttp/push/caddyfile.go:46— push.parseCaddyfile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15, 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.
Handler.prepareRequest (cognitive 25) modules/caddyhttp/reverseproxy/reverseproxy.go:763— Handler.prepareRequest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18, boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
AppendEncoder.UnmarshalCaddyfile (cognitive 25) modules/logging/appendencoder.go:130— AppendEncoder.UnmarshalCaddyfile has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, loops 4, match/switch 2 (nesting depth added 14). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
requestbody.parseCaddyfile (cognitive 24) modules/caddyhttp/requestbody/caddyfile.go:30— requestbody.parseCaddyfile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21, 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.
SRVUpstreams.GetUpstreams (cognitive 24) modules/caddyhttp/reverseproxy/upstreams.go:134— SRVUpstreams.GetUpstreams has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20, 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.
HTTPCertPool.Provision (cognitive 24) modules/caddytls/capools.go:660— HTTPCertPool.Provision has cognitive complexity 24 (threshold 15). Drivers by points: if/else 20, loops 3, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLS.HandleHTTPChallenge (cognitive 24) modules/caddytls/tls.go:766— TLS.HandleHTTPChallenge has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 4, 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.
IPMaskFilter.UnmarshalCaddyfile (cognitive 24) modules/logging/filters.go:171— IPMaskFilter.UnmarshalCaddyfile has cognitive complexity 24 (threshold 15). Drivers by points: if/else 21, 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.
httpcaddyfile.applyServerOptions (cognitive 23) caddyconfig/httpcaddyfile/serveroptions.go:342— httpcaddyfile.applyServerOptions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, loops 3, boolean chains 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ServerType.buildPKIApp (cognitive 23) caddyconfig/httpcaddyfile/pkiapp.go:197— ServerType.buildPKIApp has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, loops 7, 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.
HTTPLoader.makeClient (cognitive 23) caddyconfig/httploader.go:170— HTTPLoader.makeClient has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, loops 3, 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.
caddycmd.cmdImportStorage (cognitive 23) cmd/storagefuncs.go:64— caddycmd.cmdImportStorage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 21, 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.
ConnectionPolicies.Provision (cognitive 23) modules/caddytls/connpolicy.go:52— ConnectionPolicies.Provision has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, loops 6, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddy.indexConfigObjects (cognitive 22) caddy.go:290— caddy.indexConfigObjects has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, match/switch 5, loops 4 (nesting depth added 14). 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.
App.Validate (cognitive 22) modules/caddyhttp/app.go:411— App.Validate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, loops 9 (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.
MatchFile.UnmarshalCaddyfile (cognitive 22) modules/caddyhttp/fileserver/matcher.go:132— MatchFile.UnmarshalCaddyfile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, loops 3, match/switch 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.
headers.applyHeaderOp (cognitive 22) modules/caddyhttp/headers/caddyfile.go:225— headers.applyHeaderOp has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
rewrite.buildQueryString (cognitive 22) modules/caddyhttp/rewrite/rewrite.go:336— rewrite.buildQueryString has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13, boolean chains 6, match/switch 2, loops 1 (nesting depth added 7). Of this number, 17 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLS.Manage (cognitive 22) modules/caddytls/tls.go:561— TLS.Manage has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, loops 4, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddycmd.cmdFmt (cognitive 21) cmd/commandfuncs.go:685— caddycmd.cmdFmt has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 3, match/switch 3, loops 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.
caddyhttp.CELMatcherDecorator (cognitive 21) modules/caddyhttp/celmatcher.go:469— caddyhttp.CELMatcherDecorator has cognitive complexity 21 (threshold 15). Drivers by points: if/else 19, boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 0 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 470). 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.
Zstd.UnmarshalCaddyfile (cognitive 21) modules/caddyhttp/encode/zstd/zstd.go:53— Zstd.UnmarshalCaddyfile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, match/switch 3, 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.
fileserver.parseTryFiles (cognitive 21) modules/caddyhttp/fileserver/caddyfile.go:259— fileserver.parseTryFiles has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14, match/switch 5, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fileserver.fileHidden (cognitive 21) modules/caddyhttp/fileserver/staticfiles.go:684— fileserver.fileHidden has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, loops 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ActiveHealthChecks.Provision (cognitive 21) modules/caddyhttp/reverseproxy/healthchecks.go:137— ActiveHealthChecks.Provision has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, loops 4 (nesting depth added 4). Of this number, 20 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
StoragePool.Provision (cognitive 21) modules/caddytls/capools.go:406— StoragePool.Provision has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, loops 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
TLS.cleanStorageUnits (cognitive 21) modules/caddytls/tls.go:930— TLS.cleanStorageUnits has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, loops 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.
ServerType.extractNamedRoutes (cognitive 20) caddyconfig/httpcaddyfile/httptype.go:460— ServerType.extractNamedRoutes has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, loops 6, 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.
caddycmd.cmdStart (cognitive 20) cmd/commandfuncs.go:45— caddycmd.cmdStart has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, loops 2, match/switch 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 8 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.
caddycmd.cmdAdaptConfig (cognitive 20) cmd/commandfuncs.go:552— caddycmd.cmdAdaptConfig has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
NetworkAddress.listen (cognitive 20) listeners.go:150— NetworkAddress.listen has cognitive complexity 20 (threshold 15). Drivers by points: if/else 19, 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.
Logging.Logger (cognitive 20) logging.go:219— Logging.Logger has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, loops 2, 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.
TLS.Validate (cognitive 20) modules/caddytls/tls.go:369— TLS.Validate 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.
caddy.provisionContext (cognitive 19) caddy.go:484— caddy.provisionContext has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, loops 1 (nesting depth added 5). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 540, 505, 573). 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.
httpcaddyfile.newBaseAutomationPolicy (cognitive 19) caddyconfig/httpcaddyfile/tlsapp.go:903— httpcaddyfile.newBaseAutomationPolicy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
caddycmd.getModules (cognitive 19) cmd/packagesfuncs.go:216— caddycmd.getModules has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 3, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
CustomLog.provision (cognitive 19) logging.go:490— CustomLog.provision has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, loops 7, boolean chains 2, jumps 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.
Intercept.FinalizeUnmarshalCaddyfile (cognitive 19) modules/caddyhttp/intercept/intercept.go:300— Intercept.FinalizeUnmarshalCaddyfile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, 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.
Handler.FinalizeUnmarshalCaddyfile (cognitive 19) modules/caddyhttp/reverseproxy/caddyfile.go:920— Handler.FinalizeUnmarshalCaddyfile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, 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.
StaticResponse.UnmarshalCaddyfile (cognitive 19) modules/caddyhttp/staticresp.go:141— StaticResponse.UnmarshalCaddyfile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, match/switch 3, boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
templates.extractFrontMatter (cognitive 19) modules/caddyhttp/templates/frontmatter.go:13— templates.extractFrontMatter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
caddytls.loadECHConfig (cognitive 19) modules/caddytls/ech.go:529— caddytls.loadECHConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19 (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.
ACMEIssuer.makeIssuerTemplate (cognitive 19) modules/caddytls/acmeissuer.go:254— ACMEIssuer.makeIssuerTemplate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 19 (nesting depth added 7). 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.
MultiRegexpFilter.UnmarshalCaddyfile (cognitive 19) modules/logging/filters.go:683— MultiRegexpFilter.UnmarshalCaddyfile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, 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.
caddy.replaceRemoteAdminServer (cognitive 18) admin.go:510— caddy.replaceRemoteAdminServer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, loops 3, boolean chains 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, 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.
caddycmd.DetermineAdminAPIAddress (cognitive 18) cmd/commandfuncs.go:862— caddycmd.DetermineAdminAPIAddress has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (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.
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.