Public report — trivy, 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.
350findings with an exact file:lineof 365 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
30/95dimensions across the health lenses108782 LoC — wide & deep
Executive summary
Read through the Preview lens: this repo is pre-1.0 / in development, so the colour bands are relaxed to what a preview needs — *green* means good enough for a preview, not yet production-stable. Code correctness and security stay near-strict even here; the score itself is absolute and comparable across repos.
aquasecurity/trivy is in good overall health (74%), but at least one category below sits in Adequate-or-worse territory — most items are improvements, and the weakest category contains work to schedule, not shelve.
It is strongest in Architecture (100%) — the structure is clean and changes stay contained. Code Health (81%) is solid too.
The area that most needs attention is Readiness (68%) — 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: 1 Leaked secret finding(s) (Secret Scanning); Stamp a version in your build/package manifest (e.g. csproj <Version> (Release Hygiene); gitleaks/trufflehog in CI to block PRs that introduce committed… (Security & performance tooling).
For scale: Large (~108,782 production lines); rebuilding it from scratch would take roughly ~2.9 person-years (~1–6 engineers). Approximate, ±~30%.
Encouragingly, the gaps are in documentation and release process — not in the code's correctness, structure or security, which are strong. They're low-risk to close, and doing so would lift the grade without re-engineering anything that already works.
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.
1.1× (at 74% quality) — the last 20% of quality is most of the work
Size & shape
Large · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)
This codebase represents roughly ~2.9 person-years of build effort (about ~€420,000 to rebuild). Its weakest lens is Readiness at 68% — 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 1.1× 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 1 Leaked secret finding(s) in Secret Scanning — start with key.pem.
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.
Of everything flagged, the best return on effort is: Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with key.pem. The rest can wait behind it.
Evidence: priority ranking: top of 5 ranked by impact/effort
→ Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with key.pem.
Architecture — module dependency matrix
519 modules, 1424 dependencies — 2 dependency cycles, shown as the red cell(s) above the diagonal. Rows and columns are the same modules, ordered so that a module only depends on ones above it. A cell means the row depends on the column, and its number is how many type pairs create that dependency. Read one thing: is anything above the diagonal? A mark there is a dependency cycle. (A cycle is all this shows — an unusual but cycle-free dependency sits below the diagonal like any other.)
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2021 — Security Misconfiguration
14
High / Critical
A03:2021 — Injection
10
Medium
A02:2021 — Cryptographic Failures
6
High / Critical
A06:2021 — Vulnerable & Outdated Components
4
High / Critical
Roadmap
Immediately resolve the single leaked secret in key.pem and integrate secret scanning tools like gitleaks or trufflehog into the CI pipeline to prevent future exposure. Simultaneously, enforce release hygiene by stamping a version in your build manifests or tagging releases with semver to ensure full traceability. Finally, improve project discoverability by adding a 'Testing' section to the root README and documenting significant architectural decisions in a dedicated ADR directory.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with key.pem.
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.
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).
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. 28 of 30 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.8 — 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 — 30 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, 350 of 365 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").
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D33 JS/npm Dependency Vulnerabilities: JS/npm CVE matching reads package manifests and lockfiles — risk from how a dependency is used, and advisories not yet published, fall outside this scan.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
D42 Runtime Threat Enforcement: Runtime enforcement is read from committed policy files — a Tetragon/Falco/Kyverno stack installed cluster-wide (Helm release, platform add-on) with no in-repo trace can't be credited, and a committed policy is declared intent, not proof the engine is running and blocking in the live cluster.
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.
47 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was applier.ApplyLayers at 34. A further 8 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 release.idToOSFamily at 22 — they are counted neither in the figure above nor in this dimension's score.
+ 41 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 2 Parser.Parse (cyclomatic 16) finding(s) in Cyclomatic Complexity — start with parse.go (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 applier.ApplyLayers (cyclomatic 34) finding(s) in Cyclomatic Complexity — start with docker.go. — One of this dimension's main actionable groups (1 warning-level).
Resolve the 1 funcs.parseIPv6 (cyclomatic 26) finding(s) in Cyclomatic Complexity — start with ip.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.
+ 157 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 3 Parser.Parse (cognitive 24) finding(s) in Cognitive Complexity — start with parse.go (3). — One of this dimension's main actionable groups (3 warning-level).
Resolve the 2 Parser.Parse (cognitive 17) finding(s) in Cognitive Complexity — start with parse.go (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 2 Scanner.Detect (cognitive 16) finding(s) in Cognitive Complexity — start with alpine.go, ubuntu.go. — One of this dimension's main actionable groups (2 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 Classes9.5 / 10Exemplary✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
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 1 Leaked secret finding(s) in Secret Scanning — start with key.pem. — One of this dimension's main actionable groups (1 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.
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor9.2 / 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.
36 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is pkg/dependency/parser/nodejs/npm/parse_testcase.go.
Off-boarding risk: anonymized user #1 · ×3
Further sole-owners (lower concentration)
✓ On the Gold path — maintain.
Detailed fixes: d16_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
Trivy's documentation is comprehensive, well-organized, and clearly structured across READMEs, architecture docs, and an index. It begins with a strong branding section (logo, release/test/license badges) and a dedicated Trivy overview covering scanners, targets, scanning coverage, and the homepage link. The Quick Start guides installation via brew/docker/download binaries, ecosystem integrations, and canary builds; integration tests run mage commands with golden-file update flags; E2E tests cover realistic external dependencies while avoiding detailed output validation; there is a dedicated helm/trivy chart README for standalone scanner deployment plus an overview of the parameters table. A single clipped section (the end-of-README clip marker) does not prevent the document from being rated highly. Trivy's documentation is clear and complete for a security scanner: the README (first steps with Trivy) gives installation examples, CLI usage, and video-based usage guides, while ecosystem docs cover integrations across community projects, production tools, CI/CD pipelines, and an explicit principles document. The first steps guide links to Installation, Ecosystem, and Commercial pages, and the Principles doc is clipped mid-sentence but its outline (Core Principles; Static Analysis; No Setup Required; Security Focus) exists, so none of those sections are omitted.
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.
4 finding(s): 0 critical, 4 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
Secret: generic-api-key · ×4.github/actions/trivy-triage/config.json:12detected by gitleaks finding
Rotate the exposed credentials — git history can't be un-committed
What to do
Resolve the 4 Secret finding(s) in Secrets (history) — start with key.pem (3), config.json. — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 Rotate the exposed credentials finding(s) in Secrets (history). — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d28_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Real static-analysis (SAST) findings — likely security bugs in the code, any language.
Method: Polyglot static analysis via semgrep across the repo using the pinned, image-baked p/security-audit + p/owasp-top-ten rulesets (no scan-time registry fetch); severity rules (ERROR/WARNING/INFO) map to a full-band severity-weighted score. Exhaustive, deterministic; degrades on parse failure.
Coverage: semgrep pattern rules over all files — exhaustive for the rule set, blind to classes of bug without a rule (clean = no rule matched).
Medium: use-of-sha1 · ×4pkg/digest/digest.go:66detected by semgrep finding
Low: use-of-unsafe-block · ×6pkg/module/wasm/sdk.go:25detected by semgrep finding
What to do
Resolve the 6 Low finding(s) in Static Analysis (SAST) — start with sdk.go (4), transport.go (2). — One of this dimension's main actionable groups (6 recommendation-level).
Resolve the 4 Medium finding(s) in Static Analysis (SAST) — start with digest.go, cache.go, parser.go. — One of this dimension's main actionable groups (4 warning-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
High IaC: DS-0002 · ×2Dockerfiledetected by trivy finding
Medium IaC: KSV-0001 · ×9helm/trivy/templates/statefulset.yamldetected by trivy finding
Low IaC: KSV-0003 · ×3helm/trivy/templates/statefulset.yamldetected by trivy finding
What to do
Resolve the 2 High IaC finding(s) in IaC & Container Security — start with Dockerfile, Dockerfile.canary. — One of this dimension's main actionable groups (2 issue-level).
Resolve the 9 Medium IaC finding(s) in IaC & Container Security — start with statefulset.yaml (3), dockerfile.go (3), Dockerfile.canary. — One of this dimension's main actionable groups (9 warning-level).
Resolve the 3 Low IaC finding(s) in IaC & Container Security — start with statefulset.yaml (3). — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d31_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether anyone still has living knowledge of each file, or it has been orphaned — last understood long ago by someone now gone quiet. The sibling of the bus factor: D16 asks who owns it, D34 asks whether anyone still knows it.
Method: File orphaning as total living-knowledge decay below one focused-commit's worth within a year, computed per-file from the D16 decay model. Exhaustive, deterministic over fixed history.
86 of 428 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is pkg/iac/scanners/terraform/parser/funcs/collection.go.
Resolve the 1 Orphaned knowledge finding(s) in Knowledge Freshness — start with collection.go. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether dependencies have known published vulnerabilities (CVEs) per the OSV database — read natively from whatever lockfile the repository ships (Cargo, npm, Go, Python, Maven, RubyGems, …). D33 and D30 add ecosystem-specific scanners on top for npm and .NET.
Method: Multi-ecosystem dependency-CVE scan via osv-scanner --recursive (queries the osv.dev database + parses lockfiles natively across ecosystems: npm package-lock/yarn/pnpm/bun, Go go.mod, Rust Cargo.lock, Maven/Gradle pom.xml/gradle.lockfile, PyPI requirements.txt/poetry.lock/Pipfile.lock, Composer composer.lock, RubyGems Gemfile.lock, Hex mix.lock, pub pubspec.lock, Swift Package.resolved); severity tally (Critical/High/Medium/Low) to 0-10 tight normalizer (8.0). NotApplicable only when the repo declares no supported non-.NET dependency lockfile (a NuGet-only repo stays NotApplicable — .NET CVEs are D30's domain); coverage needs a resolved lockfile. Additive to D33 (trivy fs); exhaustive + deterministic, DB kept fresh.
High CVE: [GHSA redacted]go.moddetected by osv-scanner finding
Medium vulnerability: GO-2026-5841 · ×2go.moddetected by osv-scanner finding
Medium CVE: GO-2026-4970go.moddetected by osv-scanner finding
What to do
Resolve the 1 High CVE finding(s) in OSV Dependency Vulnerabilities — start with go.mod. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 2 Medium vulnerability finding(s) in OSV Dependency Vulnerabilities — start with go.mod (2). — One of this dimension's main actionable groups (2 warning-level).
Resolve the 1 Medium CVE finding(s) in OSV Dependency Vulnerabilities — start with go.mod. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d38_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether Kubernetes workloads restrict network EGRESS with a NetworkPolicy (or Cilium policy), limiting where a compromised pod can send data or reach a command-and-control server. Presence of committed egress-restricting policy, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn — language-agnostic): Kubernetes workloads gate applicability; credits a NetworkPolicy / Cilium policy that restricts egress (policyTypes: [Egress] / egress rules). Reward-leaning (neutral floor climbing to 10, never a deduction — baseline misconfigs stay with D31). Deterministic.
What it measures: Whether Kubernetes workloads confine the kernel boundary — a seccomp profile (RuntimeDefault/Localhost) plus an AppArmor/SELinux mandatory-access-control layer — shrinking the syscall attack surface a container escape would use. Presence of committed confinement config, not runtime enforcement.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a seccomp profile (RuntimeDefault/Localhost) and an AppArmor/SELinux MAC layer. Reward-leaning (neutral floor climbing to 10); NotApplicable without workloads. Deterministic.
Resolve the 1 No seccomp profile finding(s) in Kernel & Syscall Confinement. — One of this dimension's main actionable groups (1 recommendation-level).
Resolve the 1 No AppArmor/SELinux confinement finding(s) in Kernel & Syscall Confinement. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d41_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether the Kubernetes deployment wires runtime threat enforcement — a detection engine (Tetragon/Falco) and/or an admission-control policy gate (Kyverno / OPA Gatekeeper / PodSecurity). Presence of committed policy, not a runtime guarantee.
Method: Deterministic YAML-manifest inspection (no external tool, no Roslyn): on Kubernetes workloads, credits a runtime threat-detection engine (Tetragon TracingPolicy / Falco) and an admission-control policy (Kyverno / OPA Gatekeeper / PodSecurity). Reward-leaning; NotApplicable without workloads. Deterministic.
Resolve the 1 No runtime threat detection finding(s) in Runtime Threat Enforcement. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d42_recommendation.md · top locations in Appendix A, every location in findings.md.
Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.
Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.
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.
Add a README to the 133 of 133 project(s) that lack one — worth up to 2 pts.
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?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Not included — 65 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — no DI registrations detected
AX10 Code composition — not assessed — code composition is computed by ROLE over a document set that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — no singleton implementations detected
AX3 Project dependency cycles — not assessed — project cycles and dependency direction are computed over a project-reference graph that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — not assessed — test isolation is computed from a project graph (which projects are test projects, and what they reference) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
D10 Test Quality — ~134201 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, .py) but bounded contexts are resolved over the C#/VB project set, which exposed none, so context scope could not be assessed. Not scored — this is a gap in the analyzer, not a verdict about this repository. Declaring the codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed — see the recommendation on this dimension for where. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
D24 Comment Value — No inline comments to assess — comment value is not applicable here.
D25 ADR Conformance — no ADRs to check
D26 Project Cohesion — Project cohesion is assessed over the .NET project set; this target exposed no projects, so project size and spread could not be assessed. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D27 Navigability — No calls could be sampled, so navigability was not assessed — tracing effort is measured over resolved call sites and this target exposed none. Not scored — this is a gap in the analyzer's reach, not a verdict about this repository.
D30 Dependency Vulnerabilities — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Go module (go.mod/go.sum) — not scanned yet) — where an OSV-supported manifest exists, dependency vulnerabilities for this repository are reported under D38 instead.
D32 Data Compliance (PII/GDPR) — No PII/GDPR-handling patterns detected (p/gdpr ruleset) — no data-compliance surface to assess.
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.
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, .py, 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 (1 of 2 signals for this style — below the bar we score at): 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 — and nothing was matched here. The coverage check applies to any stack, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
P2 Observability — Observability was not assessed: this check reads a source model that does not carry this repository's product — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of a logging idiom this check recognises is NOT evidence that this repo lacks structured logging (it may log through its own ecosystem's logger). This is a gap in the analyzer, not a finding about this repository.
P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
P7 Outbound HTTP resilience — not measured — the application kind could not be determined for this repo
P8 Schema migrations — not assessed — schema-migration practice is read from a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (`go test -coverprofile=coverage.out ./...`) into the repo working tree before the scan — a CI step is the usual place, since the artefact is commonly gitignored, or wire coverage collection into CI, to enable this cross-layer check
PF1 Benchmark discipline — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF2 Allocation hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
PF3 Async & latency hygiene — Performance was not assessed: this lens reads a source model that was not loaded for this repository, because the repository is written in a language this lens does not yet model or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository — in particular it is NOT a statement that this repo is unpackaged or performance-careless.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
Appendix A — Findings (grouped)
The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.
High IaC: DS-0002 Dockerfile— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN adduser -S -D app`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
High IaC: DS-0002 Dockerfile.canary— Image user should not be 'root' A container that starts as root runs your process with root's capabilities inside the namespace, so a compromise of the process starts from there. The step: create an unprivileged account in the image (`RUN adduser -S -D app`), give it ownership of the paths the process writes at runtime (`COPY --chown=` on those layers, or a `RUN chown -R`), and end the final stage with `USER app` so it is the default at start. Build stages that only compile can stay root; it is the stage that RUNS that needs the account. If the process genuinely requires root — it manages the container runtime, ptraces another process or opens raw devices — say so here rather than making a change that breaks it.
Leaked secret: private-key integration/data/certs/key.pem: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.
Orphaned knowledge pkg/iac/scanners/terraform/parser/funcs/collection.go— No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D38 · OSV Dependency Vulnerabilities· High CVE · ×1
High CVE: [GHSA redacted] go.mod— github.com/docker/docker 28.5.2+incompatible: [GHSA redacted] — no fixed version has been published yet. Track the advisory; github.com/docker/docker is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so the action is on the dependency that requires it — upgrade or replace that dependent. This one row stands for the 5 advisories this scan raises against github.com/docker/docker 28.5.2+incompatible: [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted], [GHSA redacted].
Duplicated block (7 lines × 2) pkg/commands/artifact/scanner.go:105— pkg/commands/artifact/scanner.go:105-111 | pkg/commands/artifact/scanner.go:201-207 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/artifact/scanner.go:105` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/detector/ospkg/oracle/oracle.go:50— pkg/detector/ospkg/oracle/oracle.go:50-56 | pkg/detector/ospkg/suse/suse.go:123-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/oracle/oracle.go:50` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/detector/ospkg/photon/photon.go:45— pkg/detector/ospkg/photon/photon.go:45-51 | pkg/detector/ospkg/suse/suse.go:122-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/photon/photon.go:45` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/fanal/analyzer/language/python/poetry/poetry.go:57— pkg/fanal/analyzer/language/python/poetry/poetry.go:57-63 | pkg/fanal/analyzer/language/python/pylock/pylock.go:56-63 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/language/python/poetry/poetry.go:57` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/fanal/artifact/sbom/sbom.go:111— pkg/fanal/artifact/sbom/sbom.go:111-117 | pkg/fanal/artifact/vm/file.go:106-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (7 lines × 2) pkg/fanal/secret/scanner.go:725— pkg/fanal/secret/scanner.go:725-731 | pkg/fanal/secret/scanner.go:810-816 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/secret/scanner.go:725` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) pkg/iac/adapters/terraform/aws/ec2/vpc.go:191— pkg/iac/adapters/terraform/aws/ec2/vpc.go:191-197 | pkg/iac/adapters/terraform/aws/ec2/vpc.go:212-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/ec2/vpc.go:191` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (7 lines × 2) pkg/iac/adapters/terraform/aws/sqs/adapt.go:35— pkg/iac/adapters/terraform/aws/sqs/adapt.go:35-41 | pkg/iac/adapters/terraform/aws/sqs/adapt.go:108-114 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/sqs/adapt.go:35` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/iac/adapters/terraform/google/gke/adapt.go:84— pkg/iac/adapters/terraform/google/gke/adapt.go:84-90 | pkg/iac/adapters/terraform/google/gke/adapt.go:191-197 — both copies are in the same file, so extract the 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) pkg/iac/scanners/terraform/parser/resolvers/registry.go:86— pkg/iac/scanners/terraform/parser/resolvers/registry.go:86-92 | pkg/iac/scanners/terraform/parser/resolvers/registry.go:123-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (7 lines × 2) pkg/module/module.go:199— pkg/module/module.go:199-207 | pkg/module/module.go:248-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/module/module.go:199` 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 (7 lines × 2) pkg/version/version.go:47— pkg/version/version.go:47-53 | pkg/version/version.go:63-69 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/version/version.go:47` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/iac/adapters/terraform/aws/apigateway/apiv1.go:108— pkg/iac/adapters/terraform/aws/apigateway/apiv1.go:108-115 | pkg/iac/adapters/terraform/aws/apigateway/apiv2.go:63-69 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/apigateway/apiv1.go:108` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) pkg/iac/adapters/terraform/google/compute/instances.go:70— pkg/iac/adapters/terraform/google/compute/instances.go:70-76 | pkg/iac/adapters/terraform/google/compute/instances.go:82-88 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/google/compute/instances.go:70` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) pkg/iac/scanners/terraform/parser/funcs/crypto.go:229— pkg/iac/scanners/terraform/parser/funcs/crypto.go:229-235 | pkg/iac/scanners/terraform/parser/funcs/crypto.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 `pkg/iac/scanners/terraform/parser/funcs/crypto.go:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) pkg/commands/app.go:389— pkg/commands/app.go:389-399 | pkg/commands/app.go:750-759 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/app.go:389` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/commands/app.go:1270— pkg/commands/app.go:1270-1280 | pkg/commands/app.go:1318-1327 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/app.go:1270` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) pkg/commands/artifact/scanner.go:41— pkg/commands/artifact/scanner.go:41-50 | pkg/commands/artifact/scanner.go:137-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/detector/ospkg/azure/azure.go:44— pkg/detector/ospkg/azure/azure.go:44-54 | pkg/detector/ospkg/photon/photon.go:46-55 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/azure/azure.go:44` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/fanal/analyzer/language/analyze.go:25— pkg/fanal/analyzer/language/analyze.go:25-34 | pkg/fanal/analyzer/language/analyze.go:39-48 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/language/analyze.go:25` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (10 lines × 2) pkg/fanal/analyzer/licensing/license.go:128— pkg/fanal/analyzer/licensing/license.go:128-137 | pkg/fanal/utils/utils.go:68-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/licensing/license.go:128` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) pkg/fanal/analyzer/pkg/apk/apk.go:179— pkg/fanal/analyzer/pkg/apk/apk.go:179-188 | pkg/fanal/analyzer/pkg/rpm/rpm.go:303-312 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/pkg/apk/apk.go:179` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) pkg/fanal/artifact/image/image.go:55— pkg/fanal/artifact/image/image.go:55-65 | pkg/fanal/artifact/vm/vm.go:40-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/artifact/vm/vm.go:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (10 lines × 2) pkg/iac/adapters/terraform/azure/compute/adapt.go:74— pkg/iac/adapters/terraform/azure/compute/adapt.go:74-83 | pkg/iac/adapters/terraform/azure/compute/adapt.go:114-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/azure/compute/adapt.go:74` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) pkg/iac/scan/result.go:187— pkg/iac/scan/result.go:187-196 | pkg/iac/scan/result.go:203-212 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/scan/result.go:187` 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) internal/testutil/gzip.go:21— internal/testutil/gzip.go:21-30 | internal/testutil/gzip.go:38-47 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (8 lines × 2) pkg/commands/artifact/scanner.go:77— pkg/commands/artifact/scanner.go:77-84 | pkg/commands/artifact/scanner.go:173-180 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/artifact/scanner.go:77` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/commands/artifact/scanner.go:91— pkg/commands/artifact/scanner.go:91-98 | pkg/commands/artifact/scanner.go:187-194 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/artifact/scanner.go:91` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/commands/artifact/scanner.go:118— pkg/commands/artifact/scanner.go:118-125 | pkg/commands/artifact/scanner.go:214-221 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/artifact/scanner.go:118` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/fanal/analyzer/language/python/poetry/poetry.go:99— pkg/fanal/analyzer/language/python/poetry/poetry.go:99-107 | pkg/fanal/analyzer/language/python/pylock/pylock.go:116-123 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (8 lines × 2) pkg/iac/adapters/cloudformation/aws/sqs/queue.go:49— pkg/iac/adapters/cloudformation/aws/sqs/queue.go:49-56 | pkg/iac/adapters/cloudformation/aws/ecr/repository.go:70-77 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/cloudformation/aws/sqs/queue.go:49` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) pkg/iac/adapters/terraform/aws/dynamodb/adapt.go:41— pkg/iac/adapters/terraform/aws/dynamodb/adapt.go:41-48 | pkg/iac/adapters/terraform/aws/dynamodb/adapt.go:67-74 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/dynamodb/adapt.go:41` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/iac/adapters/terraform/azure/keyvault/adapt.go:40— pkg/iac/adapters/terraform/azure/keyvault/adapt.go:40-47 | pkg/iac/adapters/terraform/azure/keyvault/adapt.go:60-67 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/azure/keyvault/adapt.go:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/iac/adapters/terraform/kubernetes/adapt.go:51— pkg/iac/adapters/terraform/kubernetes/adapt.go:51-58 | pkg/iac/adapters/terraform/kubernetes/adapt.go:75-82 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/kubernetes/adapt.go:51` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/x/json/jsonc.go:183— pkg/x/json/jsonc.go:183-190 | pkg/x/json/jsonc.go:195-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (8 lines × 2) pkg/iac/adapters/terraform/azure/database/mysql.go:31— pkg/iac/adapters/terraform/azure/database/mysql.go:31-38 | pkg/iac/adapters/terraform/azure/database/postgresql.go:35-42 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/azure/database/mysql.go:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) pkg/iac/adapters/terraform/google/iam/convert.go:12— pkg/iac/adapters/terraform/google/iam/convert.go:12-19 | pkg/iac/adapters/terraform/google/iam/project_iam.go:101-108 — 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.
Hotspot: pkg/dependency/parser/java/jar/parse.go pkg/dependency/parser/java/jar/parse.go— pkg/dependency/parser/java/jar/parse.go changed 4 times in last 90 days, max complexity 18. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: pkg/dependency/parser/java/pom/parse.go pkg/dependency/parser/java/pom/parse.go— pkg/dependency/parser/java/pom/parse.go changed 3 times in last 90 days, max complexity 23. 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: pkg/fanal/applier/docker.go pkg/fanal/applier/docker.go— pkg/fanal/applier/docker.go changed 2 times in last 90 days, max complexity 34. 2 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: pkg/detector/library/driver.go pkg/detector/library/driver.go— pkg/detector/library/driver.go changed 3 times in last 90 days, max complexity 18. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/detector/library/seal/seal.go pkg/detector/library/seal/seal.go— pkg/detector/library/seal/seal.go changed 3 times in last 90 days, max complexity 18. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/sbom/spdx/marshal.go pkg/sbom/spdx/marshal.go— pkg/sbom/spdx/marshal.go changed 3 times in last 90 days, max complexity 16. 2 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: pkg/dependency/parser/nodejs/npm/parse.go pkg/dependency/parser/nodejs/npm/parse.go— pkg/dependency/parser/nodejs/npm/parse.go changed 2 times in last 90 days, max complexity 18. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: pkg/fanal/artifact/local/fs.go pkg/fanal/artifact/local/fs.go— pkg/fanal/artifact/local/fs.go changed 2 times in last 90 days, max complexity 17. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, cover the area it touches with tests, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time.
Hotspot: pkg/dependency/parser/java/pom/mirror.go pkg/dependency/parser/java/pom/mirror.go— pkg/dependency/parser/java/pom/mirror.go changed 2 times in last 90 days, max complexity 16. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, behind tests written first.
Hotspot: pkg/iac/rego/schemas/builder.go pkg/iac/rego/schemas/builder.go— pkg/iac/rego/schemas/builder.go changed 2 times in last 90 days, max complexity 15. 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.
FileTooLong: npm/parse_testcase.go pkg/dependency/parser/nodejs/npm/parse_testcase.go:0— FileTooLong — 1023 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: commands/app.go pkg/commands/app.go:0— FileTooLong — 1007 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: rpc/convert.go pkg/rpc/convert.go:0— FileTooLong — 784 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: pnpm/parse_testcase.go pkg/dependency/parser/nodejs/pnpm/parse_testcase.go:0— FileTooLong — 669 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: pom/parse.go pkg/dependency/parser/java/pom/parse.go:0— FileTooLong — 629 significant lines (blank, comment-only and punctuation-only lines excluded). To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: terraform/attribute.go pkg/iac/terraform/attribute.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: lock/parse_testcase.go pkg/dependency/parser/nuget/lock/parse_testcase.go:0— FileTooLong — 594 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: licensing/normalize.go pkg/licensing/normalize.go:0— FileTooLong — 566 significant lines (blank, comment-only and punctuation-only lines excluded), about 74% of them inside a single declaration: mapping (17-453). Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: secret/scanner.go pkg/fanal/secret/scanner.go:0— FileTooLong — 517 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.
Medium IaC: KSV-0001 helm/trivy/templates/statefulset.yaml— Can elevate its own privileges This file is a Helm chart TEMPLATE and it already renders its `securityContext` from the chart's values (`.Values.securityContext`), so it is not the file to edit — writing the block in here would override whatever the chart's users pass in. The value that ships is the one in `helm/trivy/values.yaml`: set `securityContext` there and every installation gets it by default.
Medium IaC: KSV-0104 helm/trivy/templates/statefulset.yaml— Seccomp policies disabled One securityContext edit clears this facet's near-duplicate rules together: KSV-0030, KSV-0104. This file is a Helm chart TEMPLATE and it already renders its `securityContext` from the chart's values (`.Values.securityContext`), so it is not the file to edit — writing the block in here would override whatever the chart's users pass in. The value that ships is the one in `helm/trivy/values.yaml`: set `securityContext` there and every installation gets it by default.
Medium IaC: KSV-0125 helm/trivy/templates/statefulset.yaml— Restrict container images to trusted registries
Medium IaC: CKV_DOCKER_3 Dockerfile.canary:1— Ensure that a user for the container has been created
Medium IaC: CKV_DOCKER_3 Dockerfile:1— Ensure that a user for the container has been created
Medium IaC: CKV_DOCKER_2 pkg/fanal/analyzer/imgconf/dockerfile/dockerfile.go:1— Ensure that HEALTHCHECK instructions have been added to container images
Medium IaC: CKV_DOCKER_3 pkg/iac/rego/schemas/dockerfile.json:1— Ensure that a user for the container has been created
Medium IaC: CKV_DOCKER_3 pkg/iac/providers/dockerfile/dockerfile.go:1— Ensure that a user for the container has been created
Medium IaC: CKV_DOCKER_3 pkg/fanal/analyzer/buildinfo/dockerfile.go:1— Ensure that a user for the container has been created
Duplicated block (11 lines × 2) pkg/commands/app.go:948— pkg/commands/app.go:948-958 | pkg/commands/app.go:972-982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/commands/app.go:948` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) pkg/detector/ospkg/rootio/rootio.go:90— pkg/detector/ospkg/rootio/rootio.go:90-101 | pkg/detector/ospkg/seal/seal.go:115-125 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/rootio/rootio.go:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) pkg/iac/adapters/terraform/azure/appservice/adapt.go:46— pkg/iac/adapters/terraform/azure/appservice/adapt.go:46-56 | pkg/iac/adapters/terraform/azure/appservice/adapt.go:94-104 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/azure/appservice/adapt.go:46` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) pkg/iac/scan/code.go:310— pkg/iac/scan/code.go:310-320 | pkg/iac/scanners/terraform/parser/parser.go:240-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/scan/code.go:310` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) pkg/iac/scanners/cloudformation/parser/property.go:151— pkg/iac/scanners/cloudformation/parser/property.go:151-161 | pkg/iac/scanners/kubernetes/parser/manifest_node.go:219-229 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/scanners/cloudformation/parser/property.go:151` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) pkg/iac/scanners/cloudformation/parser/property.go:366— pkg/iac/scanners/cloudformation/parser/property.go:366-376 | pkg/iac/scanners/cloudformation/parser/resource.go:261-271 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/scanners/cloudformation/parser/property.go:366` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (11 lines × 2) pkg/report/table/licensing.go:41— pkg/report/table/licensing.go:41-51 | pkg/report/table/licensing.go:123-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (11 lines × 2) pkg/iac/adapters/cloudformation/aws/sam/function.go:39— pkg/iac/adapters/cloudformation/aws/sam/function.go:39-49 | pkg/iac/adapters/cloudformation/aws/sam/state_machines.go:65-75 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/cloudformation/aws/sam/function.go:39` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) pkg/commands/artifact/scanner.go:60— pkg/commands/artifact/scanner.go:60-68 | pkg/commands/artifact/scanner.go:156-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (9 lines × 2) pkg/compliance/report/json.go:32— pkg/compliance/report/json.go:32-41 | pkg/report/json.go:41-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/compliance/report/json.go:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) pkg/dependency/parser/julia/manifest/naive_pkg_parser.go:30— pkg/dependency/parser/julia/manifest/naive_pkg_parser.go:30-38 | pkg/dependency/parser/rust/cargo/naive_pkg_parser.go:31-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/dependency/parser/julia/manifest/naive_pkg_parser.go:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) pkg/fanal/analyzer/language/nodejs/bun/bun.go:111— pkg/fanal/analyzer/language/nodejs/bun/bun.go:111-119 | pkg/fanal/analyzer/language/nodejs/npm/npm.go:113-121 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/language/nodejs/bun/bun.go:111` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) pkg/fanal/analyzer/language/python/poetry/poetry.go:162— pkg/fanal/analyzer/language/python/poetry/poetry.go:162-170 | pkg/fanal/analyzer/language/python/pylock/pylock.go:150-158 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/analyzer/language/python/poetry/poetry.go:162` 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) pkg/flag/options.go:291— pkg/flag/options.go:291-299 | pkg/flag/options.go:310-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/flag/options.go:291` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) pkg/k8s/scanner/scanner.go:265— pkg/k8s/scanner/scanner.go:265-273 | pkg/k8s/scanner/scanner.go:346-354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/k8s/scanner/scanner.go:265` 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.
Change coupling: import.go ↔ const.go pkg/fanal/analyzer/all/import.go— `pkg/fanal/analyzer/all/import.go` and `pkg/fanal/analyzer/const.go` change together 100% of the time (20 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Change coupling: import.go ↔ const.go pkg/fanal/analyzer/all/import.go— `pkg/fanal/analyzer/all/import.go` and `pkg/fanal/types/const.go` change together 90% of the time (18 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Change coupling: driver.go ↔ import.go pkg/detector/library/driver.go— `pkg/detector/library/driver.go` and `pkg/fanal/analyzer/all/import.go` change together 80% of the time (16 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Change coupling: import.go ↔ purl.go pkg/fanal/analyzer/all/import.go— `pkg/fanal/analyzer/all/import.go` and `pkg/purl/purl.go` change together 75% of the time (15 of the 20 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Change coupling: detect.go ↔ release.go pkg/detector/ospkg/detect.go— `pkg/detector/ospkg/detect.go` and `pkg/fanal/analyzer/os/release/release.go` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Change coupling: const.go ↔ const.go pkg/fanal/analyzer/const.go— `pkg/fanal/analyzer/const.go` and `pkg/fanal/types/const.go` change together 66% of the time (21 of the 32 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking.
Medium: use-of-sha1 pkg/digest/digest.go:66— Detected SHA1 hash algorithm which is considered insecure. SHA1 is not collision resistant and is therefore not suitable as a cryptographic signature. Use SHA256 or SHA3 instead. 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: use-of-md5 pkg/iac/scanners/terraform/parser/resolvers/cache.go:73— Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not suitable as a cryptographic signature. Use SHA256 or SHA3 instead. 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: use-of-md5 pkg/iac/scanners/terraformplan/tfjson/parser/parser.go:232— Detected MD5 hash algorithm which is considered insecure. MD5 is not collision resistant and is therefore not suitable as a cryptographic signature. Use SHA256 or SHA3 instead. 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 pkg/iac/terraform/presets.go:5— `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.
Duplicated block (13 lines × 2) pkg/dependency/parser/java/pom/pom.go:313— pkg/dependency/parser/java/pom/pom.go:313-325 | pkg/fanal/analyzer/language/java/gradle/pom.go:54-66 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/dependency/parser/java/pom/pom.go:313` 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) pkg/detector/ospkg/alma/alma.go:71— pkg/detector/ospkg/alma/alma.go:71-83 | pkg/detector/ospkg/rocky/rocky.go:66-78 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/alma/alma.go:71` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (13 lines × 2) pkg/detector/ospkg/debian/debian.go:111— pkg/detector/ospkg/debian/debian.go:111-123 | pkg/detector/ospkg/ubuntu/ubuntu.go:144-156 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/debian/debian.go:111` 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) pkg/iac/scanners/helm/parser/parser.go:85— pkg/iac/scanners/helm/parser/parser.go:85-97 | pkg/iac/scanners/helm/scanner.go:68-82 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/scanners/helm/parser/parser.go:85` 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 (5 lines × 2) pkg/cache/fs.go:100— pkg/cache/fs.go:100-104 | pkg/cache/fs.go:158-162 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/cache/fs.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.
Duplicated block (5 lines × 2) pkg/iac/adapters/cloudformation/aws/iam/iam.go:13— pkg/iac/adapters/cloudformation/aws/iam/iam.go:13-17 | pkg/iac/adapters/terraform/aws/iam/passwords.go:14-18 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) pkg/iac/adapters/terraform/aws/ecr/adapt.go:105— pkg/iac/adapters/terraform/aws/ecr/adapt.go:105-109 | pkg/iac/adapters/terraform/aws/redshift/adapt.go:88-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (5 lines × 2) pkg/iac/adapters/terraform/aws/s3/bucket.go:153— pkg/iac/adapters/terraform/aws/s3/bucket.go:153-157 | pkg/iac/adapters/terraform/aws/s3/bucket.go:165-169 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/s3/bucket.go:153` 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.
Parser.Parse (cognitive 24) pkg/dependency/parser/golang/mod/parse.go:73— Parser.Parse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 3, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.Parse (cognitive 24) pkg/dependency/parser/python/packaging/parse.go:34— Parser.Parse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 3, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.Parse (cognitive 24) pkg/dependency/parser/ruby/bundler/parse.go:23— Parser.Parse has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 5 (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.
TooManyMethods: Property pkg/iac/scanners/cloudformation/parser/property.go:25— TooManyMethods — 63 methods, declared across 3 files: parser/property.go (28), parser/property_helpers.go (27), parser/property_conversion.go (8). That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Block pkg/iac/terraform/block.go:22— TooManyMethods — 50 methods, declared across 2 files: terraform/block.go (49), terraform/export.go (1). That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Attribute pkg/iac/terraform/attribute.go:23— TooManyMethods — 47 methods, declared across 2 files: terraform/attribute.go (46), terraform/export.go (1). That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
Duplicated block (6 lines × 2) pkg/iac/adapters/arm/database/mssql.go:34— pkg/iac/adapters/arm/database/mssql.go:34-40 | pkg/iac/adapters/arm/database/postgresql.go:28-33 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/arm/database/mssql.go:34` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) pkg/iac/adapters/cloudformation/aws/sam/function.go:31— pkg/iac/adapters/cloudformation/aws/sam/function.go:31-36 | pkg/iac/adapters/cloudformation/aws/sam/state_machines.go:58-63 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/cloudformation/aws/sam/function.go:31` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (6 lines × 2) pkg/iac/adapters/terraform/aws/s3/policies.go:29— pkg/iac/adapters/terraform/aws/s3/policies.go:29-35 | pkg/iac/adapters/terraform/aws/s3/public_access_block.go:19-24 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/aws/s3/policies.go:29` 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.
Parser.Parse (cyclomatic 16) pkg/dependency/parser/golang/mod/parse.go:73— Parser.Parse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Parser.Parse (cyclomatic 16) pkg/dependency/parser/nodejs/bun/parse.go:81— Parser.Parse 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.
Parser.Parse (cognitive 17) pkg/dependency/parser/julia/manifest/parse.go:35— Parser.Parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.Parse (cognitive 17) pkg/dependency/parser/nuget/lock/parse.go:36— Parser.Parse has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, loops 7 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.Detect (cognitive 16) pkg/detector/ospkg/alpine/alpine.go:70— Scanner.Detect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, 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.
Scanner.Detect (cognitive 16) pkg/detector/ospkg/ubuntu/ubuntu.go:104— Scanner.Detect has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D38 · OSV Dependency Vulnerabilities· Medium vulnerability · ×2
Medium vulnerability: GO-2026-5841 go.mod— github.com/klauspost/compress 1.18.6 (github.com/klauspost/compress/s2): GO-2026-5841 — github.com/klauspost/compress is not a DIRECT requirement of this module: go.mod records it as `// indirect`, pulled in transitively, so raise it in place (run `go get github.com/klauspost/compress@v1.18.7`, which updates the require line go.mod already holds for it).
Medium vulnerability: GO-2026-5932 go.mod— golang.org/x/crypto 0.54.0 (golang.org/x/crypto/openpgp, golang.org/x/crypto/openpgp/packet, golang.org/x/crypto/openpgp/armor, +4 more): GO-2026-5932 — no fixed version has been published yet. Track the advisory, and remove or replace golang.org/x/crypto if the exposure is not acceptable until one lands. Before doing either, check whether any affected package above is actually linked here: `go list -deps ./... | grep -F -e golang.org/x/crypto/openpgp` lists it whether your own code imports it or a dependency pulls it in — a module can be in the build list for one sub-package while the vulnerable one is never reached, in which case there is nothing to remove and tracking the advisory is the whole action.
Duplicated block (14 lines × 3) pkg/detector/ospkg/oracle/oracle.go:77— pkg/detector/ospkg/oracle/oracle.go:77-90 | pkg/detector/ospkg/photon/photon.go:66-79 | pkg/detector/ospkg/suse/suse.go:143-156 — 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 `pkg/detector/ospkg/oracle/oracle.go:77` 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 × 3) pkg/k8s/scanner/scanner.go:277— pkg/k8s/scanner/scanner.go:277-290 | pkg/k8s/scanner/scanner.go:323-336 | pkg/k8s/scanner/scanner.go:358-371 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/k8s/scanner/scanner.go:277` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) pkg/detector/ospkg/rootio/rootio.go:128— pkg/detector/ospkg/rootio/rootio.go:128-139 | pkg/detector/ospkg/seal/seal.go:159-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/rootio/rootio.go:128` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) pkg/iac/scanners/cloudformation/scanner.go:78— pkg/iac/scanners/cloudformation/scanner.go:78-89 | pkg/iac/scanners/helm/scanner.go:99-110 — 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.
applier.ApplyLayers (cyclomatic 34) pkg/fanal/applier/docker.go:112— applier.ApplyLayers has cyclomatic complexity 34 (threshold 15). Of this number, 25 points are the body's own statements and 9 belong to 3 function literals inside it that branch. 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.
funcs.parseIPv6 (cyclomatic 26) pkg/iac/scanners/terraform/parser/funcs/ip.go:106— funcs.parseIPv6 has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
registryResolver.Resolve (cyclomatic 24) pkg/iac/scanners/terraform/parser/resolvers/registry.go:46— registryResolver.Resolve 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.
Parser.parseRoot (cyclomatic 23) pkg/dependency/parser/java/pom/parse.go:242— Parser.parseRoot 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.
terraform.RewriteExpr (cyclomatic 23) pkg/iac/terraform/attribute.go:853— terraform.RewriteExpr has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function taking that case's concrete type, so the dispatch reads one line per case. These arms are selected by TYPE rather than by value, so there is no key a lookup table could be built on; where you own the matched types, giving them one shared interface method and calling that is the form a table would have taken, and where you do not, keep the cases — they stay explicit and reviewable.
alpinePkgAnalyzer.parseApkInfo (cyclomatic 20) pkg/fanal/analyzer/pkg/apk/apk.go:54— alpinePkgAnalyzer.parseApkInfo 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.
iam.parseStatement (cyclomatic 20) pkg/iac/adapters/terraform/aws/iam/convert.go:126— iam.parseStatement 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.
report.Write (cyclomatic 20) pkg/report/writer.go:29— report.Write has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Flag.Add (cyclomatic 19) pkg/flag/options.go:276— Flag.Add 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.
ReportFlagGroup.ToOptions (cyclomatic 19) pkg/flag/report_flags.go:213— ReportFlagGroup.ToOptions 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.
secretRenderer.renderCode (cyclomatic 19) pkg/report/table/secret.go:111— secretRenderer.renderCode 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.
clean.Run (cyclomatic 18) pkg/commands/clean/run.go:17— clean.Run 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.
jar.parseManifest (cyclomatic 18) pkg/dependency/parser/java/jar/parse.go:614— jar.parseManifest has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
Parser.traverseZip (cyclomatic 18) pkg/dependency/parser/java/jar/parse.go:243— Parser.traverseZip 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.
Parser.parseV2 (cyclomatic 18) pkg/dependency/parser/nodejs/npm/parse.go:85— Parser.parseV2 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.
sealSecurity.Match (cyclomatic 18) pkg/detector/library/seal/seal.go:74— sealSecurity.Match 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.
StaticMetadata.populate (cyclomatic 18) pkg/iac/rego/metadata.go:65— StaticMetadata.populate 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Value.UnmarshalJSONFrom (cyclomatic 18) pkg/iac/scanners/azure/value.go:117— Value.UnmarshalJSONFrom 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.
expression.NewLexer (cyclomatic 18) pkg/licensing/expression/lexer.go:20— expression.NewLexer has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to one function literal inside it that branches (line 22). 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.
module.newWASMPlugin (cyclomatic 18) pkg/module/module.go:283— module.newWASMPlugin 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.
Parser.fetchPOMFromRemoteRepositories (cyclomatic 17) pkg/dependency/parser/java/pom/parse.go:840— Parser.fetchPOMFromRemoteRepositories 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.
Artifact.Inspect (cyclomatic 17) pkg/fanal/artifact/local/fs.go:169— Artifact.Inspect has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
adapter.adaptQueues (cyclomatic 17) pkg/iac/adapters/terraform/aws/sqs/adapt.go:28— adapter.adaptQueues 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.
storage.adaptAccounts (cyclomatic 17) pkg/iac/adapters/terraform/azure/storage/adapt.go:83— storage.adaptAccounts 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.
Node.subtree (cyclomatic 17) pkg/iac/scanners/ansible/parser/node.go:491— Node.subtree 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.
Property.EqualTo (cyclomatic 17) pkg/iac/scanners/cloudformation/parser/property_helpers.go:172— Property.EqualTo 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.
funcs.parseTimestamp (cyclomatic 17) pkg/iac/scanners/terraform/parser/funcs/datetime.go:100— funcs.parseTimestamp 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.
Scanner.Scan (cyclomatic 17) pkg/k8s/scanner/scanner.go:55— Scanner.Scan has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Scanner.scanK8sVulns (cyclomatic 17) pkg/k8s/scanner/scanner.go:241— Scanner.scanK8sVulns 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.
misconfigRenderer.renderCode (cyclomatic 17) pkg/report/table/misconfig.go:159— misconfigRenderer.renderCode 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.
SPDX.parsePackage (cyclomatic 17) pkg/sbom/spdx/unmarshal.go:167— SPDX.parsePackage has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
runner.initScannerConfig (cyclomatic 16) pkg/commands/artifact/run.go:568— runner.initScannerConfig 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.
pom.resolveMirrors (cyclomatic 16) pkg/dependency/parser/java/pom/mirror.go:33— pom.resolveMirrors 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.
dockerfileAnalyzer.Analyze (cyclomatic 16) pkg/fanal/analyzer/buildinfo/dockerfile.go:28— dockerfileAnalyzer.Analyze has cyclomatic complexity 16 (threshold 15). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
mod.findLicense (cyclomatic 16) pkg/fanal/analyzer/language/golang/mod/mod.go:346— mod.findLicense has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
sql.adaptFlags (cyclomatic 16) pkg/iac/adapters/terraform/google/sql/adapt.go:84— sql.adaptFlags has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
detection.detectKubernetes (cyclomatic 16) pkg/iac/detection/detect.go:218— detection.detectKubernetes 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.
inventory.ParseINI (cyclomatic 16) pkg/iac/scanners/ansible/inventory/ini.go:20— inventory.ParseINI 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.
functions.Take (cyclomatic 16) pkg/iac/scanners/azure/functions/take.go:3— functions.Take 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.
Parser.ParseFile (cyclomatic 16) pkg/iac/scanners/cloudformation/parser/parser.go:86— Parser.ParseFile 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, 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.
evaluator.expandBlockForEaches (cyclomatic 16) pkg/iac/scanners/terraform/parser/evaluator.go:308— evaluator.expandBlockForEaches has cyclomatic complexity 16 (threshold 15). Of this number, 10 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.
funcs.MakeTemplateFileFunc (cyclomatic 16) pkg/iac/scanners/terraform/parser/funcs/filesystem.go:69— funcs.MakeTemplateFileFunc has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 4 function literals inside it that branch (lines 98, 157, 82, …). 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.
Attribute.getStringValues (cyclomatic 16) pkg/iac/terraform/attribute.go:328— Attribute.getStringValues 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.
module.deleteResults (cyclomatic 16) pkg/module/module.go:610— module.deleteResults has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 615, 624). 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.
Marshaler.Marshal (cyclomatic 16) pkg/sbom/spdx/marshal.go:128— Marshaler.Marshal 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.
storage.adaptAccounts (cognitive 54) pkg/iac/adapters/terraform/azure/storage/adapt.go:83— storage.adaptAccounts has cognitive complexity 54 (threshold 15). Drivers by points: if/else 36, loops 16, boolean chains 2 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
applier.ApplyLayers (cognitive 47) pkg/fanal/applier/docker.go:112— applier.ApplyLayers has cognitive complexity 47 (threshold 15). Drivers by points: loops 23, if/else 21, match/switch 2, boolean chains 1 (nesting depth added 20). Of this number, 44 points are the body's own statements and 3 belong to 3 function literals inside it that branch. 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.parseRoot (cognitive 45) pkg/dependency/parser/java/pom/parse.go:242— Parser.parseRoot has cognitive complexity 45 (threshold 15). Drivers by points: if/else 39, loops 4, boolean chains 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
funcs.parseIPv6 (cognitive 43) pkg/iac/scanners/terraform/parser/funcs/ip.go:106— funcs.parseIPv6 has cognitive complexity 43 (threshold 15). Drivers by points: if/else 33, boolean chains 5, loops 5 (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.
Scanner.scanK8sVulns (cognitive 42) pkg/k8s/scanner/scanner.go:241— Scanner.scanK8sVulns has cognitive complexity 42 (threshold 15). Drivers by points: if/else 39, match/switch 2, loops 1 (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.
Parser.fetchPOMFromRemoteRepositories (cognitive 38) pkg/dependency/parser/java/pom/parse.go:840— Parser.fetchPOMFromRemoteRepositories has cognitive complexity 38 (threshold 15). Drivers by points: if/else 32, boolean chains 3, loops 3 (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.
adapter.adaptQueues (cognitive 36) pkg/iac/adapters/terraform/aws/sqs/adapt.go:28— adapter.adaptQueues has cognitive complexity 36 (threshold 15). Drivers by points: if/else 31, loops 3, boolean chains 2 (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.
ec2.getRules (cognitive 35) pkg/iac/adapters/cloudformation/aws/ec2/nacl.go:24— ec2.getRules 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.
spaces.adaptBuckets (cognitive 35) pkg/iac/adapters/terraform/digitalocean/spaces/adapt.go:17— spaces.adaptBuckets has cognitive complexity 35 (threshold 15). Drivers by points: if/else 25, loops 10 (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.
rego.BuildSchemaSetFromPolicies (cognitive 35) pkg/iac/rego/build.go:16— rego.BuildSchemaSetFromPolicies has cognitive complexity 35 (threshold 15). Drivers by points: if/else 28, loops 6, boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Flag.Add (cognitive 34) pkg/flag/options.go:276— Flag.Add has cognitive complexity 34 (threshold 15). Drivers by points: if/else 24, loops 8, boolean chains 1, match/switch 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.
http.colorizeHTTPDump (cognitive 34) pkg/x/http/trace.go:423— http.colorizeHTTPDump has cognitive complexity 34 (threshold 15). Drivers by points: if/else 31, boolean chains 2, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.convertResults (cognitive 33) pkg/iac/rego/result.go:124— Scanner.convertResults has cognitive complexity 33 (threshold 15). Drivers by points: if/else 26, loops 6, 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.
Parser.parseV2 (cognitive 32) pkg/dependency/parser/nodejs/npm/parse.go:85— Parser.parseV2 has cognitive complexity 32 (threshold 15). Drivers by points: if/else 24, boolean chains 4, loops 4 (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.
dockerfileAnalyzer.Analyze (cognitive 32) pkg/fanal/analyzer/buildinfo/dockerfile.go:28— dockerfileAnalyzer.Analyze has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14, loops 10, match/switch 8 (nesting depth added 19). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
Node.subtree (cognitive 32) pkg/iac/scanners/ansible/parser/node.go:491— Node.subtree has cognitive complexity 32 (threshold 15). Drivers by points: if/else 26, loops 4, boolean chains 1, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
registryResolver.Resolve (cognitive 32) pkg/iac/scanners/terraform/parser/resolvers/registry.go:46— registryResolver.Resolve has cognitive complexity 32 (threshold 15). Drivers by points: if/else 30, boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.traverseZip (cognitive 31) pkg/dependency/parser/java/jar/parse.go:243— Parser.traverseZip has cognitive complexity 31 (threshold 15). Drivers by points: if/else 27, match/switch 2, boolean chains 1, 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.
secretRenderer.renderCode (cognitive 31) pkg/report/table/secret.go:111— secretRenderer.renderCode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18, match/switch 7, boolean chains 4, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.Parse (cognitive 30) pkg/dependency/parser/swift/cocoapods/parse.go:33— Parser.Parse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 17, loops 11, match/switch 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compute.adaptInstances (cognitive 30) pkg/iac/adapters/terraform/google/compute/instances.go:9— compute.adaptInstances has cognitive complexity 30 (threshold 15). Drivers by points: if/else 22, loops 7, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Marshaler.Marshal (cognitive 30) pkg/sbom/spdx/marshal.go:128— Marshaler.Marshal has cognitive complexity 30 (threshold 15). Drivers by points: if/else 21, 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.
inventory.ParseINI (cognitive 29) pkg/iac/scanners/ansible/inventory/ini.go:20— inventory.ParseINI has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18, match/switch 6, loops 4, boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.resolvePlaybook (cognitive 29) pkg/iac/scanners/ansible/parser/parser.go:260— Parser.resolvePlaybook has cognitive complexity 29 (threshold 15). Drivers by points: if/else 23, loops 5, 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.
pom.resolveMirrors (cognitive 28) pkg/dependency/parser/java/pom/mirror.go:33— pom.resolveMirrors has cognitive complexity 28 (threshold 15). Drivers by points: if/else 19, loops 8, 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.
apigateway.adaptAPIsV1 (cognitive 28) pkg/iac/adapters/cloudformation/aws/apigateway/apiv1.go:8— apigateway.adaptAPIsV1 has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18, loops 10 (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.
compute.adaptNetworks (cognitive 28) pkg/iac/adapters/terraform/google/compute/networks.go:14— compute.adaptNetworks has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20, loops 8 (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.
Attribute.mapContains (cognitive 28) pkg/iac/terraform/attribute.go:470— Attribute.mapContains has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12, loops 12, boolean chains 3, match/switch 1 (nesting depth added 15). Most of this is not in the body itself: 0 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 471). 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.
misconfigRenderer.renderCode (cognitive 28) pkg/report/table/misconfig.go:159— misconfigRenderer.renderCode has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13, match/switch 7, boolean chains 4, loops 4 (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.
module.updateResults (cognitive 27) pkg/module/module.go:572— module.updateResults has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13, loops 11, boolean chains 3 (nesting depth added 17). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 576, 590). 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.
module.deleteResults (cognitive 27) pkg/module/module.go:610— module.deleteResults has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13, loops 11, boolean chains 3 (nesting depth added 17). Most of this is not in the body itself: 7 of the 27 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 615, 624). 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.
cargoAnalyzer.parseRootCargoTOML (cognitive 26) pkg/fanal/analyzer/language/rust/cargo/cargo.go:217— cargoAnalyzer.parseRootCargoTOML has cognitive complexity 26 (threshold 15). Drivers by points: if/else 17, loops 7, match/switch 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.
rego.isPolicyApplicable (cognitive 26) pkg/iac/rego/scanner.go:307— rego.isPolicyApplicable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16, loops 9, 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.
Scanner.Scan (cognitive 26) pkg/k8s/scanner/scanner.go:55— Scanner.Scan has cognitive complexity 26 (threshold 15). Drivers by points: if/else 20, loops 4, boolean chains 2 (nesting depth added 10). Of this number, 19 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.parseBlock (cognitive 25) pkg/dependency/parser/nodejs/yarn/parse.go:175— Parser.parseBlock has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20, boolean chains 2, match/switch 2, 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.
ecr.adaptRepository (cognitive 25) pkg/iac/adapters/terraform/aws/ecr/adapt.go:28— ecr.adaptRepository has cognitive complexity 25 (threshold 15). Drivers by points: if/else 23, boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detection.detectKubernetes (cognitive 25) pkg/iac/detection/detect.go:218— detection.detectKubernetes has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19, loops 5, 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.
rpmPkgAnalyzer.listPkgs (cognitive 24) pkg/fanal/analyzer/pkg/rpm/rpm.go:113— rpmPkgAnalyzer.listPkgs has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, 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.
ReportFlagGroup.ToOptions (cognitive 24) pkg/flag/report_flags.go:213— ReportFlagGroup.ToOptions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, boolean chains 3, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
StaticMetadata.populate (cognitive 24) pkg/iac/rego/metadata.go:65— StaticMetadata.populate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19, loops 3, match/switch 2 (nesting depth added 8). Of this number, 23 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.clusterInfoToReportResources (cognitive 24) pkg/k8s/scanner/scanner.go:388— Scanner.clusterInfoToReportResources has cognitive complexity 24 (threshold 15). Drivers by points: if/else 17, loops 5, match/switch 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.
Parser.parseV9 (cognitive 23) pkg/dependency/parser/nodejs/pnpm/parse.go:127— Parser.parseV9 has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13, loops 9, 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.
adapter.adaptBucketPolicies (cognitive 23) pkg/iac/adapters/terraform/aws/s3/policies.go:9— adapter.adaptBucketPolicies has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19, loops 4 (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.
convert.StructToRego (cognitive 23) pkg/iac/rego/convert/struct.go:16— convert.StructToRego has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, boolean chains 3, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.ScanInput (cognitive 23) pkg/iac/rego/scanner.go:181— Scanner.ScanInput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 3, match/switch 2 (nesting depth added 12). 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.
scan.shiftANSIOverLineEndings (cognitive 23) pkg/iac/scan/highlighting.go:83— scan.shiftANSIOverLineEndings has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16, boolean chains 3, 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.
Node.render (cognitive 23) pkg/iac/scanners/ansible/parser/node.go:233— Node.render has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 4, 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.
Property.EqualTo (cognitive 23) pkg/iac/scanners/cloudformation/parser/property_helpers.go:172— Property.EqualTo has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, boolean chains 4, loops 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.Parse (cognitive 23) pkg/iac/scanners/dockerfile/parser/parser.go:39— Parser.Parse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, loops 4, boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attribute.getStringValues (cognitive 23) pkg/iac/terraform/attribute.go:328— Attribute.getStringValues has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18, loops 4, match/switch 1 (nesting depth added 12). 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.
expression.NewLexer (cognitive 23) pkg/licensing/expression/lexer.go:20— expression.NewLexer has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 4, loops 2, match/switch 2 (nesting depth added 9). Most of this is not in the body itself: 0 of the 23 points are its own statements and the rest belongs to one function literal inside it that branches (line 22). 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.
Writer.Write (cognitive 23) pkg/report/github/github.go:75— Writer.Write has cognitive complexity 23 (threshold 15). Drivers by points: if/else 20, loops 3 (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.
artifact.resolveAnsibleExtraVars (cognitive 22) pkg/commands/artifact/run.go:786— artifact.resolveAnsibleExtraVars has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, match/switch 2, boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sealSecurity.Match (cognitive 22) pkg/detector/library/seal/seal.go:74— sealSecurity.Match 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.
Artifact.Inspect (cognitive 22) pkg/fanal/artifact/local/fs.go:169— Artifact.Inspect has cognitive complexity 22 (threshold 15). Drivers by points: if/else 20, boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
msk.getClusters (cognitive 22) pkg/iac/adapters/cloudformation/aws/msk/cluster.go:9— msk.getClusters has cognitive complexity 22 (threshold 15). Drivers by points: if/else 21, 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.
iam.parseStatement (cognitive 22) pkg/iac/adapters/terraform/aws/iam/convert.go:126— iam.parseStatement has cognitive complexity 22 (threshold 15). Drivers by points: if/else 17, loops 2, match/switch 2, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inventory.LoadSourceVars (cognitive 22) pkg/iac/scanners/ansible/inventory/inventory_vars.go:156— inventory.LoadSourceVars has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, loops 2, boolean chains 1 (nesting depth added 12). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
inventory.LoadFromSources (cognitive 22) pkg/iac/scanners/ansible/inventory/load.go:236— inventory.LoadFromSources has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, loops 8, match/switch 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.
functions.Take (cognitive 22) pkg/iac/scanners/azure/functions/take.go:3— functions.Take has cognitive complexity 22 (threshold 15). Drivers by points: if/else 19, match/switch 3 (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.
Scanner.ScanFS (cognitive 22) pkg/iac/scanners/terraform/scanner.go:80— Scanner.ScanFS has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18, loops 4 (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.
Parser.Parse (cognitive 21) pkg/dependency/parser/nodejs/bun/parse.go:81— Parser.Parse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15, loops 4, boolean chains 2 (nesting depth added 6). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.Detect (cognitive 21) pkg/detector/ospkg/echo/echo.go:29— Scanner.Detect has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, loops 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.
builder.readStruct (cognitive 21) pkg/iac/rego/schemas/builder.go:169— builder.readStruct has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, loops 2, boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
evaluator.expandBlockForEaches (cognitive 21) pkg/iac/scanners/terraform/parser/evaluator.go:308— evaluator.expandBlockForEaches has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 332). 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.
evaluator.getValuesByBlockType (cognitive 21) pkg/iac/scanners/terraform/parser/evaluator.go:532— evaluator.getValuesByBlockType has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18, 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.
evaluator.localHasDynamicValues (cognitive 21) pkg/iac/scanners/terraform/parser/evaluator.go:671— evaluator.localHasDynamicValues has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16, 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.
snapshot.parseSnapshot (cognitive 21) pkg/iac/scanners/terraformplan/snapshot/snapshot.go:63— snapshot.parseSnapshot has cognitive complexity 21 (threshold 15). Drivers by points: if/else 17, loops 2, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Attribute.GetRawValue (cognitive 21) pkg/iac/terraform/attribute.go:74— Attribute.GetRawValue has cognitive complexity 21 (threshold 15). Drivers by points: loops 12, match/switch 6, if/else 3 (nesting depth added 14). 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 75). 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.
Encoder.component (cognitive 21) pkg/sbom/io/encode.go:366— Encoder.component has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13, boolean chains 4, loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
testutil.purgeMetadata (cognitive 20) internal/testutil/util.go:89— testutil.purgeMetadata has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, 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.
main.fixtureVMImages (cognitive 20) magefiles/fixture.go:68— main.fixtureVMImages has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, 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.
Scanner.detect (cognitive 20) pkg/detector/ospkg/redhat/redhat.go:93— Scanner.detect has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16, boolean chains 2, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
gomodAnalyzer.fillAdditionalData (cognitive 20) pkg/fanal/analyzer/language/golang/mod/mod.go:147— gomodAnalyzer.fillAdditionalData has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, loops 3 (nesting depth added 9). Of this number, 17 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.
apkRepoAnalyzer.Analyze (cognitive 20) pkg/fanal/analyzer/repo/apk/apk.go:31— apkRepoAnalyzer.Analyze has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, boolean chains 3, match/switch 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.scanChunk (cognitive 20) pkg/fanal/secret/scanner.go:734— Scanner.scanChunk has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 4, boolean chains 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
LayerTar.Walk (cognitive 20) pkg/fanal/walker/tar.go:35— LayerTar.Walk has cognitive complexity 20 (threshold 15). Drivers by points: if/else 17, match/switch 2, 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.
msk.adaptCluster (cognitive 20) pkg/iac/adapters/terraform/aws/msk/adapt.go:25— msk.adaptCluster has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20 (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.
adapter.adaptPublicAccessBlocks (cognitive 20) pkg/iac/adapters/terraform/aws/s3/public_access_block.go:7— adapter.adaptPublicAccessBlocks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, 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.
adapter.adaptBindings (cognitive 20) pkg/iac/adapters/terraform/google/storage/iam.go:24— adapter.adaptBindings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, 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.
Value.UnmarshalJSONFrom (cognitive 20) pkg/iac/scanners/azure/value.go:117— Value.UnmarshalJSONFrom has cognitive complexity 20 (threshold 15). Drivers by points: if/else 18, boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
parser.expandProperties (cognitive 20) pkg/iac/scanners/cloudformation/parser/file_context.go:200— parser.expandProperties has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, loops 4, match/switch 1 (nesting depth added 12). 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.
Metadata.UnmarshalJSON (cognitive 20) pkg/iac/types/metadata.go:32— Metadata.UnmarshalJSON has cognitive complexity 20 (threshold 15). Drivers by points: if/else 20 (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.
Marshaler.ratings (cognitive 20) pkg/sbom/cyclonedx/marshal.go:480— Marshaler.ratings has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15, boolean chains 4, loops 1 (nesting depth added 7). Of this number, 16 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.
testutil.DecompressSparseGzip (cognitive 19) internal/testutil/gzip.go:37— testutil.DecompressSparseGzip has cognitive complexity 19 (threshold 15). Drivers by points: if/else 17, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
runner.initScannerConfig (cognitive 19) pkg/commands/artifact/run.go:568— runner.initScannerConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Scanner.Detect (cognitive 19) pkg/detector/ospkg/debian/debian.go:58— Scanner.Detect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, 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.
analyzer.NewAnalyzerGroup (cognitive 19) pkg/fanal/analyzer/analyzer.go:391— analyzer.NewAnalyzerGroup has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
funcs.parseTimestamp (cognitive 19) pkg/iac/scanners/terraform/parser/funcs/datetime.go:100— funcs.parseTimestamp has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, match/switch 5, 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.
module.newWASMPlugin (cognitive 19) pkg/module/module.go:283— module.newWASMPlugin has cognitive complexity 19 (threshold 15). Drivers by points: if/else 18, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Service.Scan (cognitive 19) pkg/scan/local/service.go:56— Service.Scan has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, loops 2, boolean chains 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
version.NewVersionInfo (cognitive 19) pkg/version/version.go:31— version.NewVersionInfo has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15, boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
vex.New (cognitive 19) pkg/vex/vex.go:93— vex.New has cognitive complexity 19 (threshold 15). Drivers by points: if/else 16, match/switch 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
clean.Run (cognitive 18) pkg/commands/clean/run.go:17— clean.Run has cognitive complexity 18 (threshold 15). Drivers by points: if/else 17, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalyzerGroup.PostAnalyze (cognitive 18) pkg/fanal/analyzer/analyzer.go:556— AnalyzerGroup.PostAnalyze has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 6 (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.
alpinePkgAnalyzer.parseApkInfo (cognitive 18) pkg/fanal/analyzer/pkg/apk/apk.go:54— alpinePkgAnalyzer.parseApkInfo has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, match/switch 2, boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
image.getOCIImage (cognitive 18) pkg/fanal/image/oci.go:52— image.getOCIImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
ec2.getInstances (cognitive 18) pkg/iac/adapters/terraform/aws/ec2/adapt.go:27— ec2.getInstances has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, loops 9 (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.
iam.ConvertTerraformDocument (cognitive 18) pkg/iac/adapters/terraform/aws/iam/convert.go:75— iam.ConvertTerraformDocument has cognitive complexity 18 (threshold 15). Drivers by points: loops 11, if/else 7 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
s3.applyForBucketRelatedResource (cognitive 18) pkg/iac/adapters/terraform/aws/s3/bucket.go:320— s3.applyForBucketRelatedResource has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
adapter.adaptQueue (cognitive 18) pkg/iac/adapters/terraform/aws/sqs/adapt.go:97— adapter.adaptQueue has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
container.adaptCluster (cognitive 18) pkg/iac/adapters/terraform/azure/container/adapt.go:26— container.adaptCluster has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
compute.adaptFirewallRule (cognitive 18) pkg/iac/adapters/terraform/google/compute/networks.go:107— compute.adaptFirewallRule has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
functions.First (cognitive 18) pkg/iac/scanners/azure/functions/first.go:3— functions.First has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 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.
functions.Last (cognitive 18) pkg/iac/scanners/azure/functions/last.go:3— functions.Last has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, match/switch 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.
Parameters.UnmarshalJSONFrom (cognitive 18) pkg/iac/scanners/cloudformation/parser/parameter.go:98— Parameters.UnmarshalJSONFrom has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 5, 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.
Property.inferBool (cognitive 18) pkg/iac/scanners/cloudformation/parser/property.go:344— Property.inferBool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Resource.inferBool (cognitive 18) pkg/iac/scanners/cloudformation/parser/resource.go:239— Resource.inferBool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 18 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
executor.ignoreByParams (cognitive 18) pkg/iac/scanners/terraform/executor/executor.go:197— executor.ignoreByParams has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, boolean chains 2, match/switch 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
funcs.MakeTemplateFileFunc (cognitive 18) pkg/iac/scanners/terraform/parser/funcs/filesystem.go:69— funcs.MakeTemplateFileFunc has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13, loops 3, boolean chains 2 (nesting depth added 3). Most of this is not in the body itself: 0 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 98, 157, 82, …). 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.
Parser.ParseFS (cognitive 18) pkg/iac/scanners/terraform/parser/parser.go:156— Parser.ParseFS has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
terraform.NewBlock (cognitive 18) pkg/iac/terraform/block.go:38— terraform.NewBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, loops 6, match/switch 2, boolean chains 1 (nesting depth added 4). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Module.GetReferencedBlock (cognitive 18) pkg/iac/terraform/module.go:109— Module.GetReferencedBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 15, 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.
Module.GetReferencingBlocks (cognitive 18) pkg/iac/terraform/module.go:144— Module.GetReferencingBlocks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14, 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.
Pipeline.Do (cognitive 18) pkg/parallel/pipeline.go:48— Pipeline.Do has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, loops 5, match/switch 5 (nesting depth added 8). Most of this is not in the body itself: 5 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 60, 80). 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.
SarifWriter.Write (cognitive 18) pkg/report/sarif.go:128— SarifWriter.Write has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, loops 9 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
SPDX.parsePackage (cognitive 18) pkg/sbom/spdx/unmarshal.go:167— SPDX.parsePackage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12, loops 5, boolean chains 1 (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
pom.resolvePomRepos (cognitive 17) pkg/dependency/parser/java/pom/repository.go:35— pom.resolvePomRepos has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 4, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
pom.listProperties (cognitive 17) pkg/dependency/parser/java/pom/pom.go:82— pom.listProperties has cognitive complexity 17 (threshold 15). Drivers by points: loops 7, if/else 6, boolean chains 2, match/switch 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.Detect (cognitive 17) pkg/detector/ospkg/amazon/amazon.go:44— Scanner.Detect has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalyzerGroup.AnalyzeFile (cognitive 17) pkg/fanal/analyzer/analyzer.go:469— AnalyzerGroup.AnalyzeFile has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, match/switch 3, boolean chains 1, loops 1 (nesting depth added 7). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
AnalysisResult.Merge (cognitive 17) pkg/fanal/analyzer/analyzer.go:275— AnalysisResult.Merge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
alpineCmdAnalyzer.parseCommand (cognitive 17) pkg/fanal/analyzer/imgconf/apk/apk.go:147— alpineCmdAnalyzer.parseCommand has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7, loops 6, match/switch 3, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cargoAnalyzer.removeDevDependencies (cognitive 17) pkg/fanal/analyzer/language/rust/cargo/cargo.go:111— cargoAnalyzer.removeDevDependencies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, loops 5, match/switch 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
sam.setFunctionPolicies (cognitive 17) pkg/iac/adapters/cloudformation/aws/sam/function.go:30— sam.setFunctionPolicies has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, 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.
ec2.adaptVPC (cognitive 17) pkg/iac/adapters/terraform/aws/ec2/vpc.go:32— ec2.adaptVPC has cognitive complexity 17 (threshold 15). Drivers by points: if/else 16, 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.
adapter.adaptBuckets (cognitive 17) pkg/iac/adapters/terraform/google/storage/adapt.go:23— adapter.adaptBuckets has cognitive complexity 17 (threshold 15). Drivers by points: loops 9, if/else 7, boolean chains 1 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
kubernetes.adaptNetworkPolicy (cognitive 17) pkg/iac/adapters/terraform/kubernetes/adapt.go:29— kubernetes.adaptNetworkPolicy has cognitive complexity 17 (threshold 15). Drivers by points: loops 12, if/else 5 (nesting depth added 10). 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.ResolveFindInMap (cognitive 17) pkg/iac/scanners/cloudformation/parser/fn_find_in_map.go:9— parser.ResolveFindInMap has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 2, loops 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Property.Contains (cognitive 17) pkg/iac/scanners/cloudformation/parser/property_helpers.go:238— Property.Contains has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, loops 4, boolean chains 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
funcs.MakeToFunc (cognitive 17) pkg/iac/scanners/terraform/parser/funcs/conversion.go:20— funcs.MakeToFunc has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 4, match/switch 4 (nesting depth added 6). Most of this is not in the body itself: 0 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 59, 38). 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.
counter.countBlockRecursion (cognitive 17) pkg/iac/scanners/terraform/parser/sort.go:32— counter.countBlockRecursion has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13, loops 4 (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.
State.Merge (cognitive 17) pkg/iac/state/merge.go:9— State.Merge has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
misconf.CreatePolicyFS (cognitive 17) pkg/misconf/scanner.go:437— misconf.CreatePolicyFS has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15, boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Decoder.decodeComponents (cognitive 17) pkg/sbom/io/decode.go:118— Decoder.decodeComponents has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12, boolean chains 2, match/switch 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
jsoncParser.processNormalToken (cognitive 17) pkg/x/json/jsonc.go:166— jsoncParser.processNormalToken has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, match/switch 3 (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.
main.fixtureTerraformPlanSnapshots (cognitive 16) magefiles/terraformplan.go:28— main.fixtureTerraformPlanSnapshots has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, loops 5, boolean chains 1 (nesting depth added 5). Of this number, 11 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.
Parser.parseV1 (cognitive 16) pkg/dependency/parser/c/conan/parse.go:55— Parser.parseV1 has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.resolveLinks (cognitive 16) pkg/dependency/parser/nodejs/npm/parse.go:200— Parser.resolveLinks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, loops 3 (nesting depth added 7). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
alpineCmdAnalyzer.guessVersion (cognitive 16) pkg/fanal/analyzer/imgconf/apk/apk.go:235— alpineCmdAnalyzer.guessVersion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, loops 5, 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.
mod.findLicense (cognitive 16) pkg/fanal/analyzer/language/golang/mod/mod.go:346— mod.findLicense has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, match/switch 4, boolean chains 3, loops 1 (nesting depth added 5). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
eks.adaptCluster (cognitive 16) pkg/iac/adapters/terraform/aws/eks/adapt.go:25— eks.adaptCluster has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, loops 4, match/switch 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
adapter.adaptBucketResource (cognitive 16) pkg/iac/adapters/terraform/google/storage/adapt.go:82— adapter.adaptBucketResource has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 2, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
rego.LoadPoliciesFromDirs (cognitive 16) pkg/iac/rego/embed.go:79— rego.LoadPoliciesFromDirs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 82). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
rego.parseCause (cognitive 16) pkg/iac/rego/result.go:75— rego.parseCause has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
inventory.splitFields (cognitive 16) pkg/iac/scanners/ansible/inventory/ini.go:123— inventory.splitFields has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, match/switch 2, loops 1 (nesting depth added 8). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Parser.ParseFile (cognitive 16) pkg/iac/scanners/cloudformation/parser/parser.go:86— Parser.ParseFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 2, match/switch 2 (nesting depth added 2). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
ValueOptions.MergeValues (cognitive 16) pkg/iac/scanners/helm/parser/vals.go:25— ValueOptions.MergeValues has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Scanner.scanChart (cognitive 16) pkg/iac/scanners/helm/scanner.go:181— Scanner.scanChart has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, 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.
Scanner.findModules (cognitive 16) pkg/iac/scanners/terraform/scanner.go:190— Scanner.findModules has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 3, boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
commands.clusterRun (cognitive 16) pkg/k8s/commands/cluster.go:20— commands.clusterRun has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
licensing.SplitLicenses (cognitive 16) pkg/licensing/normalize.go:610— licensing.SplitLicenses has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
parallel.WalkDir (cognitive 16) pkg/parallel/walk.go:19— parallel.WalkDir has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 4, match/switch 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 28, 62). 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.
remote.tryGet (cognitive 16) pkg/remote/remote.go:36— remote.tryGet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
vulnerabilityRenderer.setVulnerabilityRows (cognitive 16) pkg/report/table/vulnerability.go:132— vulnerabilityRenderer.setVulnerabilityRows has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, 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.
Marshaler.marshalVulnerabilities (cognitive 16) pkg/sbom/cyclonedx/marshal.go:194— Marshaler.marshalVulnerabilities has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, 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.
BOM.parseBOM (cognitive 16) pkg/sbom/cyclonedx/unmarshal.go:65— BOM.parseBOM has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Encoder.encodePackages (cognitive 16) pkg/sbom/io/encode.go:221— Encoder.encodePackages has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11, loops 5 (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.
traceTransport.redactBody (cognitive 16) pkg/x/http/trace.go:284— traceTransport.redactBody has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, loops 5, boolean chains 2 (nesting depth added 6). Of this number, 14 points are the body's own statements and 2 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.
D36 · Supply-chain Provenance & Signing· PR-triggered workflow without a permissions block · ×1
PR-triggered workflow without a permissions block — 5 workflow(s) triggered by pull_request declare no `permissions:` block (test-docs.yaml, semantic-pr.yaml, release-pr-check.yaml …) and so run with the repository's default GITHUB_TOKEN scope, while 3 sibling workflows in the same repository are already scoped. Pull-request runs build the least-trusted code in the repository; give each of these workflows its own least-privilege block — `permissions: {contents: read}` at the top of the workflow, widened per job only where a job genuinely writes.
D38 · OSV Dependency Vulnerabilities· Medium CVE · ×1
Medium CVE: GO-2026-4970 go.mod— stdlib 1.26.3 (os): GO-2026-4970 — fixed in Go 1.26.5; pin a build toolchain at or above it (go.mod `toolchain` directive, or your CI's Go version) — the `go` directive is a minimum language version, not the compiler that builds your binaries. This one row stands for the 5 advisories this scan raises against stdlib 1.26.3: GO-2026-4970, GO-2026-5037, GO-2026-5038, GO-2026-5039, GO-2026-5856.
Duplicated block (15 lines × 2) pkg/report/table/misconfig.go:200— pkg/report/table/misconfig.go:200-215 | pkg/report/table/secret.go:155-169 — the copies sit in sibling files of one directory: extract the block into a single shared function in that directory and call it from each site, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/report/table/misconfig.go:200` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) pkg/fanal/artifact/image/image.go:481— pkg/fanal/artifact/image/image.go:481-494 | pkg/fanal/artifact/vm/vm.go:119-133 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/fanal/artifact/image/image.go:481` 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 × 3) pkg/detector/ospkg/chainguard/chainguard.go:51— pkg/detector/ospkg/chainguard/chainguard.go:51-63 | pkg/detector/ospkg/minimos/minimos.go:52-64 | pkg/detector/ospkg/wolfi/wolfi.go:52-64 — before extracting anything, compare `pkg/detector/ospkg/chainguard/chainguard.go` and `pkg/detector/ospkg/minimos/minimos.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/chainguard/chainguard.go:51` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 4) pkg/detector/ospkg/alpine/alpine.go:104— pkg/detector/ospkg/alpine/alpine.go:104-115 | pkg/detector/ospkg/chainguard/chainguard.go:51-62 | pkg/detector/ospkg/minimos/minimos.go:52-63 | pkg/detector/ospkg/wolfi/wolfi.go:52-63 — before extracting anything, compare `pkg/detector/ospkg/chainguard/chainguard.go` and `pkg/detector/ospkg/minimos/minimos.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/alpine/alpine.go:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (11 lines × 3) pkg/detector/ospkg/chainguard/chainguard.go:34— pkg/detector/ospkg/chainguard/chainguard.go:34-44 | pkg/detector/ospkg/minimos/minimos.go:34-44 | pkg/detector/ospkg/wolfi/wolfi.go:34-44 — before extracting anything, compare `pkg/detector/ospkg/chainguard/chainguard.go` and `pkg/detector/ospkg/minimos/minimos.go` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 36 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/detector/ospkg/chainguard/chainguard.go:34` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) pkg/iac/adapters/terraform/google/storage/iam.go:32— pkg/iac/adapters/terraform/google/storage/iam.go:32-41 | pkg/iac/adapters/terraform/google/storage/iam.go:63-72 | pkg/iac/adapters/terraform/google/storage/iam.go:86-95 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `pkg/iac/adapters/terraform/google/storage/iam.go:32` it begins part-way through the construct above it, so t...
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.