Public report of peg/rampart, published 16 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 16 November 2026, 17:04 UTC · Survey ID cd_55dba8ef45ee4cd699f07d0b0e509f24
peg/rampart
Measured 16 November 2026, 17:04 UTC, at code version c4e45c6
First survey, so nothing to compare with yet
CAI scoreWeak
CriticalWeakAdequateStrongExemplary
The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.
A medium codebase: 66,167 lines of product code in 2 projects, tests not counted · Estimated rebuild effort: about 0.7 person-years · Weakest lens: Accessibility, 24.7
Findings by how serious they are
16 critical842 serious67 minor
15 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
16 November 2026, 17:04 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
70of 70 dimensions measured by tools.
914of 925 findings point to an exact file and line, so you can open each one in the code. The other 11 concern the repository as a whole, such as missing documentation.
70dimensions across 7 lenses, read from 66,167 lines of product code in 2 projects.
peg/rampart falls short of our standard for production, in part because it has controls that only work with a mouse. It scores 41.0 out of 100 and is rated Weak, and seven of its 16 critical findings are security problems.
Accessibility, at 24.7, is the weakest lens and counts most in the score. The best first steps are making the controls keyboard-usable and fixing focus, motion and contrast, each worth about 7.8 points. Raising Accessibility to 70 would lift the score to about 53.1.
Four weaknesses in the code could be used by an attacker. Four controls can't be used without a mouse, and five form fields can't be read by a screen reader. Making the controls work with a keyboard, fixing the weaknesses the scanner points to and labelling the form fields would close these risks. Setting a waiting period for automatic updates would fix the automatic dependency update that takes a new release at once, and the password or key in the code's history needs replacing, with the old one switched off.
The product code is 66,167 lines, about €110,000 to rebuild.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
If Accessibility rose from 24.7 to 70, the lowest score rated Strong, the score would rise from 41.0 to about 53.1.
Code composition: what the lines of code are
Product code 53%Tests 47%
Rebuild cost: about €110,000 · Estimate
Cost to rebuild
€36,000 to €180,000, for 594 to 1,883 hours of work, about 0.7 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 41. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 66,167 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Raises the score by about 7.8 points · Medium effort · Keyboard semantics
2
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Raises the score by about 3.5 points · Medium effort · Forms & labels
Diagnosis: what the measurements show together
Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.
Files that change often carry extra risk · Combined risk
2 files are changed often and are hard to read, which makes them the likeliest places for a mistake. They also have under half their code tested, or were written almost entirely by one person, so a mistake there is less likely to be caught, or only one person knows the code well enough to avoid it. A change to these files therefore carries more risk than the overall score suggests.
Based on: Churn × Complexity Hotspots (34 files) · Code Coverage (21 files under half tested) · The files: doctor.go and engine.go
What to do: Add tests to these files and have a second person review every change to them, starting with doctor.go and engine.go.
Where the investment is most exposed · Value at risk
This code would cost about €110,000 to build again, about 0.7 person-years of work. Its weakest lens is Accessibility, at 24.7 (Critical). Accessibility is about whether the interface is built so that everyone can use it, including people who can't see the screen or can't use a mouse. Because the weakest lens counts most in the score, work on Accessibility also moves the score most.
Based on: the rebuild estimate · the Accessibility grade · how much each lens counts
What to do: Start with the Accessibility actions in Top priorities.
If you do one thing first · First action
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href. Of all the actions in this report, it raises the score most for the work it takes: about 7.8 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.3 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 15% on every change. The history of the code shows how much it changes: about 46,674 lines over the last 90 days, which is about 189,289 lines a year. At that pace, the extra work comes to an estimated 31.9 to 191.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture: which parts of the code depend on which
The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.
44 modules, with 24 dependencies between them. Every module uses only modules listed above it, so there are no loops.
The table shows the 40 modules with the most connections; 4 more are left out to keep it readable.
Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
github.com/peg/rampart/internal/approval uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/approval, while a change to github.com/peg/rampart/internal/approval can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/approval uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/bridge uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/internal/bridge, while a change to github.com/peg/rampart/internal/bridge can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/internal/bridge uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/bridge uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/bridge, while a change to github.com/peg/rampart/internal/bridge can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/bridge uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/generate uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/generate, while a change to github.com/peg/rampart/internal/generate can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/generate uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/openclaw uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/openclaw, while a change to github.com/peg/rampart/internal/openclaw can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/openclaw uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/report uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/internal/report, while a change to github.com/peg/rampart/internal/report can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/internal/report uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/watch uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/internal/watch, while a change to github.com/peg/rampart/internal/watch can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/internal/watch uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/webhookaction uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/webhookaction, while a change to github.com/peg/rampart/internal/webhookaction can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/webhookaction uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/pkg/sdk uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/pkg/sdk, while a change to github.com/peg/rampart/pkg/sdk can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/pkg/sdk uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/pkg/sdk uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/pkg/sdk, while a change to github.com/peg/rampart/pkg/sdk can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/pkg/sdk uses a module listed above it, which is the healthy direction.
internal.plugin uses internal.plugin.hermes, so a change to internal.plugin.hermes can break internal.plugin, while a change to internal.plugin can't break internal.plugin.hermes.
Position
Below the diagonal: internal.plugin uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/cmd/rampart/cli uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/cmd/rampart/cli, while a change to github.com/peg/rampart/cmd/rampart/cli can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/cmd/rampart/cli uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/cmd/rampart/cli uses github.com/peg/rampart/internal/detect, so a change to github.com/peg/rampart/internal/detect can break github.com/peg/rampart/cmd/rampart/cli, while a change to github.com/peg/rampart/cmd/rampart/cli can't break github.com/peg/rampart/internal/detect.
Position
Below the diagonal: github.com/peg/rampart/cmd/rampart/cli uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/cmd/rampart/cli uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/cmd/rampart/cli, while a change to github.com/peg/rampart/cmd/rampart/cli can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/cmd/rampart/cli uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/cmd/rampart/cli uses github.com/peg/rampart/internal/token, so a change to github.com/peg/rampart/internal/token can break github.com/peg/rampart/cmd/rampart/cli, while a change to github.com/peg/rampart/cmd/rampart/cli can't break github.com/peg/rampart/internal/token.
Position
Below the diagonal: github.com/peg/rampart/cmd/rampart/cli uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/cmd/rampart/cli uses github.com/peg/rampart/internal/generate, so a change to github.com/peg/rampart/internal/generate can break github.com/peg/rampart/cmd/rampart/cli, while a change to github.com/peg/rampart/cmd/rampart/cli can't break github.com/peg/rampart/internal/generate.
Position
Below the diagonal: github.com/peg/rampart/cmd/rampart/cli uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/mcp uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/internal/mcp, while a change to github.com/peg/rampart/internal/mcp can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/internal/mcp uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/mcp uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/mcp, while a change to github.com/peg/rampart/internal/mcp can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/mcp uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/mcp uses github.com/peg/rampart/internal/approval, so a change to github.com/peg/rampart/internal/approval can break github.com/peg/rampart/internal/mcp, while a change to github.com/peg/rampart/internal/mcp can't break github.com/peg/rampart/internal/approval.
Position
Below the diagonal: github.com/peg/rampart/internal/mcp uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/proxy uses github.com/peg/rampart/internal/audit, so a change to github.com/peg/rampart/internal/audit can break github.com/peg/rampart/internal/proxy, while a change to github.com/peg/rampart/internal/proxy can't break github.com/peg/rampart/internal/audit.
Position
Below the diagonal: github.com/peg/rampart/internal/proxy uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/proxy uses github.com/peg/rampart/internal/engine, so a change to github.com/peg/rampart/internal/engine can break github.com/peg/rampart/internal/proxy, while a change to github.com/peg/rampart/internal/proxy can't break github.com/peg/rampart/internal/engine.
Position
Below the diagonal: github.com/peg/rampart/internal/proxy uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/proxy uses github.com/peg/rampart/internal/signing, so a change to github.com/peg/rampart/internal/signing can break github.com/peg/rampart/internal/proxy, while a change to github.com/peg/rampart/internal/proxy can't break github.com/peg/rampart/internal/signing.
Position
Below the diagonal: github.com/peg/rampart/internal/proxy uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/proxy uses github.com/peg/rampart/internal/token, so a change to github.com/peg/rampart/internal/token can break github.com/peg/rampart/internal/proxy, while a change to github.com/peg/rampart/internal/proxy can't break github.com/peg/rampart/internal/token.
Position
Below the diagonal: github.com/peg/rampart/internal/proxy uses a module listed above it, which is the healthy direction.
github.com/peg/rampart/internal/proxy uses github.com/peg/rampart/internal/approval, so a change to github.com/peg/rampart/internal/approval can break github.com/peg/rampart/internal/proxy, while a change to github.com/peg/rampart/internal/proxy can't break github.com/peg/rampart/internal/approval.
Position
Below the diagonal: github.com/peg/rampart/internal/proxy uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 39.7 · Weak · gated by D1, D2, R1, R2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
19
High / Critical
A03:2025 — Software Supply Chain Failures
3
Medium
A07:2025 — Authentication Failures
2
High / Critical
A02:2025 — Security Misconfiguration
2
High / Critical
Roadmap
Top priorities: Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href; Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1; Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
Every finding carries one of four grades. Three say how serious it is. The fourth says this
survey could not settle it — and it is a grade, not a gap.
Critical — 16
A definite problem that already costs you something and drags the score down: a
missing authorisation check, a dependency with a known exploit, a build that does not reproduce. Failure here
tends to cause failures elsewhere.
Serious — 842
Likely wrong, but not failing yet. It degrades
the codebase over a longer horizon and can cause failures elsewhere — not urgent this week, not something to
carry for two years either.
Minor — 67
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 15
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 70 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 1.0, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 70 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, 914 of 925 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 4 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 200 test source file(s) (.go) that it cannot: it reads JavaScript/TypeScript test declarations off disk, so a JUnit/pytest-style suite is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-maintainer repository — bus factor is not applicable (4 contributor(s) across 1409 commit(s) sampled, automation and bot accounts excluded). One of them holds 100% of the history; the other 3 hold 0% each on average, below the 5% at which there is somebody to hand the work to. That is a single maintainer with drive-by contributors, not a team whose knowledge has concentrated — so the bus factor is not applicable and there is nothing here for the owner to act on.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D19 Documentation Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This kind did not reach the 95 % precision gate in three adjudicated runs (docs/plans/deterministic-engine/adjudication/D19-sample3-v3.md), so by the pre-registered fallback it publishes no row until a re-measurement shows it does. The candidates are counted here, not reported as findings, and the score does not include them.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's naming rules read C# through Roslyn and every other language through its sidecar model; these languages are left out (PHP's reading is its own change, a Roslyn-loaded VB or F# project has no population builder yet). Their declarations carry no naming verdict this run — this says nothing about whether their names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated per language (docs/plans/deterministic-engine.md, P5; C# and each NeutralApiArms arm pass): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. Each source language's comment syntax, and the code a comment annotates in it, needs its own proof before D24 judges it. Until then those comments are left unread, not counted as clean.
AXR1 Runtime accessibility — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. User interface: 1 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. Boot: crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:9090: page.goto: net::ERR_CONNECTION_REFUSED at http://127.0.0.1:9090/
Call log:
- navigating to "http://127.0.0.1:9090/", waiting until "load"
.
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Go, Python, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and this repository's Go, Python, c is most of its product and is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X21 Side-effecting pattern guard — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X23 Unguarded diagnostic materialisation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 148 further occurrence(s) are not listed individually; the score already reflects all 188.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's C, Python is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
Repo exclusion declarations (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.
Limitations & what we did not check
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
D11 Test Reliability: Flakiness is inferred from history/markers — we run the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D23 Boundary Type-Coupling: Boundary leakage is detected from type references across detected contexts — leaks that flow through primitives, serialization or shared infrastructure may not surface as a typed reference.
D24 Comment Value: Comment value is measured as redundancy only: a comment that repeats its code's words is found, but a paraphrase in other words, a vague comment, or one the code contradicts is not, and whether a comment is valuable is not claimed. Comments in other scripts or languages, and outside C#, are not judged.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A click handler on a plain element is now asked for a name too (it is a control the author declared), but the subtree test that answers it is deliberately generous: any DYNAMIC text expression in the subtree counts as a name, so an icon chosen by a ternary ({cond ? <IconA/> : <IconB/>}) reads as named, and a glyph component from a library the icon-import list does not know still names its parent. A clean result is "no unlabelled control found", not a labelling proof.
AC3 Page structure: Page structure is read from the static markup tree — landmarks, headings and lang injected at runtime aren't seen, heading ORDER is checked structurally (not against the rendered visual hierarchy), and lang/title/main fire only on full documents, never partials, and the data-table check sees header-cell presence (a <th> exists), not whether each header correctly associates with its cells. Static readiness, not conformance.
AC4 Keyboard semantics: Keyboard semantics are inferred from markup attributes — interactivity wired purely in script, focus managed at runtime, and component-level handlers are invisible. A clean result means "no static keyboard-trap shape", not a keyboard-operability proof.
AC6 Visual & motion safety: Contrast and motion safety are PARTIAL by construction — literal colours (hex/rgb/hsl/named) in inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS top-level declarations are read (same-rule/same-element colour+background pairs only); computed/runtime/theme colour, external-CDN stylesheets, CSS-in-JS dynamic (${…}) and nested-selector colours, cross-element pairs and image contrast stay out of reach, so a clean result is bounded by what the static CSS itself shows.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.
P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.
What it measures: How tangled the control flow is — methods with many branches are hard to test and change.
Method: Cyclomatic complexity per method (1 + decision points), computed exhaustively across production source; test projects separated by convention. Deterministic.
201 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was cli.newServeCmd at 145. A further 3 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being cli.mapCopilotTool at 29 — they are counted neither in the figure above nor in this dimension's score. 1 file carries no cyclomatic complexity row at all for this reason — every one of its over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: internal/engine/policy.go (Condition.IsEmpty at 16). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.
+ 192 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 9 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with cli.newServeCmd (cyclomatic 145), cli.newHookCmd (cyclomatic 126), cli.newUpgradeCmdWithDeps (cyclomatic 109). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 9 together lifts Cyclomatic Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 274 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Bring the 23 bodies over 60 down to 60 or less in Cognitive Complexity — start with cli.newServeCmd (cognitive 247), cli.newHookCmd (cognitive 173), cli.newUpgradeCmdWithDeps (cognitive 169). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 23 together lifts Cognitive Complexity from 2.0 to about 3.2/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D3 · God Classes7.8 / 10Strong✓ Tool-verified
What it measures: Over-large classes that try to do too much ("god classes").
Method: God-class detection by line and method-count thresholds per logical type (partial classes unified), filtered for generated code and registration/contract false positives. Deterministic.
ClassTooLong: Store · ×3internal/approval/store.go:253
TooManyMethods: Server · ×3internal/proxy/server.go:42
What to do
Resolve the 19 FunctionTooLong finding(s) in God Classes — start with setup.go (2), doctor.go (2), matcher.go (2). — One of this dimension's main actionable groups (19 warning-level).
Resolve the 19 FileTooLong finding(s) in God Classes — start with matcher.go, doctor.go, REDACTED. — One of this dimension's main actionable groups (19 warning-level).
Resolve the 5 MethodTooLong finding(s) in God Classes — start with eval_handlers.go, approval_handlers.go, engine.go. — One of this dimension's main actionable groups (5 warning-level).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.
Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.
101 duplicated block group(s) detected. 6.9 % of the production lines (4,594 of 66,167) are in a reported copy. A further 73 rows report members as variants of one another; the share counts each copied line once, however many rows cite it.
Edited copy of a member (14 corresponding lines) · ×7internal/engine/engine.go:503
+ 75 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 10 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with setup.go (2), setup_antigravity.go, REDACTED. — One of this dimension's main actionable groups (10 warning-level).
Resolve the 9 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with approve.go, rules.go, setup.go. — One of this dimension's main actionable groups (9 warning-level).
Resolve the 9 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with mcp.go (2), doctor.go, rules.go. — One of this dimension's main actionable groups (9 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D5 · Coupling10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.
Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.
Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.
2 production modules (npm+Go), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 0 module(s) off the main sequence.
What it measures: Whether a class's methods are focused on a single responsibility.
Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.
Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.
What it measures: How much of the code is actually exercised by tests.
Method: Coverage from the analyzer's own run of the suite, computed per-file with structured exclusions for generated, trivial, and glue code. A coverage report found in the repository is never read. When the suite can't be built/run in-image, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.
Line coverage 71.4% — 18 file(s) below 50%. Measured from the Go suite (github.com/peg/rampart: `go test -coverprofile -coverpkg=./...`, the 3 run(s) test reliability made). Taken over 3 runs of the suite: a line counts as covered only when every run executed it. 9 line(s) in 3 file(s) were executed in some runs and not in others, so they are not counted.
Tests reach code only in some runs: REDACTED · ×3REDACTED:1242
What to do
Resolve the 18 Low coverage finding(s) in Code Coverage — start with doctor.go, policy_generate.go, preload.go. — One of this dimension's main actionable groups (18 warning-level).
Resolve the 3 Tests reach code only in some runs finding(s) in Code Coverage — start with REDACTED, engine.go, context.go. — One of this dimension's main actionable groups (3 recommendation-level).
Detailed fixes: d8_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D10 · Test Quality10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests truly assert behaviour rather than just running the code.
Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.
0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 4 tests. Measured on the JavaScript/TypeScript suite only — at least 200 test source file(s) (.go) went unread, so its test quality is unmeasured and is not in these counts.
✓ On the Gold path — maintain.
Detailed fixes: d10_recommendation.md.
Do you agree with this assessment?
D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the tests pass reliably, with no flakiness.
Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.
What it measures: Whether dependencies are current, not deprecated, and not bloated. Known vulnerabilities are D30's.
Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (capped-linear for deprecation, prerelease and outdated) per KLoC. Known-vulnerable packages are D30's and are not charged here (rubric-2026.11.2). Exhaustive.
1 outdated, 0 author-deprecated direct Go module(s), 0 pinning or checksum defect(s). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from go.mod and go.sum there.
Outdated: golang.org/x/sys
✓ On the Gold path — maintain.
Detailed fixes: d12_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 48 required Go module(s) use a banned license. Licences were read per module version from the licence files pkg.go.dev detects (via api.deps.dev), over every module this repository's go.mod requires, direct and indirect, at the version the build uses. Go records no test-only scope at module level, so modules only this repository's own tests import are included. 1 of them carry no licence file that matches a known SPDX licence; that is missing data, not a violation, and none of them is charged.
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.
Top hotspots: cmd/rampart/cli/hook.go (16×126=2016); internal/engine/matcher.go (17×64=1088); REDACTED (6×145=870) Repeated repair below the complexity floor: cmd/rampart/cli/setup_codex.go (4 of 5 changes were fixes); internal/plugin/openclaw/provider-surface-replay.mjs (4 of 4 changes were fixes); cmd/rampart/cli/setup_claude_failure.go (4 of 4 changes were fixes)
Resolve the 25 Hotspot finding(s) in Churn × Complexity Hotspots — start with hook.go, matcher.go, REDACTED. — One of this dimension's main actionable groups (25 warning-level).
Resolve the 9 Repeated repair finding(s) in Churn × Complexity Hotspots — start with setup_codex.go, provider-surface-replay.mjs, setup_claude_failure.go. — One of this dimension's main actionable groups (9 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.
Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.
0 deducted task-comment markers across 66167 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.
What it measures: Whether the project's documentation is clear, complete, and useful.
Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.
1 of 1 documentation facets pass in full. 25 document(s) read across 2 unit(s).
✓ On the Gold path — maintain.
Detailed fixes: d19_recommendation.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
What it measures: Whether domain types (IDs, enums, value objects) leak across bounded-context boundaries.
Method: Cross-context domain-type leakage via Roslyn structural classification (strongly-typed IDs / value objects) over every public surface. Exhaustive, deterministic, type-level aggregate-boundary check.
Coverage: Bounded contexts derived from NAMESPACE prefix (or graph-inferred where available); cross-boundary domain-type leakage then checked exhaustively over every public member of every type.
What it measures: Whether comments are worth it — explaining WHY (valuable) rather than WHAT (redundant).
Method: Every inline C# comment compared word by word with the identifiers, literals and constructs of the code it annotates (taken from the syntax); a comment whose words that code already contains is redundant, as are closing-brace labels and generator template text. Comments giving a reason or a reference are kept; other scripts and languages are not judged. Deterministic, exhaustive, advisory.
1 of 2 build units (Go, npm) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesiongo.mod:1
What to do
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with go.mod. — One of this dimension's main actionable groups (1 recommendation-level).
Detailed fixes: d26_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
11 % of calls cross a namespace and 0 % go through an interface, but 83 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.
1 finding(s): 0 critical, 1 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.
REDACTED
REDACTED
What to do
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 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).
19 finding(s): 0 critical, 5 high, 10 medium, 4 low. semgrep hit a parse error in 2 file(s) — `preload/librampart.c` (line 140, line 143, line 148, …), `REDACTED` (line 151, line 153) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.
REDACTED
REDACTED
REDACTED
REDACTED
REDACTED
+ 1 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (6). — One of this dimension's main actionable groups (6 warning-level).
Resolve the 4 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (4). — One of this dimension's main actionable groups (4 issue-level).
Resolve the 1 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Detailed fixes: d29_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.
Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05. Advisory since rubric-2026.11.2 (CAI decision 0006): every row is a match against a vulnerability database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
Resolve the 1 High IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
Resolve the 1 Low IaC finding(s) in IaC & Container Security — start with REDACTED. — One of this dimension's main actionable groups (1 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.
2 of 157 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is scripts/generate-registry.go. Counted over 157 of the 193 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
Orphaned file · ×2scripts/generate-registry.go:1
Orphaned files with no living knowledge
✓ On the Gold path — maintain.
Detailed fixes: d34_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether files that change together actually belong together — pairs that repeatedly co-change in git history despite having no explicit code dependency, surfacing the hidden/logical coupling (and boundaries in the wrong place) a static scan can't see.
Method: Pairwise co-occurrence over the per-commit file sets in git history (production source only — tests and generated dropped): Degree-of-Coupling = shared ÷ min individual revisions, reported above noise floors (each file ≥10 revisions, ≥5 shared commits, ≥50% strength); sweeping commits excluded. Deterministic over fixed history.
Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.
What it measures: Whether the build pipeline provides supply-chain integrity — generated provenance/attestation, signed artifacts (cosign/sigstore), an SBOM, and pinned build actions. Presence of the configuration, not a runtime guarantee.
Method: Supply-chain provenance/signing read deterministically from CI/build config (.github/workflows, .gitlab-ci.yml, azure-pipelines, Jenkinsfile, .circleci) + the release surface: four signals — generated provenance/attestation (SLSA/in-toto/actions-attest), artifact signing (cosign/sigstore/gitsign), an SBOM (syft/sbom-action/*.spdx.json/*.cdx.json), and SHA-pinned build actions — scored 10·present/denom. NotApplicable without a build pipeline. Detects configuration presence, not runtime enforcement.
What it measures: Whether the repository publishes a coordinated-vulnerability-disclosure policy (SECURITY.md or security.txt) with a reporting contact, so finders know how to report a vulnerability. Presence of a policy file with a contact, not whether the policy is adequate or honoured.
Method: Vulnerability-disclosure policy read deterministically from the repo: a SECURITY.md (root/.github/docs) or .well-known/security.txt / security.txt, regex-checked for a reporting contact (email / URL / mailto). Present + contact → 10; present without a contact → 4; NotApplicable when no policy file exists (it may live off-repo). Detects the policy file's presence + contact, not its adequacy.
What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Reported apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.
Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. Advisory since rubric-2026.11.2 (CAI decision 0006): the malicious-package feed is a database that changes daily, so the reading is shown and never moves a scored dimension, lens or the headline.
What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.
Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.
0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.
✓ On the Gold path — maintain.
Detailed fixes: d44_recommendation.md.
Do you agree with this assessment?
Frontend & cross-cutting dimensions
R = React/JS · M = Maturity · P = Readiness.
AC2 · Forms & labels5.0 / 10Adequate✓ Tool-verified
Other · Accessibility — Whether form controls have a programmatic label (an associated label, aria-label or aria-labelledby), buttons have text, links have an accessible name, a click handler on a plain element names the control it declares, fieldsets have a non-empty legend, known UI-library field components carry a label prop, and a placeholder isn't used as the only label. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: inputs/selects/textareas checked for an associated label[for]/wrapping label/aria-label/aria-labelledby (per document), buttons for accessible text, fieldsets for a legend; placeholder-only labelling flagged. Deterministic, hard fact per control.
Coverage: Population: form controls, buttons, links, fieldsets and known UI-library field components in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and spread/dynamic-attribute elements are skipped, so a control whose label arrives through a spread or a runtime expression is deliberately not judged. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label. (×3) — internal/dashboard/static/index.html:341, internal/dashboard/static/index.html:412, internal/dashboard/static/index.html:455
This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×2) — internal/dashboard/static/index.html:413, internal/dashboard/static/index.html:457
What to do
Give every control a programmatic label (a <label for> / wrapping <label> / aria-label) and every button text — a placeholder is not a label.
Other · Accessibility — Whether pages declare a language (well-formed BCP-47) and a non-empty title, expose exactly one main landmark and a sane heading order with non-empty headings, keep zoom enabled, title their iframes, give data tables header cells, and avoid meta-refresh. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: html lang, document <title>, a main landmark and heading order on full documents only, plus zoom-disabling viewports, untitled iframes and meta-refresh anywhere. Deterministic, per structural checkpoint.
Coverage: Population: the PARSED MARKUP documents (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx). The page-level checks — lang, title, single main landmark — fire ONCE PER FULL DOCUMENT (an <html> root) and never on a partial or component fragment, so a repo of fragments is assessed only on the per-element checks (heading order, table headers, iframe titles, meta-refresh, zoom). Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. — internal/dashboard/static/index.html:2
What to do
Declare <html lang>, a document <title> and a <main> landmark, keep headings in order, leave zoom enabled, title iframes and drop meta-refresh.
Other · Accessibility — Whether interactive behaviour is keyboard-reachable — no click handler on a non-interactive element lacking a role, tabindex and key handler, no element the repo's own CSS styles `cursor: pointer` without giving it any of the three, no unfocusable element whose only binding is a mouse enter/leave pair or a double-click, no positive tabindex, no href-less anchor, no placeholder-href (#/javascript) link acting as a button. Static markup readiness, not a WCAG conformance claim.
Method: Static markup-model scan: click handlers on non-interactive elements lacking role+tabindex+key handler, positive tabindex values, and href-less anchors. Components skipped, spreads suppressed. Deterministic, hard fact per element.
Coverage: Population: elements that pose a keyboard-semantics question, in the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) — a non-natively-interactive element carrying a click handler, a double-click or hover enter/leave binding, a pointer-only gesture on a tabindex="0" element, or `cursor: pointer` from the repo's own CSS; an href-less or placeholder-href (#, javascript:) anchor; and any element with a positive tabindex. Natively interactive elements used correctly (<button>, <a href>, form controls) are NOT in the population — there is nothing to judge — so a page of nothing but correct controls gives AC4 nothing to measure. Keyboard reachability is judged from the markup, never from a rendered page. ★ An interactive element declared in a tagged-template (html`…`) or hyperscript frontend is NOT in this population — no producer reads either — so an empty population is reported as an analyzer gap, never as "this repository has no interactive elements".
A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — internal/dashboard/static/index.html:374, internal/dashboard/static/index.html:467
A script attaches a click listener to this <tbody>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler. (×2) — internal/dashboard/static/index.html:437, internal/dashboard/static/index.html:483
What to do
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
Other · Accessibility — Whether focus outlines aren't removed without a replacement, motion respects prefers-reduced-motion, and literal CSS colour pairs meet contrast — PARTIAL: inline styles, in-repo <style> blocks, in-repo .css files, var() tokens, Tailwind neutral utilities and CSS-in-JS literals are read (hex/rgb/hsl/named), never computed/runtime/external-CDN colour. Static markup readiness, not a WCAG conformance claim.
Method: Static markup/CSS scan: inline outline:none/0, literal inline colour/background contrast against the 4.5:1 AA floor, and <style>-block animation without a prefers-reduced-motion guard. Deterministic but PARTIAL — only inline styles and in-repo CSS literals are visible.
Coverage: Population: styled elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx), plus in-repo <style> blocks, in-repo .css files and CSS-in-JS literals. Colour contrast is computed from LITERAL colour pairs only (hex/rgb/hsl/named, including var() tokens and Tailwind neutral utilities) — computed, runtime-themed and external-CDN colour is never resolved, so this is a partial read of contrast by construction. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.
`.policy-reload-btn.spinning svg` moves (`animation: spin .6s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce. — internal/dashboard/static/index.html:251
`#connect-btn` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:36
`#error-banner button` sets color: #fff on background-color: #ef4444 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:51
`.tab-badge` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:79
`.session-group-count` sets color: #868e96 on background-color: #e9ecef — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:122
`.policy-test-btn` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:262
`.run-cluster-count` sets color: #868e96 on background-color: #e9ecef — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — internal/dashboard/static/index.html:287
What to do
Keep a visible focus style (don't remove the outline without a replacement), guard animation with prefers-reduced-motion, and raise low-contrast colour pairs to at least 4.5:1.
Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.
Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.
Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.
Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.
Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').
Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.
Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.
Method: Filesystem scan: README presence, word count, and headings for depth; git history for staleness. Exhaustive across root and project dirs, deterministic.
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.
Method: Filesystem scan: src/test folder separation and namespace-prefix consistency (majority RootNamespace agreement). Exhaustive across projects, deterministic.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
`internal/plugin/openclaw/approval-regression.mjs` reports through `console.*` at line 228 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — internal/plugin/openclaw/approval-regression.mjs:228
`internal/plugin/openclaw/provider-surface-replay.mjs` reports through `console.*` at line 529 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline. — internal/plugin/openclaw/provider-surface-replay.mjs:529
What to do
Route service-code `console.*` output through the module's structured logger (with named fields), so delivery outcomes and failures reach the log pipeline with a level.
Readiness · Readiness — Whether SAST, secret/dependency scanning and performance benchmarking are wired in (presence, not runtime).
Method: Filesystem scan: SAST configuration, dependency-update automation, secret scanning, and a benchmark harness or benchmark step — in this repository's own ecosystem. Exhaustive, deterministic.
`REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list. — REDACTED:7
What to do
Dependabot is configured but does not watch `npm` — add that `package-ecosystem` entry to REDACTED so those dependencies get the same automatic update and advisory pressure as the ones it already covers.
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.
The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release. — .github/workflows/docker.yml:81
What to do
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Do you agree with this assessment?
P5 · DR & Backup0.0 / 10Critical✓ Tool-verified
Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.
Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.
A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.
Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.
Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.
Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
R1 · Type Safety0.0 / 10Critical✓ Tool-verified
React / JS · Code Health — How much of the frontend is typed TypeScript vs untyped JavaScript.
Method: Frontend file inventory: the share of typed TypeScript vs untyped JavaScript across the source tree. Deterministic, exhaustive over frontend files.
0 typed · 15 plain JS — the untyped files are docs-site/assets/search-input.js, internal/plugin/openclaw/approval-regression.mjs, internal/plugin/openclaw/degraded-mode-test.mjs, internal/plugin/openclaw/hooks/rampart/index.js, internal/plugin/openclaw/index.js, internal/plugin/openclaw/provider-surface-replay.mjs (+9 more).
What to do
Adopt TypeScript for the frontend: add a typecheck step to the build, then either type-check the existing JavaScript in place (`checkJs`/JSDoc types) or convert the highest-traffic modules first — no file is typed today, so this is an adoption, not a clean-up.
React / JS · Code Health — The share of the scored frontend lines inside a near-exact copy-pasted block of substantial extent (the D4 clone algorithm over JS/TS tokens, D-386; each line once, 10 at none and 0 at a quarter of the lines, as D4): a block is reported only where its copies still agree on most of their own identifiers and literals, or were renamed as they were pasted but kept most of their constants, and where the copies carry enough code to stand on their own or the copied extent reaches 30 lines — so a re-implementation sharing neither names nor values, and a small pasted declaration, are both found and deliberately not reported, and a clean R10 is not a claim that nothing was copied.
Method: Near-exact copy-pasted blocks of substantial extent across the frontend (the D4 clone algorithm run over JS/TS tokens). Masking finds the candidates; a block is reported when its copies still agree on most of their own identifiers and literals, or when a renamed copy still agrees on most of its constants, AND the copies carry enough code to stand on their own — or when the copied extent reaches 30 lines. So a re-implementation sharing neither names nor values, and a small pasted declaration, are deliberately not counted. Scored on the share of the scored frontend lines inside a reported copy, on the same curve as D4. Deterministic.
scripts/compat-copilot-latest.mjs:22 · scripts/compat-gemini-latest.mjs:20 — the two spans are one implementation copied and then locally edited — 514 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — scripts/compat-copilot-latest.mjs:22
scripts/compat-cline-latest.mjs:26 · scripts/compat-gemini-latest.mjs:25 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it. — scripts/compat-cline-latest.mjs:26
internal/plugin/openclaw/degraded-mode-test.mjs:3 · internal/plugin/openclaw/tool-alias-test.mjs:3 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are. — internal/plugin/openclaw/degraded-mode-test.mjs:3
scripts/compat-cline-latest.mjs:147 · scripts/compat-copilot-latest.mjs:142 · scripts/compat-gemini-latest.mjs:113 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/compat-cline-latest.mjs:147
internal/plugin/openclaw/approval-regression.mjs:14 · internal/plugin/openclaw/degraded-mode-test.mjs:12 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — internal/plugin/openclaw/approval-regression.mjs:14
internal/plugin/openclaw/degraded-mode-test.mjs:7 · internal/plugin/openclaw/provider-surface-replay.mjs:15 · internal/plugin/openclaw/tool-alias-test.mjs:7 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — internal/plugin/openclaw/degraded-mode-test.mjs:7
internal/plugin/openclaw/approval-regression.mjs:41 · internal/plugin/openclaw/smoke-test.mjs:29 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — internal/plugin/openclaw/approval-regression.mjs:41
scripts/compat-gemini-latest.mjs:32 · scripts/compat-openclaw-latest.mjs:63 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported. — scripts/compat-gemini-latest.mjs:32
internal/plugin/openclaw/tool-alias-test.mjs:47 · internal/plugin/openclaw/tool-alias-test.mjs:74 — the two spans are one implementation copied and then locally edited — 55 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one. — internal/plugin/openclaw/tool-alias-test.mjs:47
What to do
Act on each finding's own remediation rather than one rule: the move depends on what recurs. Where the copies are executable blocks, give the shared part one home and call it from each site; where they are declarations, a listing, a specialisation already delegating to its base, or one shape repeated per entity, there is no call site and the move is a shared type, a generated set or a factory — sometimes there is nothing to extract.
React / JS · Code Health — Per-function cyclomatic/cognitive complexity from the token-level function scanner (D-386) — real branching, not a regex heuristic.
Method: Per-function cyclomatic/cognitive complexity from a token-level function scanner (real branching, not a regex heuristic), computed over every frontend function. Deterministic.
checkWithRampart has cyclomatic complexity 39 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:595
evaluateToolCall has cyclomatic complexity 35 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:737
nativeApprovalDescription has cyclomatic complexity 24 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:44
readControlResponseText has cyclomatic complexity 18 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:513
normalizeToolCall has cyclomatic complexity 18 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:207
sameConversation has cyclomatic complexity 14 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:307
collectApplyPatchPaths has cyclomatic complexity 12 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:141
classifyControlConsequence has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:394
fetchImpl has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/provider-surface-replay.mjs:489
policyParamsForTool has cyclomatic complexity 11 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes. — internal/plugin/openclaw/index.js:438
Do you agree with this assessment?
R3 · Large Files4.3 / 10Weak✓ Tool-verified
React / JS · Code Health — How many source files exceed the large-file threshold.
Method: Components/modules exceeding the large-file threshold, counted exhaustively across the frontend source tree. Deterministic.
internal/plugin/openclaw/index.js has 960 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — internal/plugin/openclaw/index.js:1
internal/plugin/openclaw/provider-surface-replay.mjs has 501 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — internal/plugin/openclaw/provider-surface-replay.mjs:1
What to do
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Do you agree with this assessment?
R4 · Test Coverage1.7 / 10Critical✓ Tool-verified
React / JS · Readiness — Static test reachability (D-386): the share of production files reachable from any test via the import graph — measured without running anything.
Method: Static test reachability: the share of production files reachable from any test via the import graph — measured without running anything. Deterministic.
No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one. (×5) — internal/plugin/openclaw/provider-surface-replay.mjs:1, internal/plugin/openclaw/approval-regression.mjs:1, internal/plugin/openclaw/degraded-mode-test.mjs:1, …
What to do
Add tests that import the unreached modules (directly or through their public entry).
Do you agree with this assessment?
R6 · Tooling10.0 / 10Exemplary✓ Tool-verified
React / JS · Readiness — Whether the project wires up test, lint and typecheck — detected from each package.json script's COMMAND (eslint / tsc / vitest / jest / playwright), not just its name, and corroborated against CI-workflow invocations so a tool run only in CI still counts.
Method: package.json scanned for test/lint/typecheck script wiring. Deterministic presence check.
Do you agree with this assessment?
R7 · Dead Code10.0 / 10Exemplary✓ Tool-verified
React / JS · Code Health — Files unreachable from every application/tooling/test entry point, and exports nothing imports (module-graph reachability, D-386).
Method: Dead code: files unreachable from every application/tooling/test entry point plus exports nothing imports, via module-graph reachability. Deterministic, exhaustive over the import graph.
React / JS · Architecture — Import cycles in the module graph (D-386) — files that can only be understood and changed together.
Method: Import cycles in the module graph, detected exhaustively over JS/TS imports (the same cycle detection as the .NET coupling dimension). Deterministic.
Other · Security — Only what this repository's own non-C# files could be read for was assessed — and because this repository commits the configuration that serves its own HTTP surface, that configuration could be read in full for the security response headers it sets. Nothing else in this dimension was assessed: the transport, cookie, input-validation and crypto controls are read from a source model that was not loaded for this repository’s language, so their absence here is not a finding about this repository.
Method: Roslyn plus filesystem scan: HSTS/security headers, secure cookies, input validation, middleware order, weak crypto (MD5/SHA1/DES); HTTPS-metadata context-aware. On a repository with no .NET source it reads JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Elixir source itself (test, vendored, generated and minified paths not) for the arms that hold whether or not the code serves HTTP: a weak hash or cipher, key material fixed in the source, a TLS client that accepts any certificate, and (JavaScript/TypeScript, Ruby, Scala, Rust and Elixir) an obsolete TLS version; the server controls are not assessed there, and a Dart, Ruby, Scala, Rust or Elixir repository that serves no HTTP of its own is N/A on them. Deterministic.
Set: X-Content-Type-Options. Missing: Content-Security-Policy, Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−1.5 on this card.) — docs/_headers:1
What to do
Add Content-Security-Policy, Strict-Transport-Security, X-Frame-Options beside the headers already set; Content-Security-Policy is the one that pays for itself first, then Strict-Transport-Security, then nosniff and a frame policy.
Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.
Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether functions that make a cancellable request accept or pass on a context.Context or an AbortSignal (adoption curve).
Method: Roslyn scan: every async method (excluding framework-fixed overrides/Blazor handlers) checked for CancellationToken parameter presence. Deterministic, adoption percentage. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same question: every named async function that itself makes a request an AbortSignal can cancel (global `fetch`, axios and its file-local instances, ky, ofetch) counts, and it is compliant when its parameters or body name a signal or it hands one of its own parameters to the request as options; signatures a framework fixes (JSX event handlers, route and lifecycle exports, request-first handlers, `override`, `'use server'` modules, TanStack `mutationFn`) are exempt unless they take a signal. Deterministic, adoption percentage.
Only 17/21 functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
`checkServeReachable` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — internal/watch/watch.go:221
`doctorTokenAuth` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — cmd/rampart/cli/doctor.go:823
`doctorPoliciesAPI` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — cmd/rampart/cli/doctor.go:844
`doctorPending` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — cmd/rampart/cli/doctor.go:874
What to do
Thread a context.Context or an AbortSignal through functions that make requests, so the work stops when its caller gives up.
Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.
Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen. Whether a `for … range` leaves the slice or map it is walking alone — Go raises nothing, but the walk and the collection part: a range evaluates its slice once, so an element appended in the body is never visited and a removal by reslicing (`s = append(s[:i], s[i+1:]...)`, `slices.Delete`) shifts the next element under the index, which is then skipped while the last is read twice; a reslice, a reassignment or a sort leaves every later `s[i]` naming another element; and a map's order is unspecified, so deleting another key (or clearing the map) changes from run to run which entries the loop still sees.
Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`body, _ := io.ReadAll(io.LimitReader(resp.Body, 512))` writes the call's error to `_` and then uses `body` as if the call succeeded. When `io.ReadAll` fails, `body` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `body` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/watch/approval_client.go:89
`body, _ := json.Marshal(map[string]any{ "approved": approved, "resolved_by": "watch-tui", "persist": persist, })` writes the call's error to `_` and then uses `body` as if the call succeeded. When `json.Marshal` fails, `body` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `body` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/watch/approval_client.go:126
`respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 512))` writes the call's error to `_` and then uses `respBody` as if the call succeeded. When `io.ReadAll` fails, `respBody` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `respBody` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/watch/approval_client.go:148
`if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×17) — internal/watch/watch.go:224, internal/watch/watch.go:232, internal/token/store.go:412, …
`if _, err := os.Stat(path); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/tlsutil/tlsutil.go:227
`if readErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/report/export.go:101
`if _, err := rand.Read(b); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/report/html.go:460
`if _, err := w.Write([]byte(" ")); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/proxy/sse.go:102
`if _, err := w.Write(data); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/proxy/sse.go:115
`if err := json.Unmarshal(data, &pkg); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — internal/plugin/openclaw/embed.go:49
An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. (×3) — internal/plugin/openclaw/index.js:430, internal/plugin/openclaw/index.js:646, internal/plugin/openclaw/index.js:918
`.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it. (×4) — internal/plugin/openclaw/index.js:518, internal/plugin/openclaw/index.js:536, internal/plugin/openclaw/index.js:652, …
`except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×2) — internal/plugin/hermes/__init__.py:240, internal/plugin/hermes/__init__.py:1128
`data, _ := json.MarshalIndent(approvals, "", " ")` writes the call's error to `_` and then uses `data` as if the call succeeded. When `json.MarshalIndent` fails, `data` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `data` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/openclaw/sync.go:136
`matches, _ := filepath.Glob(filepath.Join(dir, pattern))` writes the call's error to `_` and then uses `matches` as if the call succeeded. When `filepath.Glob` fails, `matches` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `matches` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. (×2) — internal/openclaw/hardening/hardening.go:151, internal/openclaw/hardening/hardening.go:163
`responseFields, _ = decodeCanonicalJSONObject(trimmed, "jsonrpc", "id", "method", "params", "result", "error")` writes the call's error to `_` and then uses `responseFields` as if the call succeeded. When `decodeCanonicalJSONObject` fails, `responseFields` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `responseFields` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/mcp/proxy.go:785
`absFile, _ := filepath.Abs(s.file)` writes the call's error to `_` and then uses `absFile` as if the call succeeded. When `filepath.Abs` fails, `absFile` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `absFile` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line. — internal/engine/dirstore.go:182
What to do
Discarded error (assigned to `_`, then its result used)
Do you agree with this assessment?
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.
Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.
Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.
Do you agree with this assessment?
WCAG coverage — what static analysis assessed
Statically assessed 12 of 55 WCAG 2.2 Level A/AA success criteria (22%; ≈24% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 43 require runtime or manual evaluation. Partial signal only (a clean result is necessary, not sufficient; static analysis fully verifies none). This is accessibility readiness, not a conformance claim — a WCAG conformance claim requires manual evaluation (WCAG-EM 1.0).
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
Unscored — 4 check(s) recorded observations but carry no score
These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.
P12 CI test-gate honesty — 1 observation(s) recorded · Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
X10 Duplicated predicate — 20 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X7 Silent fallback defaults — 20 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
X9 Subsumed condition operand — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 3 control(s) we could not find positive evidence for
These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.
C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C4 Data Retention — Not assessed: these retention controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks retention controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
C5 Data-Subject Rights — Not assessed: these data-subject rights controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks data-subject rights controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
Not included — 53 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 image/media element found in the parsed markup — AC1 not applicable here.
AC5 ARIA correctness — No ARIA usage found in the parsed markup — AC5 not applicable here.
AX1 Captive dependencies — Not applicable: this repository's Go imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's JavaScript imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's; this repository's Python imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX7 Slice cohesion — not applicable — not a vertical-slice architecture
AX8 Test isolation — no test/production split to check
AX9 CQS / query purity — no CQRS query handlers detected — query purity is not applicable to this codebase
AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
AXR1 Runtime accessibility — The runtime tier booted this repository's service, but crawled PUBLIC routes only — add a Playwright storageState (e.g. playwright/.auth/user.json) or a test auth-setup to crawl authenticated screens rendered 0/1 surface(s) × 2 renders render failed for http://127.0.0.1:9090: page.goto: net::ERR_CONNECTION_REFUSED at http://127.0.0.1:9090/
Call log:
- navigating to "http://127.0.0.1:9090/", waiting until "load"
. This repository also has a user interface (1 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates) that the booted service does not serve, and this scan has no strategy that reaches it — so no WCAG success criterion was verified in a rendered page on this run. That is a gap in OUR tooling, not a finding about your application: nothing here says the interface is inaccessible. The static accessibility checks still ran.
AXS1 Runtime exposed surface — 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.
D16 Bus Factor — single-maintainer repository — bus factor is not applicable
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.
D21 Naming Consistency — Naming consistency does not read html yet; not measured.
D22 Internal API Consistency — API consistency is measured on C#, TypeScript, Go only; the exposed JavaScript surface was not measured.
D25 ADR Conformance — no ADRs to check
D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
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
DM1 Domain Modelling — applicable but not scored (1 of 2 signals for this style — below the bar we score at): 3 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit)
ED1 Event-Driven — not scored — this repository shows only 1 of the 3 signals this lens looks for (4 event-sourced shape(s) (event folds / event-recording aggregates))
ED5 Idempotency — no mutating command handlers or message consumers detected — idempotency check not applicable
ES1 Event Sourcing — applicable but not scored (2 of 3 signals for this style — below the bar we score at): 1 aggregate(s) with Apply/When folds; 3 Go aggregate(s) recording domain events (own events-slice append / raise-record)
GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
P9 Domain vs controller coverage — coverage data present for 180 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
R11 Import Boundaries — No recognizable feature-sliced/layered src layout — boundary rules not applicable.
R5 Dependency Freshness — no package-lock.json — dependency freshness not measured (would require an npm lockfile); JS/npm CVEs are scored in D30 (Dependency Vulnerabilities), which answers every ecosystem
R8 Dependency Hygiene — Not measured — no package.json declares any dependency, so there is nothing to check imports against (imports may resolve through a host runtime rather than node).
SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
X1 Async correctness — X1 reached only 8% of this repository's production lines — go (64,131 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X12 Unreachable branch — X12 reached only 8% of this repository's production lines — go (64,131 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — X16 reached only 5% of this repository's production lines — go (64,131 lines), python (2,036 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X17 Uncapped recursion over a caller-supplied document — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X18 Disposal-pattern correctness — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X21 Side-effecting pattern guard — X21 reached only 8% of this repository's production lines — go (64,131 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X22 Contradicted release guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X23 Unguarded diagnostic materialisation — X23 reached only 8% of this repository's production lines — go (64,131 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X25 Inert configuration knob — X25 reached only 8% of this repository's production lines — go (64,131 lines), c (1,258 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
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.
Critical — 16 finding(s)
AC2 · Forms & labels· <input> without a programmatic label · ×4
<input> without a programmatic label internal/dashboard/static/index.html:341— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label internal/dashboard/static/index.html:412— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
<input> without a programmatic label internal/dashboard/static/index.html:413— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
<input> without a programmatic label internal/dashboard/static/index.html:455— This control has only a placeholder — a placeholder is not a label (it vanishes on input and many AT ignore it). Add a <label for>, a wrapping <label>, or aria-label.
AC4 · Keyboard semantics· Click handler on a non-interactive <div> · ×2
Click handler on a non-interactive <div> internal/dashboard/static/index.html:374— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <div> internal/dashboard/static/index.html:467— A script attaches a click listener to this <div>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics· Click handler on a non-interactive <tbody> · ×2
Click handler on a non-interactive <tbody> internal/dashboard/static/index.html:437— A script attaches a click listener to this <tbody>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
Click handler on a non-interactive <tbody> internal/dashboard/static/index.html:483— A script attaches a click listener to this <tbody>, but it has no role, no tabindex and no key handler, so it can only be operated with a mouse. Use a <button>, or add role + tabindex="0" + a key handler.
AC2 · Forms & labels· <select> without a programmatic label · ×1
<select> without a programmatic label internal/dashboard/static/index.html:457— This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
Hotspot: cmd/rampart/cli/hook.go cmd/rampart/cli/hook.go:363— cmd/rampart/cli/hook.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 126 in cli.newHookCmd at line 363. 12 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/hook.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/engine/matcher.go internal/engine/matcher.go:1286— internal/engine/matcher.go changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in engine.pathChangeTargets at line 1286. 15 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/engine/matcher.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: REDACTED REDACTED:95— REDACTED changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 145 in cli.newServeCmd at line 95. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/doctor.go cmd/rampart/cli/doctor.go:159— cmd/rampart/cli/doctor.go changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in cli.runDoctor at line 159. 9 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/doctor.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/setup.go cmd/rampart/cli/setup.go:264— cmd/rampart/cli/setup.go changed 16 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in cli.newSetupClaudeCodeCmd at line 264. 7 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/setup.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/plugin/openclaw/index.js internal/plugin/openclaw/index.js:723— internal/plugin/openclaw/index.js changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in index.register at line 723. 7 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/plugin/openclaw/index.js`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/proxy/eval_handlers.go internal/proxy/eval_handlers.go:44— internal/proxy/eval_handlers.go changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in Server.handleToolCall at line 44. 4 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/proxy/eval_handlers.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/engine/shellparse.go internal/engine/shellparse.go:617— internal/engine/shellparse.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 44 in engine.stripPOSIXEnvUtilityMode at line 617. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/engine/shellparse.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/plugin/hermes/__init__.py internal/plugin/hermes/__init__.py:1038— internal/plugin/hermes/__init__.py changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 35 in hermes._effective_terminal_cwd at line 1038. 5 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/plugin/hermes/__init__.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/verify.go cmd/rampart/cli/verify.go:119— cmd/rampart/cli/verify.go changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in cli.newVerifyCmd at line 119. 6 of those changes were fix/bug commits, so the churn is repair rather than feature work. Before the next change lands here, make sure the area it touches is under test, 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. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/verify.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/engine/download_exec.go internal/engine/download_exec.go:467— internal/engine/download_exec.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 50 in engine.visitDownloadExecutionAliases at line 467. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/engine/download_exec.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/engine/pipe_download_exec.go internal/engine/pipe_download_exec.go:307— internal/engine/pipe_download_exec.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 86 in engine.visitPipedDownloadExecutionAliases at line 307. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/engine/pipe_download_exec.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/approval/store.go internal/approval/store.go:1133— internal/approval/store.go changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 29 in Store.AutoApproveRunBeforePublishForRunScopeSnapshot at line 1133. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/approval/store.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/mcp/proxy.go internal/mcp/proxy.go:428— internal/mcp/proxy.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 48 in Proxy.handleToolsCall at line 428. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/mcp/proxy.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/hook_codex.go cmd/rampart/cli/hook_codex.go:41— cmd/rampart/cli/hook_codex.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in cli.parseCodexInput at line 41. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/hook_codex.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/engine/engine.go internal/engine/engine.go:127— internal/engine/engine.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 45 in Engine.EvaluateWith at line 127. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/engine/engine.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/setup_openclaw_plugin.go cmd/rampart/cli/setup_openclaw_plugin.go:1066— cmd/rampart/cli/setup_openclaw_plugin.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in cli.loadOpenClawToolsConfigDocument at line 1066. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/setup_openclaw_plugin.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/init.go cmd/rampart/cli/init.go:84— cmd/rampart/cli/init.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 59 in cli.newInitCmd at line 84. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/init.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: scripts/compat-hermes-latest.py scripts/compat-hermes-latest.py:670— scripts/compat-hermes-latest.py changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in compat-hermes-latest.main at line 670. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- scripts/compat-hermes-latest.py`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/audit/event.go internal/audit/event.go:148— internal/audit/event.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in audit.eventKeysCanonical at line 148. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/audit/event.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/hook_copilot.go cmd/rampart/cli/hook_copilot.go:52— cmd/rampart/cli/hook_copilot.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in cli.parseCopilotInput at line 52. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/hook_copilot.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/serve_install.go cmd/rampart/cli/serve_install.go:583— cmd/rampart/cli/serve_install.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in cli.installLinux at line 583. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/serve_install.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/cline.go cmd/rampart/cli/cline.go:30— cmd/rampart/cli/cline.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in cli.newSetupClineCmd at line 30. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/cline.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: internal/dashboard/static/index.html internal/dashboard/static/index.html:1101— internal/dashboard/static/index.html changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in index.html.handlePendingClick at line 1101. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/dashboard/static/index.html`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Hotspot: cmd/rampart/cli/hook_approval.go cmd/rampart/cli/hook_approval.go:63— cmd/rampart/cli/hook_approval.go changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in hookApprovalClient.requestApprovalCtx at line 63. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/hook_approval.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Swallowed exception (caught, then discarded) internal/watch/watch.go:224— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/watch/watch.go:232— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/token/store.go:412— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/tlsutil/tlsutil.go:42— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/tlsutil/tlsutil.go:227— `if _, err := os.Stat(path); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/report/compliance.go:257— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/report/export.go:101— `if readErr != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/report/html.go:460— `if _, err := rand.Read(b); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/proxy/audit_handlers.go:318— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/proxy/audit_handlers.go:347— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/proxy/helpers.go:373— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/proxy/sse.go:102— `if _, err := w.Write([]byte(" ")); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/proxy/sse.go:115— `if _, err := w.Write(data); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/openclaw/embed.go:43— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/openclaw/embed.go:49— `if err := json.Unmarshal(data, &pkg); err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/openclaw/embed.go:85— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/hermes/__init__.py:240— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/hermes/__init__.py:1128— `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/hermes/embed.go:27— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/hermes/embed.go:53— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/plugin/hermes/embed.go:93— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/openclaw/sync.go:74— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/openclaw/hardening/hardening.go:167— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/notify/approval_format.go:30— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
Swallowed exception (caught, then discarded) internal/mcp/jsonrpc.go:60— `if err != nil` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
FunctionTooLong: cli.newServeCmd REDACTED:95— FunctionTooLong — newServeCmd runs 424 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 324 over it, 4.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newHookCmd cmd/rampart/cli/hook.go:363— FunctionTooLong — newHookCmd runs 419 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 319 over it, 4.19× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newUpgradeCmdWithDeps REDACTED:130— FunctionTooLong — newUpgradeCmdWithDeps runs 294 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 194 over it, 2.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newSetupOpenClawCmd cmd/rampart/cli/setup.go:587— FunctionTooLong — newSetupOpenClawCmd runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: engine.visitPipedDownloadExecutionAliases internal/engine/pipe_download_exec.go:307— FunctionTooLong — visitPipedDownloadExecutionAliases runs 166 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 66 over it, 1.66× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newInitCmd cmd/rampart/cli/init.go:84— FunctionTooLong — newInitCmd runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: audit.recoverChainStateByLinks internal/audit/recovery_links.go:35— FunctionTooLong — recoverChainStateByLinks runs 152 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 52 over it, 1.52× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.runInteractiveSetup cmd/rampart/cli/setup_interactive.go:100— FunctionTooLong — runInteractiveSetup runs 150 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.runDoctor cmd/rampart/cli/doctor.go:159— FunctionTooLong — runDoctor runs 146 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 46 over it, 1.46× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newWrapCmd cmd/rampart/cli/wrap.go:57— FunctionTooLong — newWrapCmd runs 141 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 41 over it, 1.41× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newSetupClaudeCodeCmd cmd/rampart/cli/setup.go:264— FunctionTooLong — newSetupClaudeCodeCmd runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: engine.matchConditionForAction internal/engine/matcher.go:2669— FunctionTooLong — matchConditionForAction runs 126 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 26 over it, 1.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.NewRootCmd cmd/rampart/cli/root.go:63— FunctionTooLong — NewRootCmd runs 125 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 25 over it, 1.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.runBench cmd/rampart/cli/bench.go:229— FunctionTooLong — runBench runs 121 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 21 over it, 1.21× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.newMCPProxyCmd cmd/rampart/cli/mcp.go:77— FunctionTooLong — newMCPProxyCmd runs 120 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 20 over it, 1.20× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.runAllowBlock cmd/rampart/cli/allow.go:119— FunctionTooLong — runAllowBlock runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: engine.pathChangeTargets internal/engine/matcher.go:1286— FunctionTooLong — pathChangeTargets runs 107 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 7 over it, 1.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.supportedIntegrationDrivers cmd/rampart/cli/integration_driver.go:46— FunctionTooLong — supportedIntegrationDrivers runs 103 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 3 over it, 1.03× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FunctionTooLong: cli.doctorHermesIntegration cmd/rampart/cli/doctor.go:2107— FunctionTooLong — doctorHermesIntegration runs 102 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 2 over it, 1.02× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
FileTooLong: engine/matcher.go internal/engine/matcher.go— FileTooLong — 1775 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1275 over it, 3.55× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/doctor.go cmd/rampart/cli/doctor.go— FileTooLong — 1576 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1076 over it, 3.15× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: REDACTED REDACTED— FileTooLong — 1399 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 899 over it, 2.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/hook.go cmd/rampart/cli/hook.go— FileTooLong — 1304 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 804 over it, 2.61× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/setup_openclaw_plugin.go cmd/rampart/cli/setup_openclaw_plugin.go— FileTooLong — 1283 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 783 over it, 2.57× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: approval/store.go internal/approval/store.go— FileTooLong — 1252 significant lines (blank, comment-only and punctuation-only lines excluded), about 66% of them inside a single declaration: Store (44 blocks, 253-2043). The bar is 500 significant lines; this is 752 over it, 2.50× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: cli/setup.go cmd/rampart/cli/setup.go— FileTooLong — 1218 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 718 over it, 2.44× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/verify.go cmd/rampart/cli/verify.go— FileTooLong — 1078 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 578 over it, 2.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: engine/shellparse.go internal/engine/shellparse.go— FileTooLong — 902 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 402 over it, 1.80× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: static/index.html internal/dashboard/static/index.html— FileTooLong — 896 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 396 over it, 1.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: engine/engine.go internal/engine/engine.go— FileTooLong — 780 significant lines (blank, comment-only and punctuation-only lines excluded), about 78% of them inside a single declaration: Engine (35 blocks, 40-1305). The bar is 500 significant lines; this is 280 over it, 1.56× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: mcp/proxy.go internal/mcp/proxy.go— FileTooLong — 752 significant lines (blank, comment-only and punctuation-only lines excluded), about 70% of them inside a single declaration: Proxy (25 blocks, 126-1143). The bar is 500 significant lines; this is 252 over it, 1.50× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: REDACTED REDACTED— FileTooLong — 689 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: newServeCmd (95-741). The bar is 500 significant lines; this is 189 over it, 1.38× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: openclaw/index.js internal/plugin/openclaw/index.js— FileTooLong — 670 significant lines (blank, comment-only and punctuation-only lines excluded; the length bar is tripled for a single-responsibility module of 4 or fewer top-level units). The bar is 500 significant lines; this is 170 over it, 1.34× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: proxy/approval_handlers.go internal/proxy/approval_handlers.go— FileTooLong — 665 significant lines (blank, comment-only and punctuation-only lines excluded), about 85% of them inside a single declaration: Server (8 blocks, 21-966). The bar is 500 significant lines; this is 165 over it, 1.33× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: cli/bench.go cmd/rampart/cli/bench.go— FileTooLong — 622 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 122 over it, 1.24× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: proxy/eval_handlers.go internal/proxy/eval_handlers.go— FileTooLong — 592 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: Server (15 blocks, 44-853). The bar is 500 significant lines; this is 92 over it, 1.18× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
FileTooLong: engine/download_exec.go internal/engine/download_exec.go— FileTooLong — 578 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 78 over it, 1.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: cli/policy_registry.go cmd/rampart/cli/policy_registry.go— FileTooLong — 505 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 5 over it, 1.01× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
Duplicated block (9 lines × 2) cmd/rampart/cli/setup.go:437— cmd/rampart/cli/setup.go:437-445 | cmd/rampart/cli/setup.go:571-579 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) cmd/rampart/cli/setup.go:1928— cmd/rampart/cli/setup.go:1928-1936 | cmd/rampart/cli/setup.go:2013-2021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:1928` 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) cmd/rampart/cli/setup_antigravity.go:146— cmd/rampart/cli/setup_antigravity.go:146-154 | internal/plugin/hermes/embed.go:162-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 `cmd/rampart/cli/setup_antigravity.go:146` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also 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. Check import visibility before settling on that home: `internal/plugin/hermes/embed.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (9 lines × 2) REDACTED:1568— REDACTED:1568-1577 | REDACTED:1611-1619 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1568` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (9 lines × 2) internal/audit/jsonl.go:149— internal/audit/jsonl.go:149-157 | internal/audit/recovery_links.go:110-118 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) internal/plugin/hermes/embed.go:88— internal/plugin/hermes/embed.go:88-96 | internal/plugin/openclaw/embed.go:80-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
Duplicated block (9 lines × 2) internal/proxy/eval_handlers.go:58— internal/proxy/eval_handlers.go:58-66 | internal/proxy/eval_handlers.go:616-624 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (9 lines × 2) internal/engine/policy.go:455— internal/engine/policy.go:455-463 | internal/engine/policy.go:503-514 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/engine/policy.go:455` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (9 lines × 2) internal/engine/dirstore.go:320— internal/engine/dirstore.go:320-328 | internal/engine/dirstore.go:403-414 — both copies are in the same file, so extract the 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 `internal/engine/dirstore.go:320` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (9 lines × 2) cmd/rampart/cli/setup_codex.go:155— cmd/rampart/cli/setup_codex.go:155-163 | cmd/rampart/cli/setup_gemini.go:81-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup_codex.go:155` 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.
Repeated repair: cmd/rampart/cli/setup_codex.go cmd/rampart/cli/setup_codex.go:55— cmd/rampart/cli/setup_codex.go changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 15 (its worst body is cli.newSetupCodexCmd at line 55), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(doctor): remember setup so removed hooks fail even without verification”; “fix(codex): report hooks that cannot run as not configured”; “fix(doctor): fail when a previously protected agent loses its hooks”; “fix: preserve exact numbers in incoming tool arguments”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/setup_codex.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/plugin/openclaw/provider-surface-replay.mjs internal/plugin/openclaw/provider-surface-replay.mjs:57— internal/plugin/openclaw/provider-surface-replay.mjs changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 3 (its worst body is provider-surface-replay.runPolicyScenario at line 57), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(openclaw): a reply must also go to the originating provider”; “fix(openclaw): judge browser navigation by the URL OpenClaw will open”; “fix(openclaw): avoid misclassifying policy rejections as auth failures”; “fix(approval): bind redacted review to immutable actions”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/plugin/openclaw/provider-surface-replay.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: cmd/rampart/cli/setup_claude_failure.go cmd/rampart/cli/setup_claude_failure.go:124— cmd/rampart/cli/setup_claude_failure.go changed 4 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is cli.planClaudeHookFailure at line 124), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(setup): fail closed over a Rampart hook Claude Code never waited for”; “fix(setup): keep fail-closed when any duplicate Rampart hook blocks”; “fix(claude-code): plan fail-closed for a new PreToolUse hook even with leftover Post hooks”; “fix(claude-code): keep Rampart's hook decisive and doctor visible”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/setup_claude_failure.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/audit/reader.go internal/audit/reader.go:108— internal/audit/reader.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 14 (its worst body is audit.ReadEventsFromOffset at line 108), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(audit): report malformed records instead of skipping them silently”; “fix(audit): classify records by event id in the reader, as the verifier does”; “fix(audit): skip chain-continuation headers when reading events”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/audit/reader.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/notify/sanitize.go internal/notify/sanitize.go:63— internal/notify/sanitize.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 5 (its worst body is notify.SanitizeSuggestions at line 63), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(notify): keep token redaction unanchored”; “fix(notify): extend credential redaction patterns”; “fix: redact output copies and version Python refusal defaults”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/notify/sanitize.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/plugin/openclaw/approval-regression.mjs internal/plugin/openclaw/approval-regression.mjs:28— internal/plugin/openclaw/approval-regression.mjs changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 6 (its worst body is approval-regression.runScenario at line 28), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(openclaw): reserve approval review space for execution details”; “fix(openclaw): preserve derived policy facts with original review input”; “fix(approval): bind redacted review to immutable actions”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/plugin/openclaw/approval-regression.mjs`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/approval/review.go internal/approval/review.go:109— internal/approval/review.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 4 (its worst body is approval.cloneReviewValue at line 109), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: preserve numeric values in dashboard approval review”; “fix: preserve complete actions through external approvals”; “fix(approval): capture input once and preserve run scope identity”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/approval/review.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: internal/proxy/server.go internal/proxy/server.go:190— internal/proxy/server.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 13 (its worst body is proxy.New at line 190), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix: redact diagnostic output and audit metadata”; “fix: preserve complete actions through external approvals”; “fix: make future run approval explicit”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- internal/proxy/server.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Repeated repair: cmd/rampart/cli/serve_log.go cmd/rampart/cli/serve_log.go:139— cmd/rampart/cli/serve_log.go changed 3 times in last 90 days and 3 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 11 (its worst body is serveLog.Write at line 139), AT OR UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(cli): replace inherited diagnostic backups on Windows”; “fix(serve): preserve long Windows log paths during rotation”; “fix(serve): allow Windows background log rotation”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-08-12..2026-11-10, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-12 21:50:16 -08:00' --until='2026-11-10 21:50:16 -08:00' --full-history --no-merges -- cmd/rampart/cli/serve_log.go`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
Duplicated block (11 lines × 2) cmd/rampart/cli/approve.go:120— cmd/rampart/cli/approve.go:120-130 | cmd/rampart/cli/approve.go:170-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. 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) cmd/rampart/cli/rules.go:421— cmd/rampart/cli/rules.go:421-431 | cmd/rampart/cli/rules.go:551-561 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/rules.go:421` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) cmd/rampart/cli/setup.go:2291— cmd/rampart/cli/setup.go:2291-2301 | cmd/rampart/cli/setup_claude_failure.go:191-201 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:2291` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) internal/engine/engine.go:128— internal/engine/engine.go:128-138 | internal/engine/engine.go:608-618 — both copies are in the same file, so extract the 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) cmd/rampart/cli/report.go:292— cmd/rampart/cli/report.go:292-305 | internal/report/export.go:269-279 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Check import visibility before settling on that home: `internal/report/export.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (11 lines × 2) REDACTED:732— REDACTED:732-742 | internal/engine/download_exec.go:362-372 — 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. Check import visibility before settling on that home: `internal/engine/download_exec.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (11 lines × 2) internal/engine/persist.go:379— internal/engine/persist.go:379-389 | internal/engine/shellparse.go:1073-1083 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (11 lines × 2) cmd/rampart/cli/mcp.go:241— cmd/rampart/cli/mcp.go:241-251 | cmd/rampart/cli/wrap.go:260-270 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:241` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (11 lines × 2) internal/notify/slack.go:126— internal/notify/slack.go:126-136 | internal/notify/teams.go:101-111 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/notify/slack.go:126` 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) cmd/rampart/cli/doctor.go:1835— cmd/rampart/cli/doctor.go:1835-1842 | cmd/rampart/cli/doctor.go:1990-1997 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/doctor.go:1835` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cmd/rampart/cli/doctor.go:1843` calls `emit`, `Sprintf` and `cmd/rampart/cli/doctor.go:1998` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 2) cmd/rampart/cli/mcp.go:146— cmd/rampart/cli/mcp.go:146-153 | cmd/rampart/cli/wrap.go:134-141 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (8 lines × 2) cmd/rampart/cli/rules.go:71— cmd/rampart/cli/rules.go:71-78 | cmd/rampart/cli/rules.go:98-105 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/rules.go:71` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
Duplicated block (8 lines × 2) internal/approval/store.go:1208— internal/approval/store.go:1208-1215 | internal/approval/store.go:1281-1288 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (8 lines × 2) internal/proxy/approval_handlers.go:131— internal/proxy/approval_handlers.go:131-138 | internal/proxy/approval_handlers.go:224-231 — both copies are in the same file, so extract the 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 `internal/proxy/approval_handlers.go:131` 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) cmd/rampart/cli/httpclient.go:26— cmd/rampart/cli/httpclient.go:26-33 | internal/watch/approval_client.go:63-70 — 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. Check import visibility before settling on that home: `internal/watch/approval_client.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (8 lines × 2) cmd/rampart/cli/hook_copilot.go:61— cmd/rampart/cli/hook_copilot.go:61-69 | cmd/rampart/cli/hook_cursor.go:37-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/hook_copilot.go:61` 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) cmd/rampart/cli/mcp.go:108— cmd/rampart/cli/mcp.go:108-115 | cmd/rampart/cli/wrap.go:100-107 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (8 lines × 2) cmd/rampart/cli/audit.go:231— cmd/rampart/cli/audit.go:231-238 | cmd/rampart/cli/audit.go:396-403 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/audit.go:231` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cmd/rampart/cli/audit.go:240` calls `Flags`, `StringVar` and `cmd/rampart/cli/audit.go:405` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) cmd/rampart/cli/doctor.go:1520— cmd/rampart/cli/doctor.go:1520-1529 | REDACTED:760-769 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/doctor.go:1520` 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) cmd/rampart/cli/protect.go:289— cmd/rampart/cli/protect.go:289-298 | cmd/rampart/cli/protect.go:370-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/protect.go:289` 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) cmd/rampart/cli/setup.go:1143— cmd/rampart/cli/setup.go:1143-1152 | cmd/rampart/cli/uninstall_integrations.go:209-218 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (10 lines × 2) cmd/rampart/cli/setup_gemini.go:164— cmd/rampart/cli/setup_gemini.go:164-173 | cmd/rampart/cli/setup_gemini.go:243-252 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup_gemini.go:164` 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) cmd/rampart/cli/token.go:320— cmd/rampart/cli/token.go:320-329 | cmd/rampart/cli/token.go:345-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 `cmd/rampart/cli/token.go:320` 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) internal/mcp/proxy.go:694— internal/mcp/proxy.go:694-703 | internal/mcp/proxy.go:720-729 — both copies are in the same file, so extract the 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 `internal/mcp/proxy.go:694` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (10 lines × 2) cmd/rampart/cli/mcp.go:126— cmd/rampart/cli/mcp.go:126-139 | cmd/rampart/cli/wrap.go:118-127 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:126` 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 (10 lines × 2) cmd/rampart/cli/audit_helpers.go:332— cmd/rampart/cli/audit_helpers.go:332-342 | internal/report/compliance.go:421-430 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/audit_helpers.go:332` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/report/compliance.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
X3 · Exception handling· Discarded error (assigned to `_`, then its result used) · ×8
Discarded error (assigned to `_`, then its result used) internal/watch/approval_client.go:89— `body, _ := io.ReadAll(io.LimitReader(resp.Body, 512))` writes the call's error to `_` and then uses `body` as if the call succeeded. When `io.ReadAll` fails, `body` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `body` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/watch/approval_client.go:126— `body, _ := json.Marshal(map[string]any{ "approved": approved, "resolved_by": "watch-tui", "persist": persist, })` writes the call's error to `_` and then uses `body` as if the call succeeded. When `json.Marshal` fails, `body` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `body` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/watch/approval_client.go:148— `respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 512))` writes the call's error to `_` and then uses `respBody` as if the call succeeded. When `io.ReadAll` fails, `respBody` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `respBody` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/openclaw/sync.go:136— `data, _ := json.MarshalIndent(approvals, "", " ")` writes the call's error to `_` and then uses `data` as if the call succeeded. When `json.MarshalIndent` fails, `data` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `data` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/openclaw/hardening/hardening.go:151— `matches, _ := filepath.Glob(filepath.Join(dir, pattern))` writes the call's error to `_` and then uses `matches` as if the call succeeded. When `filepath.Glob` fails, `matches` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `matches` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/openclaw/hardening/hardening.go:163— `matches, _ := filepath.Glob(filepath.Join(dir, pattern))` writes the call's error to `_` and then uses `matches` as if the call succeeded. When `filepath.Glob` fails, `matches` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `matches` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/mcp/proxy.go:785— `responseFields, _ = decodeCanonicalJSONObject(trimmed, "jsonrpc", "id", "method", "params", "result", "error")` writes the call's error to `_` and then uses `responseFields` as if the call succeeded. When `decodeCanonicalJSONObject` fails, `responseFields` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `responseFields` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
Discarded error (assigned to `_`, then its result used) internal/engine/dirstore.go:182— `absFile, _ := filepath.Abs(s.file)` writes the call's error to `_` and then uses `absFile` as if the call succeeded. When `filepath.Abs` fails, `absFile` is its zero value (nil for a pointer, a map or an interface), so the program panics later or goes on with a default it never chose, and nothing records why. Check the error before using `absFile` (return it, wrapped with what was being done), or, if the failure genuinely cannot matter, say why in a comment on the line.
D4 · Code Duplication· Edited copy of a member (14 corresponding lines) · ×7
Edited copy of a member (14 corresponding lines) internal/engine/engine.go:503— internal/engine/engine.go:503-516 | internal/engine/engine.go:1046-1074 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) cmd/rampart/cli/inventory.go:88— cmd/rampart/cli/inventory.go:88-109 | cmd/rampart/cli/status.go:35-48 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) cmd/rampart/cli/generate.go:252— cmd/rampart/cli/generate.go:252-265 | scripts/generate-registry.go:233-246 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) internal/approval/external.go:50— internal/approval/external.go:50-63 | internal/proxy/helpers.go:72-88 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) cmd/rampart/cli/setup_codex.go:25— cmd/rampart/cli/setup_codex.go:25-39 | internal/mcp/jsonrpc.go:234-247 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) cmd/rampart/cli/wrap.go:693— cmd/rampart/cli/wrap.go:693-707 | internal/proxy/webhook.go:87-100 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (14 corresponding lines) cmd/rampart/cli/hook_antigravity.go:194— cmd/rampart/cli/hook_antigravity.go:194-207 | cmd/rampart/cli/hook_gemini.go:213-228 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (7 lines × 2) cmd/rampart/cli/audit.go:515— cmd/rampart/cli/audit.go:515-521 | internal/report/compliance.go:480-486 — 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. Check import visibility before settling on that home: `internal/report/compliance.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (7 lines × 2) cmd/rampart/cli/doctor.go:824— cmd/rampart/cli/doctor.go:824-830 | cmd/rampart/cli/doctor.go:845-851 — both copies are in the same file, so extract the 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) internal/proxy/eval_handlers.go:389— internal/proxy/eval_handlers.go:389-395 | internal/proxy/eval_handlers.go:689-695 — both copies are in the same file, so extract the 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 `internal/proxy/eval_handlers.go:389` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) REDACTED:16— REDACTED:16-22 | internal/securefile/owner_windows.go:19-25 — 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. Check import visibility before settling on that home: `internal/securefile/owner_windows.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (7 lines × 2) cmd/rampart/cli/setup.go:1815— cmd/rampart/cli/setup.go:1815-1823 | cmd/rampart/cli/setup.go:1984-1990 — both copies are in the same file, so extract the 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) cmd/rampart/cli/mcp.go:97— cmd/rampart/cli/mcp.go:97-103 | cmd/rampart/cli/preload.go:47-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:97` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 2) cmd/rampart/cli/serve_background_unix.go:40— cmd/rampart/cli/serve_background_unix.go:40-46 | cmd/rampart/cli/serve_background_unix.go:48-54 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) cmd/rampart/cli/policy_sync.go:89— cmd/rampart/cli/policy_sync.go:89-95 | cmd/rampart/cli/policy_sync.go:113-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) cmd/rampart/cli/setup_copilot.go:164— cmd/rampart/cli/setup_copilot.go:164-169 | cmd/rampart/cli/setup_copilot.go:198-203 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup_copilot.go:164` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `cmd/rampart/cli/setup_copilot.go:197` calls `currentCopilotHookCommands` and `cmd/rampart/cli/setup_copilot.go:163` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) cmd/rampart/cli/setup_openclaw_plugin.go:296— cmd/rampart/cli/setup_openclaw_plugin.go:296-301 | internal/plugin/openclaw/embed.go:79-84 — 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. Check import visibility before settling on that home: `internal/plugin/openclaw/embed.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (6 lines × 2) internal/proxy/audit_handlers.go:98— internal/proxy/audit_handlers.go:98-103 | internal/proxy/audit_handlers.go:313-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 `internal/proxy/audit_handlers.go:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/proxy/audit_handlers.go:104` calls `Error` and `internal/proxy/audit_handlers.go:319` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (6 lines × 2) cmd/rampart/cli/serve_install.go:556— cmd/rampart/cli/serve_install.go:556-561 | cmd/rampart/cli/serve_install.go:626-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (6 lines × 2) cmd/rampart/cli/token.go:113— cmd/rampart/cli/token.go:113-118 | REDACTED:1715-1720 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (6 lines × 2) internal/plugin/hermes/embed.go:228— internal/plugin/hermes/embed.go:228-233 | internal/plugin/hermes/embed.go:235-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:430— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:518— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:536— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:646— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:652— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:918— An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Swallowed exception (empty catch) internal/plugin/openclaw/index.js:946— `.catch(() => {})` handles the rejection by doing nothing — the failure is discarded with no log and no rethrow, and the chain carries on as if the work succeeded. Log it through whatever this codebase already uses to report problems, hand it to a caller that can (`next(error)`, a returned rejection), or don't catch it.
Low contrast colour pair in CSS (2.8:1) internal/dashboard/static/index.html:36— `#connect-btn` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.8:1) internal/dashboard/static/index.html:79— `.tab-badge` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.8:1) internal/dashboard/static/index.html:122— `.session-group-count` sets color: #868e96 on background-color: #e9ecef — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.8:1) internal/dashboard/static/index.html:262— `.policy-test-btn` sets color: #fff on background-color: #FF6392 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
Low contrast colour pair in CSS (2.8:1) internal/dashboard/static/index.html:287— `.run-cluster-count` sets color: #868e96 on background-color: #e9ecef — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
MethodTooLong: Server.handleToolCall internal/proxy/eval_handlers.go:44— MethodTooLong — handleToolCall runs 232 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 132 over it, 2.32× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Server.handleBulkResolve internal/proxy/approval_handlers.go:501— MethodTooLong — handleBulkResolve runs 215 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 115 over it, 2.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Engine.EvaluateWith internal/engine/engine.go:127— MethodTooLong — EvaluateWith runs 154 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 54 over it, 1.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Proxy.handleToolsCall internal/mcp/proxy.go:428— MethodTooLong — handleToolsCall runs 118 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 18 over it, 1.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
MethodTooLong: Model.Update internal/watch/watch.go:315— MethodTooLong — Update runs 116 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 16 over it, 1.16× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
Duplicated block (12 lines × 2) cmd/rampart/cli/generate.go:254— cmd/rampart/cli/generate.go:254-265 | scripts/generate-registry.go:235-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/generate.go:254` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) cmd/rampart/cli/mcp.go:195— cmd/rampart/cli/mcp.go:195-206 | cmd/rampart/cli/wrap.go:222-233 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12 lines × 2) cmd/rampart/cli/setup.go:2285— cmd/rampart/cli/setup.go:2285-2296 | cmd/rampart/cli/setup_codex.go:228-239 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:2285` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (12 lines × 2) cmd/rampart/cli/setup_codex.go:200— cmd/rampart/cli/setup_codex.go:200-211 | cmd/rampart/cli/setup_gemini.go:119-130 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (12 lines × 2) internal/proxy/eval_handlers.go:194— internal/proxy/eval_handlers.go:194-205 | internal/proxy/eval_handlers.go:362-373 — both copies are in the same file, so extract the 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 `internal/proxy/eval_handlers.go:194` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) cmd/rampart/cli/mcp.go:119— cmd/rampart/cli/mcp.go:119-123 | cmd/rampart/cli/wrap.go:111-115 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) cmd/rampart/cli/mcp.go:225— cmd/rampart/cli/mcp.go:225-229 | cmd/rampart/cli/wrap.go:251-255 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (5 lines × 2) cmd/rampart/cli/init.go:283— cmd/rampart/cli/init.go:283-287 | cmd/rampart/cli/init.go:289-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/init.go:283` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (5 lines × 2) cmd/rampart/cli/setup_antigravity.go:226— cmd/rampart/cli/setup_antigravity.go:226-230 | cmd/rampart/cli/setup_antigravity.go:239-243 — both copies are in the same file, so extract the 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 (5 lines × 2) cmd/rampart/cli/audit.go:269— cmd/rampart/cli/audit.go:269-273 | cmd/rampart/cli/audit.go:360-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/audit.go:269` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
R4 · Test Coverage· No test reaches this file · ×5
No test reaches this file internal/plugin/openclaw/provider-surface-replay.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file internal/plugin/openclaw/approval-regression.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file internal/plugin/openclaw/degraded-mode-test.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file internal/plugin/openclaw/tool-alias-test.mjs:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
No test reaches this file docs-site/assets/search-input.js:1— No test imports this module directly or transitively. Import reachability cannot see a test that executes a file by path instead of importing it, nor one that drives it through a running browser by navigating to a URL — if neither does, no test reaches this one.
D4 · Code Duplication· Edited copy of a member (21 corresponding lines) · ×4
Edited copy of a member (21 corresponding lines) internal/watch/format.go:148— internal/watch/format.go:148-168 | internal/watch/format.go:171-192 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) cmd/rampart/cli/rules.go:62— cmd/rampart/cli/rules.go:62-86 | cmd/rampart/cli/rules.go:89-109 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) cmd/rampart/cli/audit.go:504— cmd/rampart/cli/audit.go:504-524 | cmd/rampart/cli/audit_helpers.go:383-409 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (21 corresponding lines) internal/detect/detect.go:321— internal/detect/detect.go:321-341 | internal/detect/detect.go:344-364 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×4
Edited copy of a member (15 corresponding lines) internal/policy/custom.go:71— internal/policy/custom.go:71-88 | internal/policy/user_overrides.go:55-69 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) cmd/rampart/cli/policy_sync.go:392— cmd/rampart/cli/policy_sync.go:392-407 | cmd/rampart/cli/serve_install.go:290-304 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) REDACTED:241— REDACTED:241-255 | REDACTED:257-276 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (15 corresponding lines) cmd/rampart/cli/doctor.go:1284— cmd/rampart/cli/doctor.go:1284-1298 | internal/openclaw/hardening/hardening.go:160-176 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (14 lines × 2) cmd/rampart/cli/serve_install.go:518— cmd/rampart/cli/serve_install.go:518-531 | cmd/rampart/cli/serve_install.go:595-608 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/serve_install.go:518` 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) cmd/rampart/cli/setup.go:2242— cmd/rampart/cli/setup.go:2242-2255 | cmd/rampart/cli/setup_codex.go:429-442 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:2242` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 2) cmd/rampart/cli/hook.go:1114— cmd/rampart/cli/hook.go:1114-1127 | cmd/rampart/cli/hook_copilot.go:84-97 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/hook.go:1114` 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) cmd/rampart/cli/rules.go:145— cmd/rampart/cli/rules.go:145-158 | cmd/rampart/cli/rules.go:166-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/rules.go:145` 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) cmd/rampart/cli/audit_helpers.go:397— cmd/rampart/cli/audit_helpers.go:397-409 | internal/report/compliance.go:457-469 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/audit_helpers.go:397` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `internal/report/compliance.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (13 lines × 2) cmd/rampart/cli/setup_hermes_remove.go:81— cmd/rampart/cli/setup_hermes_remove.go:81-93 | cmd/rampart/cli/setup_hermes_remove.go:105-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup_hermes_remove.go:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) internal/approval/store.go:1608— internal/approval/store.go:1608-1620 | internal/session/manager.go:487-499 — 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (13 lines × 2) internal/proxy/eval_handlers.go:45— internal/proxy/eval_handlers.go:45-57 | internal/proxy/eval_handlers.go:589-601 — both copies are in the same file, so extract the 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 × 3) internal/engine/shellparse.go:657— internal/engine/shellparse.go:657-663 | internal/engine/shellparse.go:666-672 | internal/engine/shellparse.go:675-681 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 3) internal/proxy/approval_handlers.go:260— internal/proxy/approval_handlers.go:260-266 | internal/proxy/approval_handlers.go:291-297 | internal/proxy/server.go:233-239 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `internal/proxy/approval_handlers.go:260` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) internal/policy/custom.go:139— internal/policy/custom.go:139-146 | internal/policy/user_overrides.go:89-95 | internal/session/manager.go:172-178 — 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 `internal/policy/custom.go:139` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (7 lines × 3) cmd/rampart/cli/setup.go:310— cmd/rampart/cli/setup.go:310-316 | cmd/rampart/cli/setup_codex.go:149-155 | cmd/rampart/cli/setup_gemini.go:75-81 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:310` 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.
X2 · Cancellation propagation· Function without context.Context · ×4
Function without context.Context: checkServeReachable internal/watch/watch.go:221— `checkServeReachable` calls `http.NewRequestWithContext(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: doctorTokenAuth cmd/rampart/cli/doctor.go:823— `doctorTokenAuth` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: doctorPoliciesAPI cmd/rampart/cli/doctor.go:844— `doctorPoliciesAPI` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
Function without context.Context: doctorPending cmd/rampart/cli/doctor.go:874— `doctorPending` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
ClassTooLong: Store internal/approval/store.go:253— ClassTooLong — 827 significant lines (blank, comment-only and punctuation-only lines excluded), 48 methods, 44 blocks, lines 253-2043. The bar is 400 significant lines; this is 427 over it, 2.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Engine internal/engine/engine.go:40— ClassTooLong — 606 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods, 35 blocks, lines 40-1305. The bar is 400 significant lines; this is 206 over it, 1.52× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
ClassTooLong: Proxy internal/mcp/proxy.go:126— ClassTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods, 25 blocks, lines 126-1143. The bar is 400 significant lines; this is 127 over it, 1.32× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Server internal/proxy/server.go:42— TooManyMethods — 53 methods, declared across 10 files: proxy/eval_handlers.go (15), proxy/server.go (10), proxy/approval_handlers.go (8), proxy/audit_handlers.go (5), +6 more file(s). The bar is 30 methods; this is 23 over it, 1.77× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Store internal/approval/store.go:253— TooManyMethods — 48 methods, declared across 2 files: approval/store.go (43), approval/identity.go (5). The bar is 30 methods; this is 18 over it, 1.60× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: Engine internal/engine/engine.go:40— TooManyMethods — 36 methods, declared across 3 files: engine/engine.go (34), engine/ratelimit.go (1), engine/ratelimit_persistent.go (1). The bar is 30 methods; this is 6 over it, 1.20× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication· Edited copy of a member (16 corresponding lines) · ×3
Edited copy of a member (16 corresponding lines) internal/plugin/hermes/embed.go:109— internal/plugin/hermes/embed.go:109-124 | internal/plugin/openclaw/embed.go:57-72 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) internal/mcp/proxy.go:693— internal/mcp/proxy.go:693-708 | internal/mcp/proxy.go:719-734 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (16 corresponding lines) cmd/rampart/cli/setup_codex.go:477— cmd/rampart/cli/setup_codex.go:477-492 | cmd/rampart/cli/setup_copilot.go:245-260 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (18 corresponding lines) · ×3
Edited copy of a member (18 corresponding lines) cmd/rampart/cli/setup_openclaw_plugin.go:290— cmd/rampart/cli/setup_openclaw_plugin.go:290-307 | internal/plugin/openclaw/embed.go:77-94 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) internal/mcp/proxy.go:279— internal/mcp/proxy.go:279-296 | internal/mcp/proxy.go:298-315 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (18 corresponding lines) internal/engine/decision.go:348— internal/engine/decision.go:348-367 | internal/engine/policy.go:248-265 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (13 corresponding lines) · ×3
Edited copy of a member (13 corresponding lines) cmd/rampart/cli/hook_codex.go:324— cmd/rampart/cli/hook_codex.go:324-336 | cmd/rampart/cli/hook_copilot.go:126-138 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) cmd/rampart/cli/setup_codex.go:41— cmd/rampart/cli/setup_codex.go:41-53 | internal/tlsutil/tlsutil.go:211-223 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (13 corresponding lines) REDACTED:15— REDACTED:15-27 | internal/securefile/owner_windows.go:18-30 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (27 corresponding lines) · ×2
Edited copy of a member (27 corresponding lines) internal/engine/decision.go:239— internal/engine/decision.go:239-265 | internal/proxy/helpers.go:245-277 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (27 corresponding lines) cmd/rampart/cli/allow.go:78— cmd/rampart/cli/allow.go:78-104 | cmd/rampart/cli/block.go:20-46 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (22 corresponding lines) · ×2
Edited copy of a member (22 corresponding lines) cmd/rampart/cli/setup_copilot.go:155— cmd/rampart/cli/setup_copilot.go:155-180 | cmd/rampart/cli/setup_copilot.go:188-209 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (22 corresponding lines) internal/detect/detect.go:172— internal/detect/detect.go:172-201 | internal/detect/detect.go:205-226 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×2
Edited copy of a member (19 corresponding lines) cmd/rampart/cli/setup_antigravity.go:303— cmd/rampart/cli/setup_antigravity.go:303-321 | cmd/rampart/cli/uninstall.go:457-476 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (19 corresponding lines) internal/report/compliance.go:448— internal/report/compliance.go:448-469 | internal/report/compliance.go:471-489 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (20 corresponding lines) · ×2
Edited copy of a member (20 corresponding lines) cmd/rampart/cli/hook.go:1266— cmd/rampart/cli/hook.go:1266-1285 | internal/audit/redact.go:93-116 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (20 corresponding lines) internal/report/html.go:375— internal/report/html.go:375-394 | internal/report/html.go:397-416 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (17 corresponding lines) · ×2
Edited copy of a member (17 corresponding lines) cmd/rampart/cli/watch.go:147— cmd/rampart/cli/watch.go:147-164 | internal/report/compliance.go:568-584 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (17 corresponding lines) cmd/rampart/cli/policy.go:322— cmd/rampart/cli/policy.go:322-338 | internal/engine/engine.go:1016-1032 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×2
Edited copy of a member (8 corresponding lines) internal/filetxn/lock_windows.go:16— internal/filetxn/lock_windows.go:16-23 | internal/filetxn/lock_windows.go:25-36 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (8 corresponding lines) internal/audit/event.go:232— internal/audit/event.go:232-239 | internal/engine/shellparse.go:945-955 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 10+ corresponding lines) · ×2
Edited copies of one member (3 members, 10+ corresponding lines) cmd/rampart/cli/rules.go:639— cmd/rampart/cli/rules.go:639-648 | cmd/rampart/cli/token.go:111-120 | REDACTED:1713-1725 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 10+ corresponding lines) internal/approval/review.go:98— internal/approval/review.go:98-107 | internal/audit/redact.go:78-91 | internal/mcp/proxy.go:1158-1167 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (11 corresponding lines) · ×2
Edited copy of a member (11 corresponding lines) cmd/rampart/cli/report.go:307— cmd/rampart/cli/report.go:307-317 | cmd/rampart/cli/report.go:319-330 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Edited copy of a member (11 corresponding lines) cmd/rampart/cli/spinner.go:69— cmd/rampart/cli/spinner.go:69-80 | cmd/rampart/cli/spinner.go:83-93 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 11+ corresponding lines) · ×2
Edited copies of one member (3 members, 11+ corresponding lines) cmd/rampart/cli/setup_codex.go:465— cmd/rampart/cli/setup_codex.go:465-475 | cmd/rampart/cli/setup_cursor.go:259-269 | cmd/rampart/cli/setup_gemini.go:260-270 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 11+ corresponding lines) cmd/rampart/cli/setup_hermes_remove.go:20— cmd/rampart/cli/setup_hermes_remove.go:20-30 | cmd/rampart/cli/setup_hermes_remove.go:32-44 | internal/engine/lint.go:505-515 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 7+ corresponding lines) · ×2
Edited copies of one member (3 members, 7+ corresponding lines) cmd/rampart/cli/token.go:103— cmd/rampart/cli/token.go:103-109 | internal/dashboard/handler.go:97-104 | internal/report/html.go:458-464 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Edited copies of one member (3 members, 7+ corresponding lines) cmd/rampart/cli/inventory.go:194— cmd/rampart/cli/inventory.go:194-200 | cmd/rampart/cli/serve_install.go:172-178 | cmd/rampart/cli/user_config.go:28-34 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
Duplicated block (19 lines × 2) cmd/rampart/cli/setup.go:2259— cmd/rampart/cli/setup.go:2259-2277 | cmd/rampart/cli/setup_codex.go:445-463 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:2259` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (19 lines × 2) internal/engine/matcher.go:796— internal/engine/matcher.go:796-814 | internal/engine/matcher.go:1019-1037 — both copies are in the same file, so extract the 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 `internal/engine/matcher.go:796` 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 (15 lines × 2) internal/proxy/eval_handlers.go:77— internal/proxy/eval_handlers.go:77-91 | internal/proxy/eval_handlers.go:623-637 — both copies are in the same file, so extract the 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 `internal/proxy/eval_handlers.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 (15 lines × 2) internal/report/html.go:380— internal/report/html.go:380-394 | internal/report/html.go:402-416 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/report/html.go:380` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 3) cmd/rampart/cli/hook_antigravity.go:150— cmd/rampart/cli/hook_antigravity.go:150-159 | cmd/rampart/cli/hook_copilot.go:238-247 | cmd/rampart/cli/hook_gemini.go:135-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/hook_antigravity.go:150` 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 × 3) cmd/rampart/cli/mcp.go:303— cmd/rampart/cli/mcp.go:303-312 | cmd/rampart/cli/test_cmd.go:349-358 | cmd/rampart/cli/wrap.go:288-297 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:303` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `cmd/rampart/cli/wrap.go:299` calls `embeddedStandardPolicyFile` and `cmd/rampart/cli/mcp.go:314` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (8 lines × 3) cmd/rampart/cli/hook.go:899— cmd/rampart/cli/hook.go:899-906 | cmd/rampart/cli/hook.go:963-970 | cmd/rampart/cli/hook.go:1005-1012 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (8 lines × 3) cmd/rampart/cli/setup.go:2290— cmd/rampart/cli/setup.go:2290-2297 | cmd/rampart/cli/setup_claude_failure.go:190-197 | cmd/rampart/cli/setup_codex.go:233-240 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/setup.go:2290` 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 × 3) cmd/rampart/cli/mcp.go:320— cmd/rampart/cli/mcp.go:320-325 | cmd/rampart/cli/test_cmd.go:375-380 | cmd/rampart/cli/wrap.go:313-318 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:320` 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 × 3) cmd/rampart/cli/mcp.go:329— cmd/rampart/cli/mcp.go:329-334 | cmd/rampart/cli/test_cmd.go:384-389 | cmd/rampart/cli/wrap.go:322-327 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/mcp.go:329` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
AC3 · Page structure· Page without a main landmark · ×1
Page without a main landmark internal/dashboard/static/index.html:2— No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC6 · Visual & motion safety· Animation without a prefers-reduced-motion guard · ×1
Animation without a prefers-reduced-motion guard internal/dashboard/static/index.html:251— `.policy-reload-btn.spinning svg` moves (`animation: spin .6s linear infinite`) and nothing reads prefers-reduced-motion for it — no @media (prefers-reduced-motion) rule for this element, no reset this project loads — so a motion-sensitive user cannot turn it off (WCAG 2.3.3). Declare it under @media (prefers-reduced-motion: no-preference), or neutralise it under reduce.
Low contrast colour pair in CSS (3.8:1) internal/dashboard/static/index.html:51— `#error-banner button` sets color: #fff on background-color: #ef4444 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
cli.newServeCmd (cyclomatic 145) REDACTED:95— cli.newServeCmd has cyclomatic complexity 145 (threshold 15). Most of this is not in the body itself: 6 of the 145 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 137, 131). 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.
cli.newHookCmd (cyclomatic 126) cmd/rampart/cli/hook.go:363— cli.newHookCmd has cyclomatic complexity 126 (threshold 15). Most of this is not in the body itself: 1 of the 126 points is its own statement and the rest belongs to one function literal inside it that branches (line 403). 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.
cli.newUpgradeCmdWithDeps (cyclomatic 109) REDACTED:130— cli.newUpgradeCmdWithDeps has cyclomatic complexity 109 (threshold 15). Of this number, 30 points are the body's own statements and 79 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.
engine.visitPipedDownloadExecutionAliases (cyclomatic 86) internal/engine/pipe_download_exec.go:307— engine.visitPipedDownloadExecutionAliases has cyclomatic complexity 86 (threshold 15). Most of this is not in the body itself: 3 of the 86 points are its own statements and the rest belongs to one function literal inside it that branches (line 315). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Server.handleToolCall (cyclomatic 66) internal/proxy/eval_handlers.go:44— Server.handleToolCall has cyclomatic complexity 66 (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.
engine.pathChangeTargets (cyclomatic 64) internal/engine/matcher.go:1286— engine.pathChangeTargets has cyclomatic complexity 64 (threshold 15). Of this number, 38 points are the body's own statements and 26 belong to 2 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.
engine.matchConditionForAction (cyclomatic 62) internal/engine/matcher.go:2669— engine.matchConditionForAction has cyclomatic complexity 62 (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.
cli.newSetupOpenClawCmd (cyclomatic 61) cmd/rampart/cli/setup.go:587— cli.newSetupOpenClawCmd has cyclomatic complexity 61 (threshold 15). Most of this is not in the body itself: 1 of the 61 points is its own statement and the rest belongs to one function literal inside it that branches (line 615). 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.
Model.Update (cyclomatic 61) internal/watch/watch.go:315— Model.Update has cyclomatic complexity 61 (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.
engine.visitCanonicalCommandAliases (cyclomatic 60) internal/engine/matcher.go:1601— engine.visitCanonicalCommandAliases has cyclomatic complexity 60 (threshold 15). Of this number, 53 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.newInitCmd (cyclomatic 59) cmd/rampart/cli/init.go:84— cli.newInitCmd has cyclomatic complexity 59 (threshold 15). Most of this is not in the body itself: 1 of the 59 points is its own statement and the rest belongs to one function literal inside it that branches (line 94). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Server.handleBulkResolve (cyclomatic 59) internal/proxy/approval_handlers.go:501— Server.handleBulkResolve has cyclomatic complexity 59 (threshold 15). Of this number, 49 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.isExtremelyDangerous (cyclomatic 58) internal/engine/suggestions.go:27— engine.isExtremelyDangerous has cyclomatic complexity 58 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.runDoctor (cyclomatic 57) cmd/rampart/cli/doctor.go:159— cli.runDoctor has cyclomatic complexity 57 (threshold 15). Of this number, 46 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Manifest.Validate (cyclomatic 57) internal/assurance/manifest.go:75— Manifest.Validate has cyclomatic complexity 57 (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.
audit.recoverChainStateByLinks (cyclomatic 52) internal/audit/recovery_links.go:35— audit.recoverChainStateByLinks has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.invocationDownloads (cyclomatic 51) internal/engine/download_exec.go:610— engine.invocationDownloads has cyclomatic complexity 51 (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.
engine.visitDownloadExecutionAliases (cyclomatic 50) internal/engine/download_exec.go:467— engine.visitDownloadExecutionAliases has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 3 of the 50 points are its own statements and the rest belongs to one function literal inside it that branches (line 473). 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.
Proxy.handleToolsCall (cyclomatic 48) internal/mcp/proxy.go:428— Proxy.handleToolsCall has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.runAllowBlock (cyclomatic 46) cmd/rampart/cli/allow.go:119— cli.runAllowBlock has cyclomatic complexity 46 (threshold 15). Of this number, 42 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.literalShellWords (cyclomatic 46) internal/engine/download_exec.go:32— engine.literalShellWords has cyclomatic complexity 46 (threshold 15). Of this number, 45 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.runInteractiveSetup (cyclomatic 45) cmd/rampart/cli/setup_interactive.go:100— cli.runInteractiveSetup has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Engine.EvaluateWith (cyclomatic 45) internal/engine/engine.go:127— Engine.EvaluateWith has cyclomatic complexity 45 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.visitProductionCommandAliases (cyclomatic 44) internal/engine/production_commands.go:22— engine.visitProductionCommandAliases has cyclomatic complexity 44 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
engine.stripPOSIXEnvUtilityMode (cyclomatic 44) internal/engine/shellparse.go:617— engine.stripPOSIXEnvUtilityMode has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.html.appendHistRow (cyclomatic 44) internal/dashboard/static/index.html:1434— index.html.appendHistRow has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.parseClineInput (cyclomatic 42) cmd/rampart/cli/hook.go:1288— cli.parseClineInput has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.executedFileOperand (cyclomatic 40) internal/engine/download_exec.go:753— engine.executedFileOperand has cyclomatic complexity 40 (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.
cli.upgradeStandardPoliciesForVersion (cyclomatic 39) REDACTED:1849— cli.upgradeStandardPoliciesForVersion has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.newWrapCmd (cyclomatic 39) cmd/rampart/cli/wrap.go:57— cli.newWrapCmd has cyclomatic complexity 39 (threshold 15). Most of this is not in the body itself: 6 of the 39 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 93, 87). 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.
engine.ExplainConditionForAction (cyclomatic 39) internal/engine/matcher.go:2289— engine.ExplainConditionForAction has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
checkWithRampart (cyclomatic 39) internal/plugin/openclaw/index.js:595— checkWithRampart has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.normalizeClineParams (cyclomatic 37) cmd/rampart/cli/hook.go:1446— cli.normalizeClineParams has cyclomatic complexity 37 (threshold 15). Of this number, 34 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.
cli.newSetupClaudeCodeCmd (cyclomatic 36) cmd/rampart/cli/setup.go:264— cli.newSetupClaudeCodeCmd has cyclomatic complexity 36 (threshold 15). Most of this is not in the body itself: 1 of the 36 points is its own statement and the rest belongs to one function literal inside it that branches (line 290). 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.
cli.installAntigravityPluginWithRename (cyclomatic 36) cmd/rampart/cli/setup_antigravity.go:80— cli.installAntigravityPluginWithRename has cyclomatic complexity 36 (threshold 15). Of this number, 24 points are the body's own statements and 12 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.printBenchSummary (cyclomatic 35) cmd/rampart/cli/bench.go:391— cli.printBenchSummary has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.newPolicyExplainCmd (cyclomatic 35) cmd/rampart/cli/policy.go:92— cli.newPolicyExplainCmd has cyclomatic complexity 35 (threshold 15). Most of this is not in the body itself: 1 of the 35 points is its own statement and the rest belongs to one function literal inside it that branches (line 101). 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.
hermes._effective_terminal_cwd (cyclomatic 35) internal/plugin/hermes/__init__.py:1038— hermes._effective_terminal_cwd has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
register::evaluateToolCall (cyclomatic 35) internal/plugin/openclaw/index.js:737— register::evaluateToolCall has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Proxy.handleChildLine (cyclomatic 34) internal/mcp/proxy.go:760— Proxy.handleChildLine has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.handleResolveApproval (cyclomatic 33) internal/proxy/approval_handlers.go:313— Server.handleResolveApproval has cyclomatic complexity 33 (threshold 15). Of this number, 31 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.setOpenClawExecAskAt (cyclomatic 32) cmd/rampart/cli/setup_openclaw_plugin.go:1260— cli.setOpenClawExecAskAt has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.removeOpenClawNativePluginWithHostAt (cyclomatic 32) cmd/rampart/cli/setup_openclaw_plugin.go:1814— cli.removeOpenClawNativePluginWithHostAt has cyclomatic complexity 32 (threshold 15). Of this number, 31 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.
engine.splitHereDocuments (cyclomatic 32) internal/engine/download_exec.go:149— engine.splitHereDocuments has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
audit.compactRecord (cyclomatic 31) internal/audit/record.go:77— audit.compactRecord has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hermes.extractWithRename (cyclomatic 31) internal/plugin/hermes/embed.go:135— hermes.extractWithRename has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Server.handlePreflight (cyclomatic 31) internal/proxy/eval_handlers.go:588— Server.handlePreflight has cyclomatic complexity 31 (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.
cli.removeOpenClaw (cyclomatic 30) cmd/rampart/cli/setup.go:1126— cli.removeOpenClaw has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.inPlaceEditTargets (cyclomatic 30) internal/engine/matcher.go:1465— engine.inPlaceEditTargets has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.splitCompoundCommandForOS (cyclomatic 30) internal/engine/shellparse.go:260— engine.splitCompoundCommandForOS has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.stripPOSIXTimeout (cyclomatic 30) internal/engine/shellparse.go:804— engine.stripPOSIXTimeout has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
report.GenerateExport (cyclomatic 30) internal/report/export.go:71— report.GenerateExport has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.AutoApproveRunBeforePublishForRunScopeSnapshot (cyclomatic 29) internal/approval/store.go:1133— Store.AutoApproveRunBeforePublishForRunScopeSnapshot has cyclomatic complexity 29 (threshold 15). Of this number, 28 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.
JSONLSink.validateSharedStateLocked (cyclomatic 29) internal/audit/state.go:129— JSONLSink.validateSharedStateLocked has cyclomatic complexity 29 (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.
Server.handleAuditEvents (cyclomatic 29) internal/proxy/audit_handlers.go:41— Server.handleAuditEvents has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
hermes._hermes_supports_native_approval (cyclomatic 29) internal/plugin/hermes/__init__.py:792— hermes._hermes_supports_native_approval has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
hermes.evaluate_pre_tool_call (cyclomatic 29) internal/plugin/hermes/__init__.py:1308— hermes.evaluate_pre_tool_call has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.outputHookResultWithResponse (cyclomatic 28) cmd/rampart/cli/hook.go:1899— cli.outputHookResultWithResponse has cyclomatic complexity 28 (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.
cli.newMCPProxyCmd (cyclomatic 28) cmd/rampart/cli/mcp.go:77— cli.newMCPProxyCmd has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 103, 97). 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.
detect.Environment (cyclomatic 28) internal/detect/detect.go:53— detect.Environment has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
index.html.renderPending (cyclomatic 28) internal/dashboard/static/index.html:899— index.html.renderPending has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 belong to 4 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.resolveBeforePublishLocked (cyclomatic 27) internal/approval/store.go:660— Store.resolveBeforePublishLocked has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
MultiStore.Load (cyclomatic 27) internal/engine/dirstore.go:148— MultiStore.Load has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
nativeApprovalDescription (cyclomatic 27) internal/plugin/openclaw/index.js:44— nativeApprovalDescription has cyclomatic complexity 27 (threshold 15). Of this number, 24 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.removeClineHooksFromDir (cyclomatic 26) cmd/rampart/cli/cline.go:453— cli.removeClineHooksFromDir 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.
cli.runConvert (cyclomatic 26) REDACTED:78— cli.runConvert 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.
cli.detectPackageRegistryURL (cyclomatic 26) cmd/rampart/cli/hook_approval.go:311— cli.detectPackageRegistryURL 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.
audit.eventKeysCanonical (cyclomatic 26) internal/audit/event.go:148— audit.eventKeysCanonical 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.
audit.NewWitness (cyclomatic 26) internal/audit/witness.go:121— audit.NewWitness has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
engine.stripPOSIXTransparentExecutorOnce (cyclomatic 26) internal/engine/shellparse.go:489— engine.stripPOSIXTransparentExecutorOnce 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.
MixedStore.Load (cyclomatic 26) internal/engine/dirstore.go:270— MixedStore.Load 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.
cli.installClineHooksWithRename (cyclomatic 25) cmd/rampart/cli/cline.go:285— cli.installClineHooksWithRename has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.doctorHermesIntegration (cyclomatic 25) cmd/rampart/cli/doctor.go:2107— cli.doctorHermesIntegration has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.normalizeGeminiParams (cyclomatic 25) cmd/rampart/cli/hook_gemini.go:102— cli.normalizeGeminiParams has cyclomatic complexity 25 (threshold 15). Of this number, 22 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.BeginRunScopeSnapshot (cyclomatic 25) internal/approval/store.go:910— Store.BeginRunScopeSnapshot has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
proxy.prepareToolRequest (cyclomatic 25) internal/proxy/helpers.go:152— proxy.prepareToolRequest has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.integrationEnvironmentFingerprintAt (cyclomatic 24) cmd/rampart/cli/assurance_status.go:387— cli.integrationEnvironmentFingerprintAt 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.
cli.normalizeV2Cases (cyclomatic 24) cmd/rampart/cli/bench.go:531— cli.normalizeV2Cases 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.
cli.doctorFileToolPatches (cyclomatic 24) cmd/rampart/cli/doctor.go:1120— cli.doctorFileToolPatches 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.
cli.validateClaudePreToolParams (cyclomatic 24) cmd/rampart/cli/hook.go:1138— cli.validateClaudePreToolParams has cyclomatic complexity 24 (threshold 15). Of this number, 21 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.
cli.collectClineCommands (cyclomatic 24) cmd/rampart/cli/hook.go:1548— cli.collectClineCommands has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to one function literal inside it that branches (line 1565). 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.
audit.NewJSONLSink (cyclomatic 24) internal/audit/jsonl.go:251— audit.NewJSONLSink has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.restoreOpenClawExecAskFromReceipt (cyclomatic 23) cmd/rampart/cli/setup_openclaw_plugin.go:1380— cli.restoreOpenClawExecAskFromReceipt has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.newVerifyCmd (cyclomatic 23) cmd/rampart/cli/verify.go:119— cli.newVerifyCmd has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 1 of the 23 points is its own statement and the rest belongs to one function literal inside it that branches (line 137). 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.
Witness.validatePage (cyclomatic 23) internal/audit/witness_pages.go:49— Witness.validatePage has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
engine.stripShellWrapperOnceForOS (cyclomatic 23) internal/engine/shellparse.go:1085— engine.stripShellWrapperOnceForOS 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.
cli.newAuditVerifyCmd (cyclomatic 22) cmd/rampart/cli/audit.go:136— cli.newAuditVerifyCmd has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 156). 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.
cli.parseCopilotInput (cyclomatic 22) cmd/rampart/cli/hook_copilot.go:52— cli.parseCopilotInput has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: cli.mapCopilotTool (cyclomatic 29) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
cli.patchOpenClawToolsIn (cyclomatic 22) cmd/rampart/cli/setup.go:1523— cli.patchOpenClawToolsIn has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.patchOpenClawDistToolsIn (cyclomatic 22) cmd/rampart/cli/setup.go:1716— cli.patchOpenClawDistToolsIn has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Store.readLatestRecordsLocked (cyclomatic 22) internal/approval/store.go:1755— Store.readLatestRecordsLocked has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
audit.recoverChainStateInFileOrder (cyclomatic 22) internal/audit/jsonl.go:84— audit.recoverChainStateInFileOrder has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.launcherPayloads (cyclomatic 22) internal/engine/matcher.go:1071— engine.launcherPayloads has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
engine.scanCLIOptions (cyclomatic 22) internal/engine/production_commands.go:122— engine.scanCLIOptions has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.stripPOSIXStdbuf (cyclomatic 22) internal/engine/shellparse.go:886— engine.stripPOSIXStdbuf has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
fileTailer.start (cyclomatic 22) REDACTED:51— fileTailer.start has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to one function literal inside it that branches (line 54). 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.
hermes.normalize_tool_call (cyclomatic 22) internal/plugin/hermes/__init__.py:506— hermes.normalize_tool_call has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.runBench (cyclomatic 21) cmd/rampart/cli/bench.go:229— cli.runBench has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.newPolicyListCmd (cyclomatic 21) cmd/rampart/cli/policy_registry.go:123— cli.newPolicyListCmd has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to one function literal inside it that branches (line 131). 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.
cli.removeHermesIntegration (cyclomatic 21) cmd/rampart/cli/setup_hermes_remove.go:143— cli.removeHermesIntegration has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.ensureOpenClawApprovalHardening (cyclomatic 21) cmd/rampart/cli/setup_openclaw_plugin.go:180— cli.ensureOpenClawApprovalHardening has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.cleanOpenClawConfig (cyclomatic 21) cmd/rampart/cli/setup_openclaw_plugin.go:1471— cli.cleanOpenClawConfig has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.runUninstall (cyclomatic 21) cmd/rampart/cli/uninstall.go:47— cli.runUninstall has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
engine.stripPOSIXTime (cyclomatic 21) internal/engine/shellparse.go:566— engine.stripPOSIXTime has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
Proxy.handleClientLineWithContext (cyclomatic 21) internal/mcp/proxy.go:354— Proxy.handleClientLineWithContext has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
policy.IsPathPattern (cyclomatic 21) internal/policy/custom.go:316— policy.IsPathPattern has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
Manager.Cleanup (cyclomatic 21) internal/session/manager.go:390— Manager.Cleanup has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.collectIntegrationAssuranceStatuses (cyclomatic 20) cmd/rampart/cli/assurance_status.go:530— cli.collectIntegrationAssuranceStatuses 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.
cli.doctorPolicies (cyclomatic 20) cmd/rampart/cli/doctor.go:591— cli.doctorPolicies 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.
cli.doctorOpenClawAskMode (cyclomatic 20) cmd/rampart/cli/doctor.go:2008— cli.doctorOpenClawAskMode 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.
cli.parseCodexInput (cyclomatic 20) cmd/rampart/cli/hook_codex.go:41— cli.parseCodexInput has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.installLinux (cyclomatic 20) cmd/rampart/cli/serve_install.go:583— cli.installLinux has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.ensureRampartDirAccessible (cyclomatic 20) cmd/rampart/cli/token_unix.go:26— cli.ensureRampartDirAccessible has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Store.createLocked (cyclomatic 20) internal/approval/store.go:513— Store.createLocked has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
engine.restrictiveCommandAliases (cyclomatic 20) internal/engine/matcher.go:923— engine.restrictiveCommandAliases has cyclomatic complexity 20 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.tokenize (cyclomatic 20) internal/engine/shellparse.go:1344— engine.tokenize 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.
mcp.validateJSONStringEncoding (cyclomatic 20) internal/mcp/jsonrpc.go:131— mcp.validateJSONStringEncoding 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.
signing.LoadOrCreateKey (cyclomatic 20) internal/signing/signer.go:76— signing.LoadOrCreateKey has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 86). 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.
Model.View (cyclomatic 20) internal/watch/watch.go:509— Model.View 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.
cli.validateVerificationReceipt (cyclomatic 19) cmd/rampart/cli/assurance_status.go:331— cli.validateVerificationReceipt has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.collectClinePaths (cyclomatic 19) cmd/rampart/cli/hook.go:1628— cli.collectClinePaths has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1649, 1631). 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.
cli.installDarwin (cyclomatic 19) cmd/rampart/cli/serve_install.go:506— cli.installDarwin has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.antigravityPluginManaged (cyclomatic 19) cmd/rampart/cli/setup_antigravity.go:212— cli.antigravityPluginManaged has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.runSetupOpenClawMigrateWith (cyclomatic 19) cmd/rampart/cli/setup_openclaw_plugin.go:595— cli.runSetupOpenClawMigrateWith 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.
cli.verifyRestartedServeState (cyclomatic 19) REDACTED:1181— cli.verifyRestartedServeState has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
engine.classifyPipelineStage (cyclomatic 19) internal/engine/pipe_download_exec.go:160— engine.classifyPipelineStage 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.
engine.stripPOSIXNice (cyclomatic 19) internal/engine/shellparse.go:762— engine.stripPOSIXNice has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
pipelineStage.executesTaintedInput (cyclomatic 19) internal/engine/pipe_download_exec.go:118— pipelineStage.executesTaintedInput 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.
Server.handleResolveHostedApproval (cyclomatic 19) internal/proxy/approval_handlers.go:803— Server.handleResolveHostedApproval has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
index.html.bulkResolveRun (cyclomatic 19) internal/dashboard/static/index.html:1010— index.html.bulkResolveRun 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.
index.html.runPolicyTest (cyclomatic 19) internal/dashboard/static/index.html:1516— index.html.runPolicyTest has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.runDoctorFix (cyclomatic 18) cmd/rampart/cli/doctor.go:108— cli.runDoctorFix 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.
cli.doctorPreload (cyclomatic 18) cmd/rampart/cli/doctor.go:1047— cli.doctorPreload 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.
cli.parseClaudeCodeInput (cyclomatic 18) cmd/rampart/cli/hook.go:1057— cli.parseClaudeCodeInput 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.
cli.fetchRampartHealth (cyclomatic 18) cmd/rampart/cli/httpclient.go:104— cli.fetchRampartHealth 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.
cli.newPolicySearchCmd (cyclomatic 18) cmd/rampart/cli/policy_registry.go:236— cli.newPolicySearchCmd 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 245). 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.
cli.loadOpenClawToolsConfigDocument (cyclomatic 18) cmd/rampart/cli/setup_openclaw_plugin.go:1066— cli.loadOpenClawToolsConfigDocument 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.
cli.removeManagedServeServices (cyclomatic 18) cmd/rampart/cli/uninstall.go:215— cli.removeManagedServeServices 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.
cli.validateLocalServeStateURL (cyclomatic 18) REDACTED:1275— cli.validateLocalServeStateURL has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
approval.readIdentityKey (cyclomatic 18) internal/approval/identity.go:59— approval.readIdentityKey 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.
Witness.Publish (cyclomatic 18) internal/audit/witness.go:262— Witness.Publish has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, 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.
Witness.retrieveFileHistory (cyclomatic 18) internal/audit/witness_transport.go:113— Witness.retrieveFileHistory 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.
engine.collectEnvAssignmentNamesFromTokens (cyclomatic 18) internal/engine/matcher.go:2482— engine.collectEnvAssignmentNamesFromTokens 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. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
hermes.load_config (cyclomatic 18) internal/plugin/hermes/__init__.py:255— hermes.load_config 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.
hermes._approval_action_summary (cyclomatic 18) internal/plugin/hermes/__init__.py:411— hermes._approval_action_summary 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.
index.html.loadRecentDenials (cyclomatic 18) internal/dashboard/static/index.html:1209— index.html.loadRecentDenials has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
collectApplyPatchPaths (cyclomatic 18) internal/plugin/openclaw/index.js:141— collectApplyPatchPaths has cyclomatic complexity 18 (threshold 15). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
normalizeToolCall (cyclomatic 18) internal/plugin/openclaw/index.js:207— normalizeToolCall 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.
readControlResponseText (cyclomatic 18) internal/plugin/openclaw/index.js:513— readControlResponseText 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.
cli.newSetupClineCmd (cyclomatic 17) cmd/rampart/cli/cline.go:30— cli.newSetupClineCmd has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to one function literal inside it that branches (line 54). 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.
cli.doctorAudit (cyclomatic 17) cmd/rampart/cli/doctor.go:1314— cli.doctorAudit has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, 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.
cli.parseReleaseVersion (cyclomatic 17) cmd/rampart/cli/doctor.go:1485— cli.parseReleaseVersion 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.
cli.printStatusHints (cyclomatic 17) cmd/rampart/cli/firstrun.go:44— cli.printStatusHints 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.
cli.extractPatchPaths (cyclomatic 17) cmd/rampart/cli/hook_codex.go:194— cli.extractPatchPaths has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.runRulesRemove (cyclomatic 17) cmd/rampart/cli/rules.go:357— cli.runRulesRemove 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.
cli.runRulesReset (cyclomatic 17) cmd/rampart/cli/rules.go:487— cli.runRulesReset 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.
cli.runSetupOpenClawPluginForServeURL (cyclomatic 17) cmd/rampart/cli/setup_openclaw_plugin.go:65— cli.runSetupOpenClawPluginForServeURL has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.todayEventsAt (cyclomatic 17) cmd/rampart/cli/status.go:554— cli.todayEventsAt 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.
cli.launchdServiceIdentity (cyclomatic 17) cmd/rampart/cli/uninstall.go:316— cli.launchdServiceIdentity 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.
cli.validSemverIdentifiers (cyclomatic 17) REDACTED:711— cli.validSemverIdentifiers has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
cli.extractRampartBinaryWithLimits (cyclomatic 17) REDACTED:899— cli.extractRampartBinaryWithLimits 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.
cli.verifyRestartedServe (cyclomatic 17) REDACTED:1105— cli.verifyRestartedServe 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.
cli.verifyOpenClawManagedConfig (cyclomatic 17) cmd/rampart/cli/verify.go:1253— cli.verifyOpenClawManagedConfig 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.
approval.walkApprovalStateDir (cyclomatic 17) internal/approval/store.go:1550— approval.walkApprovalStateDir 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.
ExternalRequest.ToolCall (cyclomatic 17) internal/approval/external.go:65— ExternalRequest.ToolCall 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.
Store.cleanupPersistedReplayState (cyclomatic 17) internal/approval/store.go:1498— Store.cleanupPersistedReplayState has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 3 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 1502). 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.
engine.mergeYAMLFiles (cyclomatic 17) internal/engine/dirstore.go:380— engine.mergeYAMLFiles 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.
engine.stripUnquotedShellComment (cyclomatic 17) internal/engine/matcher.go:1018— engine.stripUnquotedShellComment has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.leadingOptionValues (cyclomatic 17) internal/engine/matcher.go:1198— engine.leadingOptionValues 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. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.maskLiteralRedirects (cyclomatic 17) internal/engine/matcher.go:1726— engine.maskLiteralRedirects 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. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
filetxn.AcquireLock (cyclomatic 17) internal/filetxn/filetxn.go:70— filetxn.AcquireLock 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.
proxy.enrichParams (cyclomatic 17) internal/proxy/helpers.go:295— proxy.enrichParams 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.
Server.handleLearnRule (cyclomatic 17) internal/proxy/learn_handlers.go:51— Server.handleLearnRule 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.
hermes._approval_identity_within_bounds (cyclomatic 17) internal/plugin/hermes/__init__.py:1207— hermes._approval_identity_within_bounds 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.
cli.warnIfOverlyPermissive (cyclomatic 16) cmd/rampart/cli/allow.go:373— cli.warnIfOverlyPermissive has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.verifyAuditChain (cyclomatic 16) cmd/rampart/cli/audit.go:291— cli.verifyAuditChain has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
cli.doctorVersionCheck (cyclomatic 16) cmd/rampart/cli/doctor.go:1396— cli.doctorVersionCheck 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.
cli.newPreloadCmd (cyclomatic 16) cmd/rampart/cli/preload.go:30— cli.newPreloadCmd 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 2 function literals inside it that branch (lines 53, 47). 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.
cli.runProtectOpenClaw (cyclomatic 16) cmd/rampart/cli/protect.go:313— cli.runProtectOpenClaw 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.
cli.installOpenClawPluginSafely (cyclomatic 16) cmd/rampart/cli/setup_openclaw_plugin.go:520— cli.installOpenClawPluginSafely 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.
cli.parseCalVer (cyclomatic 16) cmd/rampart/cli/setup_openclaw_plugin.go:896— cli.parseCalVer 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.
cli.compareStrictPrerelease (cyclomatic 16) REDACTED:759— cli.compareStrictPrerelease 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.
hookApprovalClient.requestApprovalCtx (cyclomatic 16) cmd/rampart/cli/hook_approval.go:63— hookApprovalClient.requestApprovalCtx 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.
hookApprovalClient.pollApprovalCtx (cyclomatic 16) cmd/rampart/cli/hook_approval.go:156— hookApprovalClient.pollApprovalCtx 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.
audit.decodeWitnessJSON (cyclomatic 16) internal/audit/witness.go:331— audit.decodeWitnessJSON has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 5 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 338). 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.
Witness.retrieveHTTPS (cyclomatic 16) internal/audit/witness_pages.go:77— Witness.retrieveHTTPS 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.
engine.cleanPathsAt (cyclomatic 16) internal/engine/matcher.go:71— engine.cleanPathsAt has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.matchRestrictiveAlternateCommandFirst (cyclomatic 16) internal/engine/matcher.go:603— engine.matchRestrictiveAlternateCommandFirst has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.matchPathFirstForActionOS (cyclomatic 16) internal/engine/matcher.go:2174— engine.matchPathFirstForActionOS has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.matchPathFieldForAction (cyclomatic 16) internal/engine/matcher.go:2215— engine.matchPathFieldForAction has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: engine.joinPOSIXWords (cyclomatic 22) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded function is counted neither in this dimension's figures nor in its score.
engine.unwrapPrismaRunner (cyclomatic 16) internal/engine/production_commands.go:181— engine.unwrapPrismaRunner has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
engine.loadPersistentCallCounter (cyclomatic 16) internal/engine/ratelimit_persistent.go:128— engine.loadPersistentCallCounter 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.
engine.tokenizePowerShell (cyclomatic 16) internal/engine/shellparse.go:1229— engine.tokenizePowerShell 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.
engine.isExtremelyDangerousPath (cyclomatic 16) internal/engine/suggestions.go:360— engine.isExtremelyDangerousPath has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
Server.handleAuditStats (cyclomatic 16) internal/proxy/audit_handlers.go:265— Server.handleAuditStats 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.
token.readStoreFile (cyclomatic 16) internal/token/store.go:341— token.readStoreFile 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.
index.html.handlePendingClick (cyclomatic 16) internal/dashboard/static/index.html:1101— index.html.handlePendingClick 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.
cli.newServeCmd (cognitive 247) REDACTED:95— cli.newServeCmd has cognitive complexity 247 (threshold 15). Drivers by points: if/else 120 (223 pts), boolean chains 19, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 105). Most of this is not in the body itself: 8 of the 247 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 137, 131). 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.
cli.newHookCmd (cognitive 173) cmd/rampart/cli/hook.go:363— cli.newHookCmd has cognitive complexity 173 (threshold 15). Drivers by points: if/else 86 (147 pts), boolean chains 20, loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 64). None of this is in the body itself: all 173 points belong to one function literal inside it that branches (line 403). 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.
cli.newUpgradeCmdWithDeps (cognitive 169) REDACTED:130— cli.newUpgradeCmdWithDeps has cognitive complexity 169 (threshold 15). Drivers by points: if/else 101 (159 pts), boolean chains 5, loops 2 (4 pts), match/switch 1 (nesting depth added 60). Of this number, 57 points are the body's own statements and 112 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.
engine.visitPipedDownloadExecutionAliases (cognitive 135) internal/engine/pipe_download_exec.go:307— engine.visitPipedDownloadExecutionAliases has cognitive complexity 135 (threshold 15). Drivers by points: if/else 42 (93 pts), boolean chains 17, loops 9 (15 pts), match/switch 5 (10 pts) (nesting depth added 62). Most of this is not in the body itself: 2 of the 135 points are its own statements and the rest belongs to one function literal inside it that branches (line 315). 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.
cli.newInitCmd (cognitive 132) cmd/rampart/cli/init.go:84— cli.newInitCmd has cognitive complexity 132 (threshold 15). Drivers by points: if/else 60 (127 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 68). None of this is in the body itself: all 132 points belong to one function literal inside it that branches (line 94). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
Server.handleToolCall (cognitive 118) internal/proxy/eval_handlers.go:44— Server.handleToolCall has cognitive complexity 118 (threshold 15). Drivers by points: if/else 52 (101 pts), boolean chains 14, loops 1 (3 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.matchConditionForAction (cognitive 113) internal/engine/matcher.go:2669— engine.matchConditionForAction has cognitive complexity 113 (threshold 15). Drivers by points: if/else 48 (95 pts), boolean chains 12, loops 2 (6 pts) (nesting depth added 51). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Manifest.Validate (cognitive 112) internal/assurance/manifest.go:75— Manifest.Validate has cognitive complexity 112 (threshold 15). Drivers by points: if/else 40 (90 pts), loops 8 (15 pts), boolean chains 7 (nesting depth added 57). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audit.recoverChainStateByLinks (cognitive 112) internal/audit/recovery_links.go:35— audit.recoverChainStateByLinks has cognitive complexity 112 (threshold 15). Drivers by points: if/else 36 (96 pts), loops 8 (11 pts), boolean chains 5 (nesting depth added 63). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model.Update (cognitive 104) internal/watch/watch.go:315— Model.Update has cognitive complexity 104 (threshold 15). Drivers by points: if/else 30 (76 pts), loops 5 (15 pts), boolean chains 10, match/switch 2 (3 pts) (nesting depth added 57). 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.
engine.invocationDownloads (cognitive 101) internal/engine/download_exec.go:610— engine.invocationDownloads has cognitive complexity 101 (threshold 15). Drivers by points: if/else 27 (78 pts), boolean chains 18, loops 3 (5 pts) (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Server.handleBulkResolve (cognitive 94) internal/proxy/approval_handlers.go:501— Server.handleBulkResolve has cognitive complexity 94 (threshold 15). Drivers by points: if/else 39 (73 pts), loops 8 (13 pts), boolean chains 8 (nesting depth added 39). Of this number, 71 points are the body's own statements and 23 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.
cli.newSetupOpenClawCmd (cognitive 87) cmd/rampart/cli/setup.go:587— cli.newSetupOpenClawCmd has cognitive complexity 87 (threshold 15). Drivers by points: if/else 54 (76 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 23). None of this is in the body itself: all 87 points belong to one function literal inside it that branches (line 615). 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.
Proxy.handleToolsCall (cognitive 87) internal/mcp/proxy.go:428— Proxy.handleToolsCall has cognitive complexity 87 (threshold 15). Drivers by points: if/else 39 (79 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.pathChangeTargets (cognitive 84) internal/engine/matcher.go:1286— engine.pathChangeTargets has cognitive complexity 84 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 8 (22 pts), boolean chains 18, match/switch 7 (18 pts), jumps 2 (nesting depth added 40). Of this number, 51 points are the body's own statements and 33 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.
cli.runDoctor (cognitive 82) cmd/rampart/cli/doctor.go:159— cli.runDoctor has cognitive complexity 82 (threshold 15). Drivers by points: if/else 53 (74 pts), boolean chains 7, match/switch 1 (nesting depth added 21). Of this number, 62 points are the body's own statements and 20 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.
engine.visitCanonicalCommandAliases (cognitive 81) internal/engine/matcher.go:1601— engine.visitCanonicalCommandAliases has cognitive complexity 81 (threshold 15). Drivers by points: if/else 22 (51 pts), loops 7 (16 pts), boolean chains 14 (nesting depth added 38). Of this number, 68 points are the body's own statements and 13 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.
engine.visitDownloadExecutionAliases (cognitive 78) internal/engine/download_exec.go:467— engine.visitDownloadExecutionAliases has cognitive complexity 78 (threshold 15). Drivers by points: if/else 24 (49 pts), loops 9 (15 pts), boolean chains 12, match/switch 1 (2 pts) (nesting depth added 32). Most of this is not in the body itself: 2 of the 78 points are its own statements and the rest belongs to one function literal inside it that branches (line 473). 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.
engine.literalShellWords (cognitive 72) internal/engine/download_exec.go:32— engine.literalShellWords has cognitive complexity 72 (threshold 15). Drivers by points: if/else 23 (55 pts), boolean chains 13, loops 2 (4 pts) (nesting depth added 34). Of this number, 71 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
engine.executedFileOperand (cognitive 67) internal/engine/download_exec.go:753— engine.executedFileOperand has cognitive complexity 67 (threshold 15). Drivers by points: if/else 20 (53 pts), boolean chains 10, loops 2 (4 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Engine.EvaluateWith (cognitive 64) internal/engine/engine.go:127— Engine.EvaluateWith has cognitive complexity 64 (threshold 15). Drivers by points: if/else 24 (52 pts), boolean chains 7, match/switch 2 (4 pts), loops 1 (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.runAllowBlock (cognitive 61) cmd/rampart/cli/allow.go:119— cli.runAllowBlock has cognitive complexity 61 (threshold 15). Drivers by points: if/else 39 (54 pts), boolean chains 7 (nesting depth added 15). Of this number, 53 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.
engine.ExplainConditionForAction (cognitive 61) internal/engine/matcher.go:2289— engine.ExplainConditionForAction has cognitive complexity 61 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 7, loops 1 (2 pts) (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.
cli.runInteractiveSetup (cognitive 60) cmd/rampart/cli/setup_interactive.go:100— cli.runInteractiveSetup has cognitive complexity 60 (threshold 15). Drivers by points: if/else 23 (41 pts), loops 5 (8 pts), match/switch 3 (6 pts), boolean chains 5 (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.
cli.removeOpenClaw (cognitive 59) cmd/rampart/cli/setup.go:1126— cli.removeOpenClaw has cognitive complexity 59 (threshold 15). Drivers by points: if/else 26 (52 pts), loops 4 (6 pts), boolean chains 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.
index.html.appendHistRow (cognitive 59) internal/dashboard/static/index.html:1434— index.html.appendHistRow has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 15 (41 pts), boolean chains 18 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.printBenchSummary (cognitive 58) cmd/rampart/cli/bench.go:391— cli.printBenchSummary has cognitive complexity 58 (threshold 15). Drivers by points: if/else 32 (53 pts), loops 3 (5 pts) (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.
audit.recoverChainStateInFileOrder (cognitive 58) internal/audit/jsonl.go:84— audit.recoverChainStateInFileOrder has cognitive complexity 58 (threshold 15). Drivers by points: if/else 16 (53 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
report.GenerateExport (cognitive 57) internal/report/export.go:71— report.GenerateExport has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (41 pts), loops 6 (13 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.newPolicyExplainCmd (cognitive 56) cmd/rampart/cli/policy.go:92— cli.newPolicyExplainCmd has cognitive complexity 56 (threshold 15). Drivers by points: if/else 30 (52 pts), boolean chains 2, loops 2 (nesting depth added 22). None of this is in the body itself: all 56 points belong to one function literal inside it that branches (line 101). 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.
cli.upgradeStandardPoliciesForVersion (cognitive 56) REDACTED:1849— cli.upgradeStandardPoliciesForVersion has cognitive complexity 56 (threshold 15). Drivers by points: if/else 27 (48 pts), boolean chains 7, 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.
cli.removeClineHooksFromDir (cognitive 55) cmd/rampart/cli/cline.go:453— cli.removeClineHooksFromDir has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (47 pts), loops 4 (5 pts), boolean chains 3 (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.splitCompoundCommandForOS (cognitive 54) internal/engine/shellparse.go:260— engine.splitCompoundCommandForOS has cognitive complexity 54 (threshold 15). Drivers by points: if/else 20 (46 pts), boolean chains 7, loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.parseClineInput (cognitive 53) cmd/rampart/cli/hook.go:1288— cli.parseClineInput has cognitive complexity 53 (threshold 15). Drivers by points: if/else 27 (42 pts), boolean chains 10, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.splitHereDocuments (cognitive 53) internal/engine/download_exec.go:149— engine.splitHereDocuments has cognitive complexity 53 (threshold 15). Drivers by points: if/else 9 (30 pts), loops 6 (13 pts), boolean chains 8, match/switch 1 (2 pts) (nesting depth added 29). Of this number, 50 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.
Server.handleResolveApproval (cognitive 53) internal/proxy/approval_handlers.go:313— Server.handleResolveApproval has cognitive complexity 53 (threshold 15). Drivers by points: if/else 28 (46 pts), boolean chains 6, jumps 1 (nesting depth added 18). Of this number, 51 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.
cli.normalizeClineParams (cognitive 52) cmd/rampart/cli/hook.go:1446— cli.normalizeClineParams has cognitive complexity 52 (threshold 15). Drivers by points: if/else 21 (43 pts), boolean chains 8, loops 1 (nesting depth added 22). Of this number, 48 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
Proxy.handleChildLine (cognitive 52) internal/mcp/proxy.go:760— Proxy.handleChildLine has cognitive complexity 52 (threshold 15). Drivers by points: if/else 29 (48 pts), boolean chains 4 (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.
engine.stripPOSIXEnvUtilityMode (cognitive 50) internal/engine/shellparse.go:617— engine.stripPOSIXEnvUtilityMode has cognitive complexity 50 (threshold 15). Drivers by points: if/else 11 (34 pts), boolean chains 10, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MultiStore.Load (cognitive 50) internal/engine/dirstore.go:148— MultiStore.Load has cognitive complexity 50 (threshold 15). Drivers by points: if/else 20 (41 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.normalizeGeminiParams (cognitive 49) cmd/rampart/cli/hook_gemini.go:102— cli.normalizeGeminiParams has cognitive complexity 49 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 2 (4 pts), match/switch 2 (4 pts), boolean chains 2 (nesting depth added 26). Of this number, 43 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.newSetupClaudeCodeCmd (cognitive 49) cmd/rampart/cli/setup.go:264— cli.newSetupClaudeCodeCmd has cognitive complexity 49 (threshold 15). Drivers by points: if/else 33 (45 pts), boolean chains 3, loops 1 (nesting depth added 12). None of this is in the body itself: all 49 points belong to one function literal inside it that branches (line 290). 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.
audit.eventKeysCanonical (cognitive 48) internal/audit/event.go:148— audit.eventKeysCanonical has cognitive complexity 48 (threshold 15). Drivers by points: if/else 9 (31 pts), loops 3 (7 pts), boolean chains 5, match/switch 2 (5 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes._effective_terminal_cwd (cognitive 48) internal/plugin/hermes/__init__.py:1038— hermes._effective_terminal_cwd has cognitive complexity 48 (threshold 15). Drivers by points: if/else 19 (27 pts), boolean chains 12, ternaries 4 (8 pts), error handling 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.
cli.removeOpenClawNativePluginWithHostAt (cognitive 47) cmd/rampart/cli/setup_openclaw_plugin.go:1814— cli.removeOpenClawNativePluginWithHostAt has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (41 pts), boolean chains 6 (nesting depth added 17). Of this number, 45 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.
cli.newWrapCmd (cognitive 45) cmd/rampart/cli/wrap.go:57— cli.newWrapCmd has cognitive complexity 45 (threshold 15). Drivers by points: if/else 31 (38 pts), boolean chains 5, loops 2 (nesting depth added 7). Most of this is not in the body itself: 9 of the 45 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 93, 87). 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.
engine.inPlaceEditTargets (cognitive 45) internal/engine/matcher.go:1465— engine.inPlaceEditTargets has cognitive complexity 45 (threshold 15). Drivers by points: if/else 8 (25 pts), match/switch 3 (9 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.visitProductionCommandAliases (cognitive 45) internal/engine/production_commands.go:22— engine.visitProductionCommandAliases has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 13, match/switch 3 (4 pts), loops 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.collectClineCommands (cognitive 44) cmd/rampart/cli/hook.go:1548— cli.collectClineCommands has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 4 (9 pts), match/switch 1 (nesting depth added 24). Most of this is not in the body itself: 8 of the 44 points are its own statements and the rest belongs to one function literal inside it that branches (line 1565). 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.
cli.removeManagedServeServices (cognitive 44) cmd/rampart/cli/uninstall.go:215— cli.removeManagedServeServices has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (39 pts), loops 2 (4 pts), match/switch 1 (nesting depth added 28). 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.
engine.stripShellWrapperOnceForOS (cognitive 44) internal/engine/shellparse.go:1085— engine.stripShellWrapperOnceForOS has cognitive complexity 44 (threshold 15). Drivers by points: if/else 11 (32 pts), loops 3 (6 pts), boolean chains 5, match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Manager.Cleanup (cognitive 44) internal/session/manager.go:390— Manager.Cleanup has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (39 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 24). Of this number, 24 points are the body's own statements and 20 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.
cli.doctorHermesIntegration (cognitive 43) cmd/rampart/cli/doctor.go:2107— cli.doctorHermesIntegration has cognitive complexity 43 (threshold 15). Drivers by points: if/else 30 (41 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.installAntigravityPluginWithRename (cognitive 43) cmd/rampart/cli/setup_antigravity.go:80— cli.installAntigravityPluginWithRename has cognitive complexity 43 (threshold 15). Drivers by points: if/else 32 (41 pts), boolean chains 2 (nesting depth added 9). Of this number, 30 points are the body's own statements and 13 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.setOpenClawExecAskAt (cognitive 42) cmd/rampart/cli/setup_openclaw_plugin.go:1260— cli.setOpenClawExecAskAt has cognitive complexity 42 (threshold 15). Drivers by points: if/else 29 (38 pts), boolean chains 4 (nesting depth added 9). 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.
audit.compactRecord (cognitive 42) internal/audit/record.go:77— audit.compactRecord has cognitive complexity 42 (threshold 15). Drivers by points: if/else 21 (33 pts), boolean chains 9 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.tokenize (cognitive 42) internal/engine/shellparse.go:1344— engine.tokenize has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 3 (7 pts), boolean chains 5 (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.
hermes.extractWithRename (cognitive 42) internal/plugin/hermes/embed.go:135— hermes.extractWithRename has cognitive complexity 42 (threshold 15). Drivers by points: if/else 26 (37 pts), loops 4 (5 pts) (nesting depth added 12). Of this number, 28 points are the body's own statements and 14 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.runConvert (cognitive 41) REDACTED:78— cli.runConvert has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (33 pts), loops 7, boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
checkWithRampart (cognitive 41) internal/plugin/openclaw/index.js:595— checkWithRampart has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (18 pts), error handling 4 (7 pts), other 6, boolean chains 5, ternaries 3 (5 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.launchdServiceIdentity (cognitive 40) cmd/rampart/cli/uninstall.go:316— cli.launchdServiceIdentity has cognitive complexity 40 (threshold 15). Drivers by points: if/else 10 (34 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.resolveBeforePublishLocked (cognitive 40) internal/approval/store.go:660— Store.resolveBeforePublishLocked has cognitive complexity 40 (threshold 15). Drivers by points: if/else 26 (38 pts), boolean chains 2 (nesting depth added 12). Of this number, 38 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.
register::evaluateToolCall (cognitive 40) internal/plugin/openclaw/index.js:737— register::evaluateToolCall has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (23 pts), ternaries 7 (11 pts), boolean chains 2, other 2, loops 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.integrationEnvironmentFingerprintAt (cognitive 39) cmd/rampart/cli/assurance_status.go:387— cli.integrationEnvironmentFingerprintAt has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (34 pts), boolean chains 3, 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.
cli.newPolicyListCmd (cognitive 39) cmd/rampart/cli/policy_registry.go:123— cli.newPolicyListCmd has cognitive complexity 39 (threshold 15). Drivers by points: if/else 17 (32 pts), loops 4 (7 pts) (nesting depth added 18). None of this is in the body itself: all 39 points belong to one function literal inside it that branches (line 131). 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.
cli.newVerifyCmd (cognitive 39) cmd/rampart/cli/verify.go:119— cli.newVerifyCmd has cognitive complexity 39 (threshold 15). Drivers by points: if/else 24 (38 pts), boolean chains 1 (nesting depth added 14). None of this is in the body itself: all 39 points belong to one function literal inside it that branches (line 137). 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.
cli.installClineHooksWithRename (cognitive 38) cmd/rampart/cli/cline.go:285— cli.installClineHooksWithRename has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 5, boolean chains 3 (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.
Store.readLatestRecordsLocked (cognitive 38) internal/approval/store.go:1755— Store.readLatestRecordsLocked has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (33 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
proxy.prepareToolRequest (cognitive 38) internal/proxy/helpers.go:152— proxy.prepareToolRequest has cognitive complexity 38 (threshold 15). Drivers by points: if/else 16 (30 pts), loops 4 (5 pts), match/switch 2, 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.
cli.normalizeV2Cases (cognitive 37) cmd/rampart/cli/bench.go:531— cli.normalizeV2Cases has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (33 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.patchOpenClawToolsIn (cognitive 37) cmd/rampart/cli/setup.go:1523— cli.patchOpenClawToolsIn has cognitive complexity 37 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
detect.Environment (cognitive 37) internal/detect/detect.go:53— detect.Environment has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 12, loops 2 (5 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.isExtremelyDangerous (cognitive 37) internal/engine/suggestions.go:27— engine.isExtremelyDangerous has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 13, loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes.evaluate_pre_tool_call (cognitive 37) internal/plugin/hermes/__init__.py:1308— hermes.evaluate_pre_tool_call has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 12, error handling 2 (4 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.doctorHookBinary (cognitive 36) cmd/rampart/cli/doctor.go:516— cli.doctorHookBinary has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (29 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.stripPOSIXTransparentExecutorOnce (cognitive 36) internal/engine/shellparse.go:489— engine.stripPOSIXTransparentExecutorOnce has cognitive complexity 36 (threshold 15). Drivers by points: if/else 7 (24 pts), match/switch 3 (7 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Proxy.handleClientLineWithContext (cognitive 36) internal/mcp/proxy.go:354— Proxy.handleClientLineWithContext has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (34 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.handlePreflight (cognitive 36) internal/proxy/eval_handlers.go:588— Server.handlePreflight has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 8 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Server.handleAuditEvents (cognitive 35) internal/proxy/audit_handlers.go:41— Server.handleAuditEvents has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (26 pts), boolean chains 6, 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.
cli.extractPatchPaths (cognitive 34) cmd/rampart/cli/hook_codex.go:194— cli.extractPatchPaths has cognitive complexity 34 (threshold 15). Drivers by points: if/else 9 (26 pts), boolean chains 3, loops 2 (3 pts), match/switch 1 (2 pts) (nesting depth added 19). Of this number, 32 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.
cli.collectNativeHookPaths (cognitive 34) cmd/rampart/cli/hook_copilot.go:237— cli.collectNativeHookPaths has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (23 pts), loops 4 (8 pts), match/switch 1 (3 pts) (nesting depth added 21). Of this number, 31 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Model.View (cognitive 34) internal/watch/watch.go:509— Model.View has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (27 pts), loops 3 (4 pts), boolean chains 3 (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.
cli.runSetupOpenClawMigrateWith (cognitive 33) cmd/rampart/cli/setup_openclaw_plugin.go:595— cli.runSetupOpenClawMigrateWith has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.AutoApproveRunBeforePublishForRunScopeSnapshot (cognitive 33) internal/approval/store.go:1133— Store.AutoApproveRunBeforePublishForRunScopeSnapshot has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (26 pts), loops 3, boolean chains 2, match/switch 1 (2 pts) (nesting depth added 12). Of this number, 31 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audit.NewJSONLSink (cognitive 33) internal/audit/jsonl.go:251— audit.NewJSONLSink has cognitive complexity 33 (threshold 15). Drivers by points: if/else 21 (30 pts), boolean chains 2, loops 1 (nesting depth added 9). Of this number, 22 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.launcherPayloads (cognitive 33) internal/engine/matcher.go:1071— engine.launcherPayloads has cognitive complexity 33 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 3 (7 pts), match/switch 3 (7 pts), boolean chains 5 (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.
engine.stripPOSIXTimeout (cognitive 33) internal/engine/shellparse.go:804— engine.stripPOSIXTimeout has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (19 pts), boolean chains 9, jumps 2, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
MixedStore.Load (cognitive 33) internal/engine/dirstore.go:270— MixedStore.Load has cognitive complexity 33 (threshold 15). Drivers by points: if/else 15 (21 pts), loops 7 (9 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
fileTailer.start (cognitive 33) REDACTED:51— fileTailer.start has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (27 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 17). None of this is in the body itself: all 33 points belong to one function literal inside it that branches (line 54). 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.
cli.collectIntegrationAssuranceStatuses (cognitive 32) cmd/rampart/cli/assurance_status.go:530— cli.collectIntegrationAssuranceStatuses has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (25 pts), boolean chains 6, 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.
cli.doctorFileToolPatches (cognitive 32) cmd/rampart/cli/doctor.go:1120— cli.doctorFileToolPatches has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 6, 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.
cli.detectPackageRegistryURL (cognitive 32) cmd/rampart/cli/hook_approval.go:311— cli.detectPackageRegistryURL has cognitive complexity 32 (threshold 15). Drivers by points: if/else 15 (28 pts), boolean chains 2, loops 1, 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.
Store.BeginRunScopeSnapshot (cognitive 32) internal/approval/store.go:910— Store.BeginRunScopeSnapshot has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (27 pts), boolean chains 3, loops 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.
hermes._hermes_supports_native_approval (cognitive 32) internal/plugin/hermes/__init__.py:792— hermes._hermes_supports_native_approval has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 18, error handling 5 (7 pts), if/else 5 (7 pts) (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.collectAntigravityPaths (cognitive 31) cmd/rampart/cli/hook_antigravity.go:149— cli.collectAntigravityPaths has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 4 (8 pts), match/switch 1 (2 pts) (nesting depth added 18). Of this number, 28 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.newMCPProxyCmd (cognitive 31) cmd/rampart/cli/mcp.go:77— cli.newMCPProxyCmd has cognitive complexity 31 (threshold 15). Drivers by points: if/else 24 (28 pts), boolean chains 2, loops 1 (nesting depth added 4). Most of this is not in the body itself: 5 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 103, 97). 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.
engine.mergeYAMLFiles (cognitive 31) internal/engine/dirstore.go:380— engine.mergeYAMLFiles has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.collectEnvAssignmentNamesFromTokens (cognitive 31) internal/engine/matcher.go:2482— engine.collectEnvAssignmentNamesFromTokens has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (5 pts), boolean chains 2, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes._approval_identity_within_bounds (cognitive 31) internal/plugin/hermes/__init__.py:1207— hermes._approval_identity_within_bounds has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 2 (4 pts), error handling 1 (3 pts), boolean chains 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.
cli.newAuditVerifyCmd (cognitive 30) cmd/rampart/cli/audit.go:136— cli.newAuditVerifyCmd has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 10). None of this is in the body itself: all 30 points belong to one function literal inside it that branches (line 156). 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.
cli.collectClinePaths (cognitive 30) cmd/rampart/cli/hook.go:1628— cli.collectClinePaths has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (22 pts), loops 4 (7 pts), match/switch 1 (nesting depth added 15). Most of this is not in the body itself: 6 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1649, 1631). 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.
cli.patchOpenClawDistToolsIn (cognitive 30) cmd/rampart/cli/setup.go:1716— cli.patchOpenClawDistToolsIn has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (25 pts), boolean chains 3, loops 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.
cli.runUninstall (cognitive 30) cmd/rampart/cli/uninstall.go:47— cli.runUninstall has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), loops 2 (4 pts), boolean chains 1, match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.scanCLIOptions (cognitive 30) internal/engine/production_commands.go:122— engine.scanCLIOptions has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.extractDollarParen (cognitive 30) internal/engine/shellparse.go:147— engine.extractDollarParen has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (22 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 18). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
index.html.renderPending (cognitive 30) internal/dashboard/static/index.html:899— index.html.renderPending has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 12, loops 4 (5 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 13 belong to 4 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.removeHermesIntegration (cognitive 29) cmd/rampart/cli/setup_hermes_remove.go:143— cli.removeHermesIntegration has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.verifyRestartedServe (cognitive 29) REDACTED:1105— cli.verifyRestartedServe has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), match/switch 2 (6 pts), boolean chains 2, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hookApprovalClient.pollApprovalCtx (cognitive 29) cmd/rampart/cli/hook_approval.go:156— hookApprovalClient.pollApprovalCtx has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (21 pts), match/switch 2 (5 pts), boolean chains 2, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.hasNestedRegexQuantifiers (cognitive 29) internal/engine/policy.go:709— engine.hasNestedRegexQuantifiers has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (25 pts), match/switch 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.tokenizePowerShell (cognitive 29) internal/engine/shellparse.go:1229— engine.tokenizePowerShell has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (24 pts), boolean chains 4, 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.
readControlResponseText (cognitive 29) internal/plugin/openclaw/index.js:513— readControlResponseText has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (16 pts), error handling 2 (7 pts), boolean chains 3, loops 1 (2 pts), other 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.
cli.ensureOpenClawExecApprovalConfig (cognitive 28) cmd/rampart/cli/setup_openclaw_plugin.go:1006— cli.ensureOpenClawExecApprovalConfig has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 1 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.restoreOpenClawExecAskFromReceipt (cognitive 28) cmd/rampart/cli/setup_openclaw_plugin.go:1380— cli.restoreOpenClawExecAskFromReceipt has cognitive complexity 28 (threshold 15). Drivers by points: if/else 16 (21 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.verifyClineHooksInstalled (cognitive 28) cmd/rampart/cli/verify.go:478— cli.verifyClineHooksInstalled has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Witness.retrieveHTTPS (cognitive 28) internal/audit/witness_pages.go:77— Witness.retrieveHTTPS has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.classifyPipelineStage (cognitive 28) internal/engine/pipe_download_exec.go:160— engine.classifyPipelineStage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4 (5 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.doctorPolicies (cognitive 27) cmd/rampart/cli/doctor.go:591— cli.doctorPolicies has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (16 pts), match/switch 2 (6 pts), boolean chains 4, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.parseCopilotInput (cognitive 27) cmd/rampart/cli/hook_copilot.go:52— cli.parseCopilotInput has cognitive complexity 27 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 4 (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.
cli.claudeHooksUseCommand (cognitive 27) cmd/rampart/cli/setup.go:2279— cli.claudeHooksUseCommand has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.removeOpenClawRampartConfig (cognitive 27) cmd/rampart/cli/setup_openclaw_plugin.go:1729— cli.removeOpenClawRampartConfig has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 2 (5 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.todayEventsAt (cognitive 27) cmd/rampart/cli/status.go:554— cli.todayEventsAt has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.backupLegacyManagedPolicy (cognitive 27) REDACTED:2031— cli.backupLegacyManagedPolicy has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (26 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.removeRule (cognitive 27) internal/engine/persist.go:455— engine.removeRule has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 2 (5 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.extractProcessSubstitution (cognitive 27) internal/engine/shellparse.go:111— engine.extractProcessSubstitution has cognitive complexity 27 (threshold 15). Drivers by points: if/else 6 (19 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.doctorPreload (cognitive 26) cmd/rampart/cli/doctor.go:1047— cli.doctorPreload has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.getOpenClawPluginStateAt (cognitive 26) cmd/rampart/cli/setup_openclaw_plugin.go:1591— cli.getOpenClawPluginStateAt has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.warnAboutPathCopies (cognitive 26) REDACTED:1649— cli.warnAboutPathCopies has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 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.
engine.runGlobNFA (cognitive 26) internal/engine/matcher.go:446— engine.runGlobNFA has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (19 pts), loops 2 (3 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.matchPathFirstForActionOS (cognitive 26) internal/engine/matcher.go:2174— engine.matchPathFirstForActionOS has cognitive complexity 26 (threshold 15). Drivers by points: if/else 5 (15 pts), loops 4 (8 pts), boolean chains 3 (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.
Server.handleAuditStats (cognitive 26) internal/proxy/audit_handlers.go:265— Server.handleAuditStats has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 3 (6 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.bulkResolveRun (cognitive 26) internal/dashboard/static/index.html:1010— index.html.bulkResolveRun has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (12 pts), ternaries 4 (11 pts), boolean chains 2, error handling 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.
cli.runBench (cognitive 25) cmd/rampart/cli/bench.go:229— cli.runBench has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (19 pts), loops 3, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
cli.readClaudeProjectHookControls (cognitive 25) cmd/rampart/cli/claude_hook_state.go:88— cli.readClaudeProjectHookControls has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.doctorOpenClawAskMode (cognitive 25) cmd/rampart/cli/doctor.go:2008— cli.doctorOpenClawAskMode has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 2, 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.
cli.newPolicySearchCmd (cognitive 25) cmd/rampart/cli/policy_registry.go:236— cli.newPolicySearchCmd has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 2, loops 2 (nesting depth added 8). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 245). 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.
cli.extractRampartBinaryWithLimits (cognitive 25) REDACTED:899— cli.extractRampartBinaryWithLimits has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.checkShadowedRules (cognitive 25) internal/engine/lint.go:351— engine.checkShadowedRules has cognitive complexity 25 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (8 pts), boolean chains 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.
mcp.validateUniqueJSONValue (cognitive 25) internal/mcp/jsonrpc.go:273— mcp.validateUniqueJSONValue has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 2 (4 pts), match/switch 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.
signing.LoadOrCreateKey (cognitive 25) internal/signing/signer.go:76— signing.LoadOrCreateKey has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 3 of the 25 points are its own statements and the rest belongs to one function literal inside it that branches (line 86). 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.
cli.codexHooksUseCommands (cognitive 24) cmd/rampart/cli/setup_codex.go:222— cli.codexHooksUseCommands has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.cleanOpenClawConfig (cognitive 24) cmd/rampart/cli/setup_openclaw_plugin.go:1471— cli.cleanOpenClawConfig has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.ensureRampartDirAccessible (cognitive 24) cmd/rampart/cli/token_unix.go:26— cli.ensureRampartDirAccessible has cognitive complexity 24 (threshold 15). Drivers by points: if/else 19 (23 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.findRequireApprovalUsages (cognitive 24) REDACTED:1770— cli.findRequireApprovalUsages has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 11). 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.
engine.leadingOptionValues (cognitive 24) internal/engine/matcher.go:1198— engine.leadingOptionValues has cognitive complexity 24 (threshold 15). Drivers by points: if/else 4 (15 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.maskLiteralRedirects (cognitive 24) internal/engine/matcher.go:1726— engine.maskLiteralRedirects has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 7, 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.
engine.matchRestrictiveCommandDialectFirst (cognitive 24) internal/engine/matcher.go:1769— engine.matchRestrictiveCommandDialectFirst has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.followAuditFile (cognitive 23) cmd/rampart/cli/audit.go:94— cli.followAuditFile has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.renderPolicy (cognitive 23) REDACTED:341— cli.renderPolicy has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 6 (9 pts), match/switch 1 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.outputHookResultWithResponse (cognitive 23) cmd/rampart/cli/hook.go:1899— cli.outputHookResultWithResponse has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 4 (7 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.parseCodexInput (cognitive 23) cmd/rampart/cli/hook_codex.go:41— cli.parseCodexInput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.readVerifiedAuditPath (cognitive 23) cmd/rampart/cli/init_from_audit.go:134— cli.readVerifiedAuditPath has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). Of this number, 16 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.
cli.runRulesRemove (cognitive 23) cmd/rampart/cli/rules.go:357— cli.runRulesRemove has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.runRulesReset (cognitive 23) cmd/rampart/cli/rules.go:487— cli.runRulesReset has cognitive complexity 23 (threshold 15). Drivers by points: if/else 18 (23 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.installLinux (cognitive 23) cmd/rampart/cli/serve_install.go:583— cli.installLinux has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (23 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.claudeRampartHooksUnsafeFields (cognitive 23) cmd/rampart/cli/setup_claude_failure.go:357— cli.claudeRampartHooksUnsafeFields has cognitive complexity 23 (threshold 15). Drivers by points: if/else 3 (13 pts), loops 4 (10 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.ensureOpenClawApprovalHardening (cognitive 23) cmd/rampart/cli/setup_openclaw_plugin.go:180— cli.ensureOpenClawApprovalHardening has cognitive complexity 23 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 2, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.codexRampartIntegrationPresent (cognitive 23) cmd/rampart/cli/uninstall_integrations.go:55— cli.codexRampartIntegrationPresent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (9 pts), boolean chains 2 (nesting depth added 15). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
cli.configuredVerificationTargets (cognitive 23) cmd/rampart/cli/verify.go:224— cli.configuredVerificationTargets has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.createLocked (cognitive 23) internal/approval/store.go:513— Store.createLocked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (17 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
engine.cleanPathsAt (cognitive 23) internal/engine/matcher.go:71— engine.cleanPathsAt has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.restrictiveCommandAliases (cognitive 23) internal/engine/matcher.go:923— engine.restrictiveCommandAliases has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, loops 2 (4 pts) (nesting depth added 8). Of this number, 20 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.matchGrantCommandFieldWithAnalysis (cognitive 23) internal/engine/matcher.go:2105— engine.matchGrantCommandFieldWithAnalysis has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Engine.policiesNeedPathResolution (cognitive 23) internal/engine/engine.go:954— Engine.policiesNeedPathResolution has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
mcp.validateJSONStringEncoding (cognitive 23) internal/mcp/jsonrpc.go:131— mcp.validateJSONStringEncoding has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policy.IsPathPattern (cognitive 23) internal/policy/custom.go:316— policy.IsPathPattern has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 5 (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.
hermes._approval_rule_key (cognitive 23) internal/plugin/hermes/__init__.py:1133— hermes._approval_rule_key has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 3, ternaries 1 (2 pts), error handling 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.
cli.verifyAuditChain (cognitive 22) cmd/rampart/cli/audit.go:291— cli.verifyAuditChain has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, loops 1 (nesting depth added 8). Most of this is not in the body itself: 10 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 311). 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.
cli.runProtectionPlan (cognitive 22) cmd/rampart/cli/protect.go:149— cli.runProtectionPlan has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (19 pts), 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.
cli.installDarwin (cognitive 22) cmd/rampart/cli/serve_install.go:506— cli.installDarwin has cognitive complexity 22 (threshold 15). Drivers by points: if/else 18 (22 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
Store.loadFromDisk (cognitive 22) internal/approval/store.go:1859— Store.loadFromDisk has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
audit.decodeWitnessJSON (cognitive 22) internal/audit/witness.go:331— audit.decodeWitnessJSON has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 8). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to one function literal inside it that branches (line 338). 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.
JSONLSink.validateSharedStateLocked (cognitive 22) internal/audit/state.go:129— JSONLSink.validateSharedStateLocked has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
Witness.Publish (cognitive 22) internal/audit/witness.go:262— Witness.Publish has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 4 (nesting depth added 4). Of this number, 15 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
Witness.retrieveFileHistory (cognitive 22) internal/audit/witness_transport.go:113— Witness.retrieveFileHistory has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.literalShellPayload (cognitive 22) internal/engine/download_exec.go:830— engine.literalShellPayload has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.GenerateSuggestions (cognitive 22) internal/engine/suggestions.go:300— engine.GenerateSuggestions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 4, 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.
pipelineStage.executesTaintedInput (cognitive 22) internal/engine/pipe_download_exec.go:118— pipelineStage.executesTaintedInput has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, loops 2 (3 pts), match/switch 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
filetxn.WithLockContext (cognitive 22) internal/filetxn/context.go:17— filetxn.WithLockContext has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
hermes._approval_action_summary (cognitive 22) internal/plugin/hermes/__init__.py:411— hermes._approval_action_summary has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 4 (7 pts), boolean chains 6 (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.
nativeApprovalDescription (cognitive 22) internal/plugin/openclaw/index.js:44— nativeApprovalDescription has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, ternaries 5, if/else 3 (4 pts), other 2 (nesting depth added 1). Of this number, 20 points are the body's own statements and 2 belong to 3 function literals inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
cli.newSetupClineCmd (cognitive 21) cmd/rampart/cli/cline.go:30— cli.newSetupClineCmd has cognitive complexity 21 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 2 (nesting depth added 4). None of this is in the body itself: all 21 points belong to one function literal inside it that branches (line 54). 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.
cli.validateClaudePreToolParams (cognitive 21) cmd/rampart/cli/hook.go:1138— cli.validateClaudePreToolParams has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 9). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.loadLogEvents (cognitive 21) cmd/rampart/cli/log.go:114— cli.loadLogEvents has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.patchMessageInDist (cognitive 21) cmd/rampart/cli/setup.go:2012— cli.patchMessageInDist has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.installCodexHooks (cognitive 21) cmd/rampart/cli/setup_codex.go:143— cli.installCodexHooks has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.installShellCompletions (cognitive 21) cmd/rampart/cli/setup_interactive.go:406— cli.installShellCompletions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (20 pts), 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.
cli.verifyRestartedServeState (cognitive 21) REDACTED:1181— cli.verifyRestartedServeState has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 2 (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.
approval.walkApprovalStateDir (cognitive 21) internal/approval/store.go:1550— approval.walkApprovalStateDir has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Store.requireLegacyIdentityStateLocked (cognitive 21) internal/approval/identity.go:138— Store.requireLegacyIdentityStateLocked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 9). 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.
audit.ReadEventsFromOffset (cognitive 21) internal/audit/reader.go:108— audit.ReadEventsFromOffset has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 1 (nesting depth added 8). 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.
engine.matchRestrictiveAlternateCommandFirst (cognitive 21) internal/engine/matcher.go:603— engine.matchRestrictiveAlternateCommandFirst has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.restrictiveRMOperands (cognitive 21) internal/engine/matcher.go:973— engine.restrictiveRMOperands has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Engine.RequiresCallCount (cognitive 21) internal/engine/ratelimit.go:104— Engine.RequiresCallCount has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes.load_config (cognitive 21) internal/plugin/hermes/__init__.py:255— hermes.load_config has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
index.html.runPolicyTest (cognitive 21) internal/dashboard/static/index.html:1516— index.html.runPolicyTest has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 2, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
collectApplyPatchPaths (cognitive 21) internal/plugin/openclaw/index.js:141— collectApplyPatchPaths has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (3 pts), boolean chains 2, ternaries 1 (2 pts), other 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 4 belong to 2 function items 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.
cli.listPendingDetails (cognitive 20) cmd/rampart/cli/approve.go:169— cli.listPendingDetails has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.doctorHooks (cognitive 20) cmd/rampart/cli/doctor.go:904— cli.doctorHooks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.doctorAudit (cognitive 20) cmd/rampart/cli/doctor.go:1314— cli.doctorAudit has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2, loops 1 (nesting depth added 4). Of this number, 14 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.parseClaudeCodeInput (cognitive 20) cmd/rampart/cli/hook.go:1057— cli.parseClaudeCodeInput has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.newPolicyRulesCmd (cognitive 20) cmd/rampart/cli/policy.go:357— cli.newPolicyRulesCmd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 6). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 367). 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.
cli.runProtectOpenClaw (cognitive 20) cmd/rampart/cli/protect.go:313— cli.runProtectOpenClaw has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.hasRampartHook (cognitive 20) cmd/rampart/cli/setup.go:1442— cli.hasRampartHook has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.newSetupCodexCmd (cognitive 20) cmd/rampart/cli/setup_codex.go:55— cli.newSetupCodexCmd has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 1 (nesting depth added 6). None of this is in the body itself: all 20 points belong to one function literal inside it that branches (line 70). 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.
cli.installGeminiHooks (cognitive 20) cmd/rampart/cli/setup_gemini.go:69— cli.installGeminiHooks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 2, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.splitServiceCommand (cognitive 20) cmd/rampart/cli/uninstall.go:415— cli.splitServiceCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.extractSubstitutions (cognitive 20) internal/engine/pipe_download_exec.go:245— engine.extractSubstitutions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (6 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.stripPOSIXNice (cognitive 20) internal/engine/shellparse.go:762— engine.stripPOSIXNice has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (12 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
proxy.enrichParams (cognitive 20) internal/proxy/helpers.go:295— proxy.enrichParams has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 4 (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.
Server.handleResolveHostedApproval (cognitive 20) internal/proxy/approval_handlers.go:803— Server.handleResolveHostedApproval has cognitive complexity 20 (threshold 15). Drivers by points: if/else 16 (17 pts), match/switch 2 (3 pts) (nesting depth added 2). 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.
cli.validateCursorActionParams (cognitive 19) cmd/rampart/cli/hook_cursor.go:99— cli.validateCursorActionParams has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 4, match/switch 1 (nesting depth added 8). 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.
cli.removeClaudeCodeHooks (cognitive 19) cmd/rampart/cli/setup.go:508— cli.removeClaudeCodeHooks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 15 (18 pts), loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
cli.patchWebFetchInDist (cognitive 19) cmd/rampart/cli/setup.go:1853— cli.patchWebFetchInDist has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.removeRampartCodexHandlers (cognitive 19) cmd/rampart/cli/setup_codex.go:422— cli.removeRampartCodexHandlers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.validSemverIdentifiers (cognitive 19) REDACTED:711— cli.validSemverIdentifiers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hookApprovalClient.requestApprovalCtx (cognitive 19) cmd/rampart/cli/hook_approval.go:63— hookApprovalClient.requestApprovalCtx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
Store.cleanupPersistedReplayState (cognitive 19) internal/approval/store.go:1498— Store.cleanupPersistedReplayState has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 1502). 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.
audit.NewWitness (cognitive 19) internal/audit/witness.go:121— audit.NewWitness has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.validatePolicy (cognitive 19) internal/engine/policy.go:561— engine.validatePolicy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
filetxn.AcquireLock (cognitive 19) internal/filetxn/filetxn.go:70— filetxn.AcquireLock has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
report.readAndVerifyAuditChain (cognitive 19) internal/report/compliance.go:383— report.readAndVerifyAuditChain has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.handlePendingClick (cognitive 19) internal/dashboard/static/index.html:1101— index.html.handlePendingClick has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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.
cli.doctorOpenClawApprovalHardening (cognitive 18) cmd/rampart/cli/doctor.go:1827— cli.doctorOpenClawApprovalHardening has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 3 (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, 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.
cli.printStatusHints (cognitive 18) cmd/rampart/cli/firstrun.go:44— cli.printStatusHints has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.resolveExplainPolicyPath (cognitive 18) cmd/rampart/cli/policy.go:227— cli.resolveExplainPolicyPath has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.waitForBackgroundReady (cognitive 18) REDACTED:871— cli.waitForBackgroundReady has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), boolean chains 2, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.removeRampartClaudeHookCommands (cognitive 18) cmd/rampart/cli/setup.go:2239— cli.removeRampartClaudeHookCommands has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.removeGeminiHooks (cognitive 18) cmd/rampart/cli/setup_gemini.go:194— cli.removeGeminiHooks has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.clineManagedHooksPresentInDir (cognitive 18) cmd/rampart/cli/uninstall_integrations.go:32— cli.clineManagedHooksPresentInDir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.oversizedMatchInput (cognitive 18) internal/engine/engine.go:679— engine.oversizedMatchInput has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.matchPathFieldForAction (cognitive 18) internal/engine/matcher.go:2215— engine.matchPathFieldForAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.loadPersistentCallCounter (cognitive 18) internal/engine/ratelimit_persistent.go:128— engine.loadPersistentCallCounter has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 2 (3 pts), boolean chains 2 (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.
Server.handleLearnRule (cognitive 18) internal/proxy/learn_handlers.go:51— Server.handleLearnRule has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 1, loops 1, match/switch 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.
index.html.loadRecentDenials (cognitive 18) internal/dashboard/static/index.html:1209— index.html.loadRecentDenials has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 2, error handling 1, loops 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.validateVerificationReceipt (cognitive 17) cmd/rampart/cli/assurance_status.go:331— cli.validateVerificationReceipt has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), match/switch 2 (3 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.runDoctorFix (cognitive 17) cmd/rampart/cli/doctor.go:108— cli.runDoctorFix has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.newLogCmd (cognitive 17) cmd/rampart/cli/log.go:30— cli.newLogCmd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). None of this is in the body itself: all 17 points belong to one function literal inside it that branches (line 53). 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.
cli.runSetupOpenClawPluginForServeURL (cognitive 17) cmd/rampart/cli/setup_openclaw_plugin.go:65— cli.runSetupOpenClawPluginForServeURL has cognitive complexity 17 (threshold 15). Drivers by points: if/else 17. Of this number, 16 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: 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.
cli.installOpenClawPluginSafely (cognitive 17) cmd/rampart/cli/setup_openclaw_plugin.go:520— cli.installOpenClawPluginSafely has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, 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.
cli.parseCalVer (cognitive 17) cmd/rampart/cli/setup_openclaw_plugin.go:896— cli.parseCalVer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.verifyOpenClawManagedConfig (cognitive 17) cmd/rampart/cli/verify.go:1253— cli.verifyOpenClawManagedConfig has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
engine.validateStringAliasesWithValues (cognitive 17) internal/engine/decision.go:239— engine.validateStringAliasesWithValues has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.parseLiteralInvocation (cognitive 17) internal/engine/download_exec.go:382— engine.parseLiteralInvocation has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.extractBackticks (cognitive 17) internal/engine/shellparse.go:189— engine.extractBackticks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 2 (4 pts), 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.
engine.stripPOSIXStdbuf (cognitive 17) internal/engine/shellparse.go:886— engine.stripPOSIXStdbuf has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), boolean chains 5, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
hermes.normalize_tool_call (cognitive 17) internal/plugin/hermes/__init__.py:506— hermes.normalize_tool_call has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 4 (5 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
index.html.poll (cognitive 17) internal/dashboard/static/index.html:835— index.html.poll has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
normalizeToolCall (cognitive 17) internal/plugin/openclaw/index.js:207— normalizeToolCall has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 3 (4 pts), other 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.
cli.verifyAnchorsWithSince (cognitive 16) cmd/rampart/cli/audit_helpers.go:330— cli.verifyAnchorsWithSince has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.inspectClineDestination (cognitive 16) cmd/rampart/cli/cline.go:234— cli.inspectClineDestination has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
cli.openclawUsesBundledDist (cognitive 16) cmd/rampart/cli/doctor.go:1220— cli.openclawUsesBundledDist has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.collectClineURLs (cognitive 16) cmd/rampart/cli/hook.go:1704— cli.collectClineURLs has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 7). 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 1719, 1707). 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.
cli.newPreloadCmd (cognitive 16) cmd/rampart/cli/preload.go:30— cli.newPreloadCmd has cognitive complexity 16 (threshold 15). Drivers by points: if/else 15, boolean chains 1. None of this is in the body itself: all 16 points belong to 2 function literals inside it that branch (lines 53, 47). 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.
cli.runComplianceReport (cognitive 16) cmd/rampart/cli/report.go:162— cli.runComplianceReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 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, 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.
cli.patchBrowserInDist (cognitive 16) cmd/rampart/cli/setup.go:1927— cli.patchBrowserInDist has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.antigravityPluginManaged (cognitive 16) cmd/rampart/cli/setup_antigravity.go:212— cli.antigravityPluginManaged has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
cli.geminiHooksConfiguredForHome (cognitive 16) cmd/rampart/cli/setup_gemini.go:117— cli.geminiHooksConfiguredForHome has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.loadOpenClawToolsConfigDocument (cognitive 16) cmd/rampart/cli/setup_openclaw_plugin.go:1066— cli.loadOpenClawToolsConfigDocument has cognitive complexity 16 (threshold 15). Drivers by points: if/else 14, boolean chains 2. 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.
cli.openClawConfigHasRampart (cognitive 16) cmd/rampart/cli/setup_openclaw_plugin.go:1780— cli.openClawConfigHasRampart has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.detectHermesPluginStateForHome (cognitive 16) cmd/rampart/cli/status.go:450— cli.detectHermesPluginStateForHome has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.parseStrictSemver (cognitive 16) REDACTED:678— cli.parseStrictSemver has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.verifyOpenClawExecConfigValue (cognitive 16) cmd/rampart/cli/verify.go:1313— cli.verifyOpenClawExecConfigValue has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
cli.validatePluginVerificationResult (cognitive 16) cmd/rampart/cli/verify.go:1399— cli.validatePluginVerificationResult has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 5, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policyRegistryClient.loadManifest (cognitive 16) cmd/rampart/cli/policy_registry.go:526— policyRegistryClient.loadManifest has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policyRegistryClient.downloadPolicy (cognitive 16) cmd/rampart/cli/policy_registry.go:694— policyRegistryClient.downloadPolicy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
approval.readIdentityKey (cognitive 16) internal/approval/identity.go:59— approval.readIdentityKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13, boolean chains 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.
Store.consumePersistedReplayGrant (cognitive 16) internal/approval/store.go:1413— Store.consumePersistedReplayGrant has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
engine.lintRawYAML (cognitive 16) internal/engine/lint.go:417— engine.lintRawYAML has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.stripUnquotedShellComment (cognitive 16) internal/engine/matcher.go:1018— engine.stripUnquotedShellComment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
engine.redirectWriteTargets (cognitive 16) internal/engine/matcher.go:1133— engine.redirectWriteTargets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), match/switch 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 6). 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.
engine.collectPowerShellEnvAssignment (cognitive 16) internal/engine/matcher.go:2550— engine.collectPowerShellEnvAssignment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 1 (2 pts), 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.
engine.migrateAllowRuleGlobsLocked (cognitive 16) internal/engine/persist.go:197— engine.migrateAllowRuleGlobsLocked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 3 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
policy.EnsureUserOverrideAllow (cognitive 16) internal/policy/user_overrides.go:135— policy.EnsureUserOverrideAllow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (14 pts), loops 1, match/switch 1 (nesting depth added 1). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 161). 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.
policy.validateUserOverridesPolicy (cognitive 16) internal/policy/user_overrides.go:207— policy.validateUserOverridesPolicy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.handleListApprovals (cognitive 16) internal/proxy/approval_handlers.go:107— Server.handleListApprovals has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3, 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.
Server.identify (cognitive 16) internal/proxy/auth.go:74— Server.identify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Server.handleGetAutoAllowed (cognitive 16) internal/proxy/rules_handlers.go:37— Server.handleGetAutoAllowed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
report.hasDenyCoverageForCategory (cognitive 16) internal/report/compliance.go:534— report.hasDenyCoverageForCategory has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
Near-duplicate member pair (59 shared lines) cmd/rampart/cli/mcp.go:77— cmd/rampart/cli/mcp.go:77-260 | cmd/rampart/cli/wrap.go:57-277 — These two members are variants of one another: 59 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
Near-duplicate member pair (22 shared lines) cmd/rampart/cli/mcp.go:301— cmd/rampart/cli/mcp.go:301-334 | cmd/rampart/cli/test_cmd.go:347-389 — These two members are variants of one another: 22 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication· Members sharing a duplicated core (4 members, 50+ identical tokens) · ×1
Members sharing a duplicated core (4 members, 50+ identical tokens) cmd/rampart/cli/setup.go:1716— cmd/rampart/cli/setup.go:1716-1849 | cmd/rampart/cli/setup.go:1853-1923 | cmd/rampart/cli/setup.go:1927-2008 | cmd/rampart/cli/setup.go:2012-2145 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication· Edited copy of a member (76 corresponding lines) · ×1
Edited copy of a member (76 corresponding lines) cmd/rampart/cli/serve_install.go:506— cmd/rampart/cli/serve_install.go:506-581 | cmd/rampart/cli/serve_install.go:583-659 — These two members are one piece of code written twice and then edited apart: 76 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (5 members, 51+ corresponding lines) · ×1
Edited copies of one member (5 members, 51+ corresponding lines) cmd/rampart/cli/verify.go:546— cmd/rampart/cli/verify.go:546-596 | cmd/rampart/cli/verify.go:623-684 | cmd/rampart/cli/verify.go:711-771 | cmd/rampart/cli/verify.go:807-870 | cmd/rampart/cli/verify.go:989-1056 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (44 corresponding lines) · ×1
Edited copy of a member (44 corresponding lines) cmd/rampart/cli/hook_antigravity.go:149— cmd/rampart/cli/hook_antigravity.go:149-192 | cmd/rampart/cli/hook_copilot.go:237-281 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 43+ corresponding lines) · ×1
Edited copies of one member (3 members, 43+ corresponding lines) internal/engine/persist.go:498— internal/engine/persist.go:498-544 | internal/policy/user_overrides.go:71-113 | internal/session/manager.go:140-196 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 43 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 51+ corresponding lines) · ×1
Edited copies of one member (3 members, 51+ corresponding lines) cmd/rampart/cli/setup_antigravity.go:19— cmd/rampart/cli/setup_antigravity.go:19-70 | cmd/rampart/cli/setup_cursor.go:26-76 | cmd/rampart/cli/setup_gemini.go:16-67 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (38 corresponding lines) · ×1
Edited copy of a member (38 corresponding lines) internal/approval/store.go:1597— internal/approval/store.go:1597-1635 | internal/session/manager.go:475-512 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (39 corresponding lines) · ×1
Edited copy of a member (39 corresponding lines) cmd/rampart/cli/setup.go:2239— cmd/rampart/cli/setup.go:2239-2277 | cmd/rampart/cli/setup_codex.go:422-463 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (40 corresponding lines) · ×1
Edited copy of a member (40 corresponding lines) cmd/rampart/cli/setup_codex.go:281— cmd/rampart/cli/setup_codex.go:281-320 | cmd/rampart/cli/setup_gemini.go:194-240 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (29 corresponding lines) · ×1
Edited copy of a member (29 corresponding lines) cmd/rampart/cli/httpclient.go:54— cmd/rampart/cli/httpclient.go:54-88 | REDACTED:1275-1303 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (36 corresponding lines) · ×1
Edited copy of a member (36 corresponding lines) cmd/rampart/cli/setup.go:2279— cmd/rampart/cli/setup.go:2279-2317 | cmd/rampart/cli/setup_codex.go:222-257 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (33 corresponding lines) · ×1
Edited copy of a member (33 corresponding lines) internal/engine/shellparse.go:111— internal/engine/shellparse.go:111-143 | internal/engine/shellparse.go:147-186 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (28 corresponding lines) · ×1
Edited copy of a member (28 corresponding lines) cmd/rampart/cli/audit_helpers.go:330— cmd/rampart/cli/audit_helpers.go:330-362 | internal/report/compliance.go:419-446 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (31 corresponding lines) · ×1
Edited copy of a member (31 corresponding lines) cmd/rampart/cli/serve_uninstall.go:56— cmd/rampart/cli/serve_uninstall.go:56-86 | cmd/rampart/cli/serve_uninstall.go:88-120 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (24 corresponding lines) · ×1
Edited copy of a member (24 corresponding lines) internal/proxy/approval_handlers.go:251— internal/proxy/approval_handlers.go:251-282 | internal/proxy/approval_handlers.go:288-311 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (30 corresponding lines) · ×1
Edited copy of a member (30 corresponding lines) cmd/rampart/cli/setup.go:1289— cmd/rampart/cli/setup.go:1289-1318 | cmd/rampart/cli/setup.go:1320-1377 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 15+ corresponding lines) · ×1
Edited copies of one member (3 members, 15+ corresponding lines) cmd/rampart/cli/setup.go:98— cmd/rampart/cli/setup.go:98-112 | cmd/rampart/cli/setup_codex.go:259-274 | internal/detect/detect.go:152-166 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (26 corresponding lines) · ×1
Edited copy of a member (26 corresponding lines) internal/engine/matcher.go:795— internal/engine/matcher.go:795-820 | internal/engine/matcher.go:1018-1044 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 18+ corresponding lines) · ×1
Edited copies of one member (3 members, 18+ corresponding lines) internal/proxy/server.go:299— internal/proxy/server.go:299-320 | internal/proxy/server.go:323-345 | internal/proxy/server.go:348-365 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (23 corresponding lines) · ×1
Edited copy of a member (23 corresponding lines) cmd/rampart/cli/setup_openclaw_plugin.go:309— cmd/rampart/cli/setup_openclaw_plugin.go:309-332 | cmd/rampart/cli/setup_openclaw_plugin.go:334-356 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 19+ corresponding lines) · ×1
Edited copies of one member (3 members, 19+ corresponding lines) cmd/rampart/cli/approve.go:32— cmd/rampart/cli/approve.go:32-58 | cmd/rampart/cli/approve.go:60-78 | cmd/rampart/cli/approve.go:80-103 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (3 members, 9+ corresponding lines) · ×1
Edited copies of one member (3 members, 9+ corresponding lines) internal/watch/watch.go:268— internal/watch/watch.go:268-276 | internal/watch/watch.go:278-287 | internal/watch/watch.go:289-297 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication· Edited copies of one member (4 members, 13+ corresponding lines) · ×1
Edited copies of one member (4 members, 13+ corresponding lines) cmd/rampart/cli/setup.go:2147— cmd/rampart/cli/setup.go:2147-2162 | cmd/rampart/cli/setup_codex.go:322-334 | cmd/rampart/cli/setup_gemini.go:163-179 | cmd/rampart/cli/setup_gemini.go:242-258 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication· Edited copy of a member (10 corresponding lines) · ×1
Edited copy of a member (10 corresponding lines) cmd/rampart/cli/paths.go:15— cmd/rampart/cli/paths.go:15-24 | cmd/rampart/cli/watch.go:166-175 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (6 corresponding lines) · ×1
Edited copy of a member (6 corresponding lines) cmd/rampart/cli/hook.go:355— cmd/rampart/cli/hook.go:355-361 | cmd/rampart/cli/setup_openclaw_plugin.go:1988-1993 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (9 corresponding lines) · ×1
Edited copy of a member (9 corresponding lines) cmd/rampart/cli/bench.go:853— cmd/rampart/cli/bench.go:853-861 | cmd/rampart/cli/rules.go:664-672 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (7 corresponding lines) · ×1
Edited copy of a member (7 corresponding lines) internal/engine/persist.go:31— internal/engine/persist.go:31-37 | internal/tlsutil/tlsutil.go:40-46 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
Duplicated block (33–37 lines × 2) cmd/rampart/cli/hook.go:960— cmd/rampart/cli/hook.go:960-996 | cmd/rampart/cli/hook.go:1002-1034 — both copies are in the same file, so extract the 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 `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (44 lines × 2) internal/audit/jsonl.go:85— internal/audit/jsonl.go:85-128 | internal/audit/recovery_links.go:44-87 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/audit/jsonl.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.
Duplicated block (29–31 lines × 2) internal/policy/custom.go:135— internal/policy/custom.go:135-165 | internal/policy/user_overrides.go:85-113 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/policy/custom.go:135` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (16–17 lines × 2) internal/engine/dirstore.go:102— internal/engine/dirstore.go:102-118 | internal/engine/dirstore.go:293-308 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/engine/dirstore.go:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (15–16 lines × 3) cmd/rampart/cli/setup.go:1901— cmd/rampart/cli/setup.go:1901-1916 | cmd/rampart/cli/setup.go:1987-2001 | cmd/rampart/cli/setup.go:2124-2138 — 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 `cmd/rampart/cli/setup.go:1901` 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 (16 lines × 2) cmd/rampart/cli/doctor.go:847— cmd/rampart/cli/doctor.go:847-862 | cmd/rampart/cli/doctor.go:877-892 — both copies are in the same file, so extract the 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 (13 lines × 3) internal/proxy/server.go:304— internal/proxy/server.go:304-316 | internal/proxy/server.go:329-341 | internal/proxy/server.go:349-361 — 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 `internal/proxy/server.go:304` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/proxy/server.go:348` calls `Serve` and `internal/proxy/server.go:303` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (4–13 lines × 3) internal/approval/store.go:1193— internal/approval/store.go:1193-1205 | internal/approval/store.go:1266-1278 | internal/approval/store.go:2002-2005 — 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 `internal/approval/store.go:1193` 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–12 lines × 3) cmd/rampart/cli/setup.go:103— cmd/rampart/cli/setup.go:103-112 | cmd/rampart/cli/setup_codex.go:261-272 | internal/detect/detect.go:157-166 — 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 `cmd/rampart/cli/setup.go:103` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Check import visibility before settling on that home: `internal/detect/detect.go` sits under a restricted `internal` directory, which only code inside its own subtree is permitted to import from — so it is reachable from some of these sites and not from others, and being able to see the copies is not the same as being allowed to share them. The home has to be somewhere every one of these sites is permitted to import from; if there is no such place, that restriction may be exactly why the copies are separate.
Duplicated block (10–12 lines × 2) internal/engine/shellparse.go:124— internal/engine/shellparse.go:124-133 | internal/engine/shellparse.go:163-174 — both copies are in the same file, so extract the 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 `internal/engine/shellparse.go:163` 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–11 lines × 3) internal/proxy/eval_handlers.go:197— internal/proxy/eval_handlers.go:197-207 | internal/proxy/eval_handlers.go:333-342 | internal/proxy/eval_handlers.go:365-375 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/proxy/eval_handlers.go:378` calls `applyMonitorToolDecision` and `internal/proxy/eval_handlers.go:208` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (11 lines × 3) internal/report/export.go:143— internal/report/export.go:143-153 | internal/report/export.go:156-166 | internal/report/export.go:169-179 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
Duplicated block (18 lines × 2) internal/watch/format.go:151— internal/watch/format.go:151-168 | internal/watch/format.go:175-192 — both copies are in the same file, so extract the 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 `internal/watch/format.go:151` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
Duplicated block (9–10 lines × 2) internal/engine/dirstore.go:90— internal/engine/dirstore.go:90-99 | internal/engine/dirstore.go:282-290 — both copies are in the same file, so extract the 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 `internal/engine/dirstore.go:90` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (14 lines × 5) cmd/rampart/cli/verify.go:628— cmd/rampart/cli/verify.go:628-642 | cmd/rampart/cli/verify.go:716-729 | cmd/rampart/cli/verify.go:812-827 | cmd/rampart/cli/verify.go:902-918 | cmd/rampart/cli/verify.go:994-1011 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `cmd/rampart/cli/verify.go:628` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
Duplicated block (12 lines × 3) internal/engine/shellparse.go:763— internal/engine/shellparse.go:763-774 | internal/engine/shellparse.go:862-873 | internal/engine/shellparse.go:887-898 — 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 `internal/engine/shellparse.go:763` 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 (17 lines × 2) cmd/rampart/cli/setup_codex.go:286— cmd/rampart/cli/setup_codex.go:286-302 | cmd/rampart/cli/setup_gemini.go:199-215 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
Duplicated block (7 lines × 4) internal/engine/persist.go:530— internal/engine/persist.go:530-536 | internal/policy/custom.go:150-156 | internal/policy/user_overrides.go:99-105 | internal/session/manager.go:182-188 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `internal/engine/persist.go:530` 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 × 5) internal/notify/discord.go:105— internal/notify/discord.go:105-111 | internal/notify/notifier.go:86-92 | internal/notify/openclaw.go:59-65 | internal/notify/slack.go:135-141 | internal/notify/teams.go:110-116 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `internal/notify/discord.go:105` 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.
P12 · CI test-gate honesty· Coverage collected but not gated · ×1
Coverage collected but not gated — CI collects a coverage report but no step enforces a minimum — coverage could halve and CI stays green. Add a step that fails the build when coverage drops below a floor (your coverage tool's minimum-threshold flag, or a coverage-gate action) so the number guards something. What was searched, so you can tell an absence from a miss: this repository's CI files AND its coverage configuration — the well-known coverage and test-runner config files, read at the repository root and inside workspace package directories two levels down, so a floor declared beside the tests rather than in the pipeline is credited — matched against the threshold settings this check knows by name. A floor set in your coverage service's web UI rather than in a committed file, or under a setting whose name is not one of those, is not seen here.
No DR/backup evidence — A persistence guard (data volume / purge-protection) was found, but no backup, geo-recovery or RTO/RPO controls were evidenced — a volume that survives a container recreate is not a tested restore from catastrophic loss.
Type Safety — 0 typed · 15 plain JS — the untyped files are docs-site/assets/search-input.js, internal/plugin/openclaw/approval-regression.mjs, internal/plugin/openclaw/degraded-mode-test.mjs, internal/plugin/openclaw/hooks/rampart/index.js, internal/plugin/openclaw/index.js, internal/plugin/openclaw/provider-surface-replay.mjs (+9 more).
R10 · Code Duplication· Duplicated block with local edits (61 matched lines × 2 locations) · ×1
Duplicated block with local edits (61 matched lines × 2 locations) scripts/compat-copilot-latest.mjs:22— scripts/compat-copilot-latest.mjs:22 · scripts/compat-gemini-latest.mjs:20 — the two spans are one implementation copied and then locally edited — 514 tokens are still identical, in the same order in both files, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Duplicated block (42 lines × 2 locations) scripts/compat-cline-latest.mjs:26— scripts/compat-cline-latest.mjs:26 · scripts/compat-gemini-latest.mjs:25 — the 2 copies sit in sibling files in one directory, so check first whether one of them (or an existing module there) already owns this behaviour and the others should call it; otherwise extract it into one module in that directory and have each site call it.
Duplicated block (18 lines × 2 locations) internal/plugin/openclaw/degraded-mode-test.mjs:3— internal/plugin/openclaw/degraded-mode-test.mjs:3 · internal/plugin/openclaw/tool-alias-test.mjs:3 — the 2 copies are spread across 2 files, and the SHAPE of this repetition could not be determined. It is not a run of declarations, a listing, a declaration header, a type body or a slice through a construct — and it was not measured as a run of executable statements either, so this row cannot tell you whether a function can stand where these lines are. Read the two spans before acting, because the move is opposite in the two cases. Where they are statements, the ordinary answer holds: give the shared part one home and call it from each site. Where they turn out to be declarations, a literal's entries, or the cases of an enumeration, there is no call site to call anything from, and collapsing them would delete what each copy pins — a shared base type, a generated set, or one exported constant each site refers to is the move instead, and sometimes the honest answer is that there is nothing to extract at all. Reported because the copies drift apart the first time only one of them is edited, which is true whichever of those they are.
Duplicated block (15 lines × 3 locations) scripts/compat-cline-latest.mjs:147— scripts/compat-cline-latest.mjs:147 · scripts/compat-copilot-latest.mjs:142 · scripts/compat-gemini-latest.mjs:113 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (13 lines × 2 locations) internal/plugin/openclaw/approval-regression.mjs:14— internal/plugin/openclaw/approval-regression.mjs:14 · internal/plugin/openclaw/degraded-mode-test.mjs:12 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (11 lines × 3 locations) internal/plugin/openclaw/degraded-mode-test.mjs:7— internal/plugin/openclaw/degraded-mode-test.mjs:7 · internal/plugin/openclaw/provider-surface-replay.mjs:15 · internal/plugin/openclaw/tool-alias-test.mjs:7 — the 3 copies are spread across 3 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (10 lines × 2 locations) internal/plugin/openclaw/approval-regression.mjs:41— internal/plugin/openclaw/approval-regression.mjs:41 · internal/plugin/openclaw/smoke-test.mjs:29 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
Duplicated block (9 lines × 2 locations) scripts/compat-gemini-latest.mjs:32— scripts/compat-gemini-latest.mjs:32 · scripts/compat-openclaw-latest.mjs:63 — the 2 copies are spread across 2 files, and the CITED SPAN is not a self-contained block — it runs from inside one construct into the next (the tail of a branch plus the head of the following one, a run of switch arms, the end of a declaration plus the list that follows it) rather than covering a whole unit. So do not lift these lines literally: no call can be substituted for a half-open construct. Extract the enclosing repeated UNIT instead — the whole function, component or branch these lines sit in — and where the repetition IS the construct (a run of switch arms, a stack of near-identical declarations) replace it with one table or registry looked up by key rather than a helper each arm calls. The copies still drift apart the first time only one of them is edited, which is why this is reported.
R10 · Code Duplication· Duplicated block with local edits (5 matched lines × 2 locations) · ×1
Duplicated block with local edits (5 matched lines × 2 locations) internal/plugin/openclaw/tool-alias-test.mjs:47— internal/plugin/openclaw/tool-alias-test.mjs:47 · internal/plugin/openclaw/tool-alias-test.mjs:74 — the two spans are one implementation copied and then locally edited — 55 tokens are still identical, in the same order in both spans, with only local edits between them. The copies have already begun to drift, which is this row's finding: an edit made to one and not the other changes behaviour silently. Diff the two spans first to learn what genuinely differs, then extract the shared core into one module both sites use, passing the differences in as parameters — or, if one copy exists only because the other could not be imported from its context, make one of them the single source the other is generated or re-exported from. If one copy is no longer reachable, delete it rather than letting it shadow the live one.
Complex function checkWithRampart (cyclomatic 39, cognitive 41) internal/plugin/openclaw/index.js:595— checkWithRampart has cyclomatic complexity 39 and cognitive complexity 41; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function evaluateToolCall (cyclomatic 35, cognitive 40) internal/plugin/openclaw/index.js:737— evaluateToolCall has cyclomatic complexity 35 and cognitive complexity 40; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function nativeApprovalDescription (cyclomatic 24, cognitive 20) internal/plugin/openclaw/index.js:44— nativeApprovalDescription has cyclomatic complexity 24 and cognitive complexity 20; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function readControlResponseText (cyclomatic 18, cognitive 29) internal/plugin/openclaw/index.js:513— readControlResponseText has cyclomatic complexity 18 and cognitive complexity 29; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function normalizeToolCall (cyclomatic 18, cognitive 17) internal/plugin/openclaw/index.js:207— normalizeToolCall has cyclomatic complexity 18 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function sameConversation (cyclomatic 14, cognitive 12) internal/plugin/openclaw/index.js:307— sameConversation has cyclomatic complexity 14 and cognitive complexity 12; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function collectApplyPatchPaths (cyclomatic 12, cognitive 17) internal/plugin/openclaw/index.js:141— collectApplyPatchPaths has cyclomatic complexity 12 and cognitive complexity 17; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive is at or above cyclomatic here, so the branching is nested or entangled rather than laid out side by side — extracting each decision into its own named function is the change that pays. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function classifyControlConsequence (cyclomatic 11, cognitive 10) internal/plugin/openclaw/index.js:394— classifyControlConsequence has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function fetchImpl (cyclomatic 11, cognitive 10) internal/plugin/openclaw/provider-surface-replay.mjs:489— fetchImpl has cyclomatic complexity 11 and cognitive complexity 10; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
Complex function policyParamsForTool (cyclomatic 11, cognitive 9) internal/plugin/openclaw/index.js:438— policyParamsForTool has cyclomatic complexity 11 and cognitive complexity 9; this row is raised above a cyclomatic bar of 10. The two numbers answer different questions and the gap between them is what decides whether to act: cyclomatic counts the independent arms through the body, cognitive counts what it costs to hold them in your head, so nesting and mixed boolean chains raise it while a flat run of independent arms does not. Cognitive sits below cyclomatic here, so much of the count is breadth — arms side by side rather than stacked — and splitting per arm would leave a function per arm; group the work between the checks into named steps instead. Measured by this repository's own parse of the file, so a body assembled at runtime, or generated, is counted as written rather than as it executes.
R3 · Large Files· internal/plugin/openclaw/index.js · ×1
internal/plugin/openclaw/index.js: 960 lines of code internal/plugin/openclaw/index.js:1— internal/plugin/openclaw/index.js has 960 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R3 · Large Files· internal/plugin/openclaw/provider-surface-replay.mjs · ×1
internal/plugin/openclaw/provider-surface-replay.mjs: 501 lines of code internal/plugin/openclaw/provider-surface-replay.mjs:1— internal/plugin/openclaw/provider-surface-replay.mjs has 501 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
Duplicated predicate internal/engine/download_exec.go:492— `!word.operator || !strings.HasPrefix(word.value, "<<") || word.value == "<<<"` appears character-identically in 2 files — internal/engine/download_exec.go, internal/engine/pipe_download_exec.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:79— `cfg == nil || strings.TrimSpace(cfg.URL) == ""` appears character-identically in 2 files — REDACTED, internal/webhookaction/webhook.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate internal/proxy/eval_handlers.go:145— `decision.Action == engine.ActionAllow || decision.Action == engine.ActionWatch` appears character-identically in 2 files — internal/proxy/eval_handlers.go, pkg/sdk/engine.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/doctor.go:613— `e.IsDir() || (!strings.HasSuffix(e.Name(), ".yaml") && !strings.HasSuffix(e.Name(), ".yml"))` appears character-identically in 2 files — cmd/rampart/cli/doctor.go, cmd/rampart/cli/status.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/audit.go:517— `entry.IsDir() || !strings.HasSuffix(entry.Name(), ".jsonl")` appears character-identically in 4 files — cmd/rampart/cli/audit.go, cmd/rampart/cli/init_from_audit.go, cmd/rampart/cli/inventory.go, internal/report/compliance.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate internal/notify/discord.go:60— `event.Action == "watch" || event.Action == "log"` appears character-identically in 3 files — internal/notify/discord.go, internal/notify/slack.go, internal/notify/teams.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/audit.go:316— `eventCount > 1 && event.PrevHash != prevHash` appears character-identically in 2 files — cmd/rampart/cli/audit.go, internal/report/compliance.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate internal/engine/engine.go:558— `len(cond.CommandMatches) > 0 || len(cond.CommandContains) > 0` appears character-identically in 2 files — internal/engine/engine.go, internal/engine/matcher.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/setup.go:107— `len(expanded) >= 2 && expanded[0] == '~' && (expanded[1] == '/' || expanded[1] == '\\')` appears character-identically in 3 files — cmd/rampart/cli/setup.go, cmd/rampart/cli/setup_codex.go, internal/detect/detect.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/uninstall.go:401— `len(line) >= len("ExecStart=") && strings.EqualFold(line[:len("ExecStart=")], "ExecStart=")` appears character-identically in 2 files — cmd/rampart/cli/uninstall.go, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/preload.go:54— `mode != "enforce" && mode != "monitor" && mode != "disabled"` appears character-identically in 2 files — cmd/rampart/cli/preload.go, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate REDACTED:910— `name != "rampart" && name != "rampart.exe"` appears character-identically in 2 files — REDACTED, cmd/rampart/cli/uninstall.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/audit_helpers.go:403— `name == "audit-anchor.json" || strings.HasSuffix(name, ".anchor.json")` appears character-identically in 2 files — cmd/rampart/cli/audit_helpers.go, internal/report/compliance.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/serve_install.go:455— `opts.configPath != "" && opts.configPath != "rampart.yaml"` appears character-identically in 2 files — cmd/rampart/cli/serve_install.go, cmd/rampart/cli/test_cmd.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate internal/notify/discord.go:111— `resp.StatusCode < 200 || resp.StatusCode >= 300` appears character-identically in 5 files — internal/notify/discord.go, internal/notify/notifier.go, internal/notify/openclaw.go, internal/notify/slack.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/wrap.go:670— `s.notifyConfig != nil && s.notifyConfig.URL != ""` appears character-identically in 2 files — cmd/rampart/cli/wrap.go, internal/proxy/eval_handlers.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/hook.go:942— `serveURL == "" || !isServeRunning(serveURL)` appears character-identically in 2 files — cmd/rampart/cli/hook.go, cmd/rampart/cli/hook_codex.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/doctor.go:1857— `state.ExecApprovalsPath == "" || state.BashToolsPath == ""` appears character-identically in 3 files — cmd/rampart/cli/doctor.go, cmd/rampart/cli/setup_openclaw_plugin.go, internal/openclaw/hardening/hardening.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate internal/proxy/helpers.go:345— `trimmed == "" || strings.HasPrefix(trimmed, "#")` appears character-identically in 2 files — internal/proxy/helpers.go, internal/report/compliance.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Duplicated predicate cmd/rampart/cli/httpclient.go:60— `u.Scheme != "http" && u.Scheme != "https"` appears character-identically in 2 files — cmd/rampart/cli/httpclient.go, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
Silent fallback default on error cmd/rampart/cli/doctor.go:518— `doctorHookBinary` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/doctor.go:594— `doctorPolicies` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/doctor.go:908— `doctorHooks` turns a non-nil `err` into `return 0, 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/doctor.go:1202— `doctorFileToolPatches` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/doctor.go:1832— `doctorOpenClawApprovalHardening` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/doctor.go:2109— `doctorHermesIntegration` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/hook.go:335— `sessionStateDir` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/inventory.go:285— `collectTodayAuditCounts` turns a non-nil `err` into `return inventoryAuditEventCount{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/rules.go:631— `countStandardRules` turns a non-nil `err` into `return 0` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/serve_state.go:61— `serveExecutableForPID` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/setup_openclaw_plugin.go:1573— `getOpenClawPluginState` turns a non-nil `err` into `return openClawPluginState{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/status.go:444— `detectHermesPluginState` turns a non-nil `err` into `return hermesPluginState{}` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error cmd/rampart/cli/status.go:520— `detectPolicyDefault` turns a non-nil `err` into `return "unknown"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error REDACTED:1379— `detectActiveSystemdService` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error internal/approval/store.go:410— `dedupKey` turns a non-nil `err` into `return ""` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error internal/plugin/hermes/embed.go:27— `Version` turns a non-nil `err` into `return "unknown"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error internal/plugin/openclaw/embed.go:43— `Version` turns a non-nil `err` into `return "unknown"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
Silent fallback default on error internal/report/html.go:460— `generateReportNonce` turns a non-nil `err` into `return "report-fallback-nonce"` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or return it. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the `if` or in the doc comment, and the row stops firing.
D8 · Code Coverage· Tests reach code only in some runs · ×3
Tests reach code only in some runs: REDACTED REDACTED:1242— 2 line(s) (1242-1243) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
Tests reach code only in some runs: internal/engine/engine.go internal/engine/engine.go:1217— 3 line(s) (1217-1219) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
Tests reach code only in some runs: internal/filetxn/context.go internal/filetxn/context.go:45— 4 line(s) (45-46, 59-60) were executed in some of the 3 runs of the suite and not in others. A test that does not take the same path every run only tests the part it always takes, so these lines are not counted as covered. Make the tests that reach them deterministic (a fixed clock, seed or ordering, or waiting on the event instead of on time), or test the paths directly.
Orphaned file scripts/generate-registry.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
Orphaned file cmd/rampart/cli/policy_suggest.go:1— No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
P2 · Observability· Console output used as the logging channel · ×2
Console output used as the logging channel internal/plugin/openclaw/approval-regression.mjs:228— `internal/plugin/openclaw/approval-regression.mjs` reports through `console.*` at line 228 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Console output used as the logging channel internal/plugin/openclaw/provider-surface-replay.mjs:529— `internal/plugin/openclaw/provider-surface-replay.mjs` reports through `console.*` at line 529 although other files in its module log through a logger. Console lines carry no level, fields or correlation and never reach the log pipeline.
Silent fallback default in catch internal/plugin/hermes/__init__.py:240— `_load_hermes_plugin_config` swallows every exception into `return {}` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Silent fallback default in catch scripts/compat-process-env.mjs:61— `credentialFreeURLSetting` swallows every exception into `return ''` — a data error becomes a silent behavior change with no trail. Log the failure or let it raise. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
Subsumed condition operand internal/engine/lint_test.go:119— `strings.Contains(f.Message, "command_match")` can never decide this `&&` — every value satisfying `strings.Contains(f.Message, "command_matches")` also satisfies `strings.Contains(f.Message, "command_match")`, so the `&&` chain is already decided by the former. The expression is equivalent to the chain without it, which means it is narrower than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
Subsumed condition operand internal/engine/matcher.go:2513— `strings.HasPrefix(tok, "--unset=")` can never decide this `||` — every value satisfying `strings.HasPrefix(tok, "--unset=")` also satisfies `strings.HasPrefix(tok, "-")`, so the `||` chain is already decided by the latter. The expression is equivalent to the chain without it, which means it is wider than it reads. Delete the dead operand, or narrow the surviving one if IT is the accident.
No ADRs found cmd/rampart/main.go:14— No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `cmd/rampart/main.go` makes this repository a deployable product (line 14).
D26 · Project Cohesion· Projects may be oversized for their cohesion · ×1
Projects may be oversized for their cohesion go.mod:1— `(repository root)` (66933 LoC, 193 module-visible types across 37 directories) overshoots its size bounds. 1 of 2 build unit(s) (Go, npm) overshoot their size bounds, lowering Project Cohesion to 0.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history)· Rotate the exposed credentials · ×1
D34 · Knowledge Freshness· Orphaned files with no living knowledge · ×1
Orphaned files with no living knowledge — 2 of 157 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 157 of the 193 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: scripts/generate-registry.go, cmd/rampart/cli/policy_suggest.go. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
P3 · Security & performance tooling· Dependabot does not watch npm · ×1
Dependabot does not watch npm REDACTED:7— `REDACTED` schedules updates, but no `package-ecosystem` entry covers `npm`, which this tree depends on — so those dependencies get no update pull requests and no advisory pressure, however complete the dep-scan credit looks. Add the missing entry to the `updates:` list.
No release approval gate .github/workflows/docker.yml:81— The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
Security headers incomplete docs/_headers:1— Set: X-Content-Type-Options. Missing: Content-Security-Policy, Strict-Transport-Security, X-Frame-Options — the four headers that carry the points of this card's security-headers term (Content-Security-Policy, Strict-Transport-Security, X-Content-Type-Options, X-Frame-Options), 0.5 each. (−1.5 on this card.)
X2 · Cancellation propagation· Not all functions that make a request accept a context.Context or an AbortSignal · ×1
Not all functions that make a request accept a context.Context or an AbortSignal — Only 17/21 functions that make a cancellable request (fetch, axios, ky, ofetch, got, undici, node:http; net/http, net.Dial) accept a context.Context or an AbortSignal or pass one on, so a request keeps running after whatever wanted it has given up — a page navigated away from, a cancelled request, a shutdown, an expired deadline. Take a `signal` (Go: `ctx context.Context`) and hand it to the request; where nothing could ever cancel the call, omitting it is a deliberate choice — judge against how the function is used.
Outdated: golang.org/x/sys — `golang.org/x/sys` is required at v0.49.0 in go.mod, but v0.50.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get golang.org/x/sys@v0.50.0 && go mod tidy` and commit the updated go.mod and go.sum.
Appendix B — Reproduction & audit trail
Every external tool invocation behind a deep-scan dimension — the tool, its captured version, the exact command, how many findings it yielded, and a link to the retained raw output. To reproduce any finding: check out the same commit and run the command shown (repo-relative — never an absolute scratch path). The complete raw scanner output is retained verbatim under artifacts/raw/ (indexed in artifacts/raw/index.json); per-invocation exit codes and wall-clock durations are in sidecar.json — kept out of this table so the rendered report stays byte-identical across runs of the same commit.
semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1e551-0368-747f-9d73-04381f550092 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 16 · Warnings: 842 · Recommendations: 66 · Info: 1 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 16-11-2026 @ 17:04 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.