Public report of AIPentest/CyberStrikeAI, published 17 November 2026. It has the same score, grades and number of findings as the full report. The details of security findings (where they are in the code, which known vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive report Measured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.4). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey → Signed and filed in the standard's public register, 17 November 2026, 09:00 UTC · Survey ID cd_f32fd950960d452bb9da68baa065b536

AIPentest/CyberStrikeAI

Measured 17 November 2026, 08:57 UTC, at code version 664de13

Code coverage is not measured: JavaScript/TypeScript suite (CouldNotMeasureTestRunFailed).

Supply-chain provenance & signing is not measured: Supply-chain provenance is not scored (this pipeline releases no artifact), but its build steps or GitHub Actions workflows have integrity defects, or nothing watches its dependency set for published advisories.

CAI score 41.9out of 100 At risk

The score is built from these lenses. Each lens grades one area of the code, such as how easy it is to change or how well it is protected. The weakest lens counts most, so one weak area pulls the score down instead of being averaged away.

A large codebase: 103,810 lines of product code in 4 projects, tests not counted · Estimated rebuild effort: about 1.2 person-years · Weakest lens: Code Health, 24.6

Findings by how serious they are

147 critical 2309 serious 131 minor

20 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.

This survey was produced by

Assert small markCanine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
17 November 2026, 08:57 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.

A critical security finding is open, such as a library with a known critical vulnerability or a password or key found in the code. The score itself is unchanged, but its band shows At risk until the finding is fixed. See the Security and Compliance lens.

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 ▸

71of 71 dimensions measured by tools.
2562of 2587 findings point to an exact file and line, so you can open each one in the code. The other 25 concern the repository as a whole, such as missing documentation.
71dimensions across 8 lenses, read from 103,810 lines of product code in 4 projects.
Chapters

Executive summary

AIPentest/CyberStrikeAI is rated At risk because critical security findings are open, most of them in its code. It scores 41.9 out of 100, which the At risk rating leaves unchanged.

Code Health, at 24.6, is the weakest lens and counts most in the score. The best first steps are simplifying the most tangled functions and splitting the oversized files, each worth about 4.4 points. Raising Code Health to 70 would lift the score to about 56.0.

Forty-two weaknesses in the code could be used by an attacker. Thirteen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with, and thirty-one controls can't be used without a mouse. Fixing the weaknesses the scanner points to, pinning each tool to an exact version and making the controls work with a keyboard would close these risks. Reading outside data into plain values would fix the six places where outside data is turned straight into objects, and updating the vulnerable packages would deal with the three packages with a known security hole. The 21 form fields without a label need a label.

The product code is 103,810 lines, about €170,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 for The 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.
Code Health 24.6 · counts for 45%Production Readiness 47.0 · counts for 25%Accessibility 54.0 · counts for 14%Security and Compliance 70.0 · counts for 8%Performance 70.0 · counts for 4%Maturity 79.3 · counts for 2%Event-Driven 79.3 · counts for 1%Architecture 83.8 · counts for 1%

If Code Health rose from 24.6 to 70, the lowest score rated Strong, the score would rise from 41.9 to about 56.0.

Code composition: what the lines of code are
Product code 77%Tests 23%
Rebuild cost: about €170,000 · Estimate
Cost to rebuild€56,000 to €280,000, for 933 to 2,961 hours of work, about 1.2 person-years for 1 to 3 engineers
Difficulty of the problemHigh, 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 42. 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.
SizeLarge: 103,810 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.

1
Resolve the 40 finding(s) in Cyclomatic Complexity.
Raises the score by about 4.4 points · Medium effort · Cyclomatic Complexity
2
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
Raises the score by about 4.4 points · Medium effort · Large Files
3
Resolve the 1 finding(s) in Type Safety.
Raises the score by about 4.1 points · Medium effort · Type Safety

Diagnosis: what the measurements show together

Each conclusion below combines several dimensions into one point that no single dimension shows, and lists the measurements it rests on.

Where the investment is most exposed · Value at risk
This code would cost about €170,000 to build again, about 1.2 person-years of work. Its weakest lens is Code Health, at 24.6 (Critical). Code Health is about how easy the code is to read and change safely, and code that is hard to read is slow and risky to change, so every future change costs more than it should. Because the weakest lens counts most in the score, work on Code Health also moves the score most.
Based on: the rebuild estimate · the Code Health grade · how much each lens counts
What to do: Start with the Code Health actions in Top priorities.
If you do one thing first · First action
Resolve the 40 finding(s) in Cyclomatic Complexity. Of all the actions in this report, it raises the score most for the work it takes: about 4.4 points for medium effort, because it clears the 40 Cyclomatic Complexity findings. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 4.6 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 8% to 19% on every change. The history of the code shows how much it changes: about 300,333 lines over the last 90 days, which is about 1,218,017 lines a year. At that pace, the extra work comes to an estimated 255.8 to 1534.7 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.

59 modules, with 88 dependencies between them. One loop runs through 5 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 19 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.
uses →1 burp2 cyberstrike-ai/internal/agentruntime3 cyberstrike-ai/internal/authctx4 cyberstrike-ai/internal/logger5 cyberstrike-ai/internal/modelmeta6 cyberstrike-ai/internal/processguard7 cyberstrike-ai/internal/robot/ilink8 cyberstrike-ai/internal/runlease9 cyberstrike-ai/internal/toolguard10 cyberstrike-ai/internal/tooloutput11 cyberstrike-ai/internal/typesafe12 cyberstrike-ai/internal/update13 cyberstrike-ai/internal/workflow/package14 runtime.pi.src.worker15 cyberstrike-ai/internal/config16 runtime.pi.src17 cyberstrike-ai/cmd/server18 cyberstrike-ai/internal/agents19 cyberstrike-ai/internal/mcp20 cyberstrike-ai/internal/openai21 cyberstrike-ai/internal/reasoning22 cyberstrike-ai/internal/robot23 cyberstrike-ai/internal/storage24 cyberstrike-ai/internal/database25 cyberstrike-ai/internal/knowledge26 cyberstrike-ai/internal/vision27 cyberstrike-ai/internal/audit28 cyberstrike-ai/internal/c229 cyberstrike-ai/internal/hitl30 cyberstrike-ai/internal/monitor31 cyberstrike-ai/internal/multiagent32 cyberstrike-ai/internal/project33 cyberstrike-ai/internal/report34 cyberstrike-ai/internal/security35 cyberstrike-ai/internal/workflow36 cyberstrike-ai/internal/agentfinalizer37 cyberstrike-ai/internal/handler38 cyberstrike-ai/internal/agent39 cyberstrike-ai/internal/app40 cyberstrike-ai/internal/attackchain
1 burp
2 cyberstrike-ai/internal/agentruntime
3 cyberstrike-ai/internal/authctx
4 cyberstrike-ai/internal/logger
5 cyberstrike-ai/internal/modelmeta
6 cyberstrike-ai/internal/processguard
7 cyberstrike-ai/internal/robot/ilink
8 cyberstrike-ai/internal/runlease
9 cyberstrike-ai/internal/toolguard
10 cyberstrike-ai/internal/tooloutput
11 cyberstrike-ai/internal/typesafe
12 cyberstrike-ai/internal/update
13 cyberstrike-ai/internal/workflow/package
14 runtime.pi.src.worker
15 cyberstrike-ai/internal/config1
16 runtime.pi.src2
17 cyberstrike-ai/cmd/server21
18 cyberstrike-ai/internal/agents3
19 cyberstrike-ai/internal/mcp34
20 cyberstrike-ai/internal/openai4
21 cyberstrike-ai/internal/reasoning2
22 cyberstrike-ai/internal/robot9
23 cyberstrike-ai/internal/storage5
24 cyberstrike-ai/internal/database51
25 cyberstrike-ai/internal/knowledge1211
26 cyberstrike-ai/internal/vision52
27 cyberstrike-ai/internal/audit24
28 cyberstrike-ai/internal/c214
29 cyberstrike-ai/internal/hitl222
30 cyberstrike-ai/internal/monitor243
31 cyberstrike-ai/internal/multiagent661224
32 cyberstrike-ai/internal/project19
33 cyberstrike-ai/internal/report1
34 cyberstrike-ai/internal/security14433
35 cyberstrike-ai/internal/workflow424
36 cyberstrike-ai/internal/agentfinalizer11
37 cyberstrike-ai/internal/handler211126174172135172131127327
38 cyberstrike-ai/internal/agent4511
39 cyberstrike-ai/internal/app1234113263321
40 cyberstrike-ai/internal/attackchain21123
Uses a module listed above itPart of a loopThe module itself
1 burp2 cyberstrike-ai/internal/agentruntime3 cyberstrike-ai/internal/authctx4 cyberstrike-ai/internal/logger5 cyberstrike-ai/internal/modelmeta6 cyberstrike-ai/internal/processguard7 cyberstrike-ai/internal/robot/ilink8 cyberstrike-ai/internal/runlease9 cyberstrike-ai/internal/toolguard10 cyberstrike-ai/internal/tooloutput11 cyberstrike-ai/internal/typesafe12 cyberstrike-ai/internal/update13 cyberstrike-ai/internal/workflow/package14 runtime.pi.src.worker15 cyberstrike-ai/internal/config16 runtime.pi.src17 cyberstrike-ai/cmd/server18 cyberstrike-ai/internal/agents19 cyberstrike-ai/internal/mcp20 cyberstrike-ai/internal/openai21 cyberstrike-ai/internal/reasoning22 cyberstrike-ai/internal/robot23 cyberstrike-ai/internal/storage24 cyberstrike-ai/internal/database25 cyberstrike-ai/internal/knowledge26 cyberstrike-ai/internal/vision27 cyberstrike-ai/internal/audit28 cyberstrike-ai/internal/c229 cyberstrike-ai/internal/hitl30 cyberstrike-ai/internal/monitor31 cyberstrike-ai/internal/multiagent32 cyberstrike-ai/internal/project33 cyberstrike-ai/internal/report34 cyberstrike-ai/internal/security35 cyberstrike-ai/internal/workflow36 cyberstrike-ai/internal/agentfinalizer37 cyberstrike-ai/internal/handler38 cyberstrike-ai/internal/agent39 cyberstrike-ai/internal/app40 cyberstrike-ai/internal/attackchainburp1cyberstrike-ai/internal/agentruntime2cyberstrike-ai/internal/authctx3cyberstrike-ai/internal/logger4cyberstrike-ai/internal/modelmeta5cyberstrike-ai/internal/processguard6cyberstrike-ai/internal/robot/ilink7cyberstrike-ai/internal/runlease8cyberstrike-ai/internal/toolguard9cyberstrike-ai/internal/tooloutput10cyberstrike-ai/internal/typesafe11cyberstrike-ai/internal/update12cyberstrike-ai/internal/workflow/package13runtime.pi.src.worker14cyberstrike-ai/internal/config15runtime.pi.src16cyberstrike-ai/cmd/server17cyberstrike-ai/internal/agents18cyberstrike-ai/internal/mcp19cyberstrike-ai/internal/openai20cyberstrike-ai/internal/reasoning21cyberstrike-ai/internal/robot22cyberstrike-ai/internal/storage23cyberstrike-ai/internal/database24cyberstrike-ai/internal/knowledge25cyberstrike-ai/internal/vision26cyberstrike-ai/internal/audit27cyberstrike-ai/internal/c228cyberstrike-ai/internal/hitl29cyberstrike-ai/internal/monitor30cyberstrike-ai/internal/multiagent31cyberstrike-ai/internal/project32cyberstrike-ai/internal/report33cyberstrike-ai/internal/security34cyberstrike-ai/internal/workflow35cyberstrike-ai/internal/agentfinalizer36cyberstrike-ai/internal/handler37cyberstrike-ai/internal/agent38cyberstrike-ai/internal/app39cyberstrike-ai/internal/attackchain401221334429551121152241422224366122419114433424112111261741721351721311273274511123411326332121123+19 more modules (most-connected shown)

At a glance — Code Health · 24.6 · Critical · gated by D1, D2, R1, R2, R3 ·

At a glance — Architecture · 83.8 · Adequate · gated by D26 ·

At a glance — Maturity · 79.3 · Strong ·

At a glance — Readiness · 47.0 · Weak · gated by P3 ·

At a glance — Security · 70.0 · Checked 5 of 11 · gated by D29 ·

At a glance — Event-Driven · 79.3 · Strong ·

At a glance — Accessibility · 54.0 · Adequate · gated by AC4 ·

At a glance — Performance · 70.0 · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2025 — Injection94High / Critical
A03:2025 — Software Supply Chain Failures8High / Critical
A07:2025 — Authentication Failures3High / Critical

Roadmap

Top priorities: Resolve the 40 finding(s) in Cyclomatic Complexity; Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package; Resolve the 1 finding(s) in Type Safety.

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

Do thisHelpsEffortDimension
Resolve the 40 finding(s) in Cyclomatic Complexity.+4.4 ptsMediumCyclomatic Complexity
Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.+4.4 ptsMediumLarge Files
Resolve the 1 finding(s) in Type Safety.+4.1 ptsMediumType Safety
Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene.+2.0 ptsLowDependency Hygiene
Add a SAST step to CI running what this repository's stack ships: gosec / govulncheck (or golangci-lint) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+3.0 ptsMediumSecurity & performance tooling
Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.+1.9 ptsMediumKeyboard semantics
Resolve the 57 FileTooLong finding(s) in God Classes — start with config.go (2), agent.go (2), REDACTED (2).+1.7 ptsHighGod Classes
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).+1.6 ptsMediumDR & Backup

File quality

Per-file score 0–10 — a quality signature. Of 277 files carrying findings, judged against the Production bar: 3% slop · 79% mixed · 18% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED0.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED1.4SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.1SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.2SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.0MixedStatic Analysis (SAST): Medium: REDACTED
internal/config/config.go4.2MixedCyclomatic Complexity: config.Load (cyclomatic 24)
REDACTED4.2MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.2MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED
REDACTED4.9MixedStatic Analysis (SAST): Medium: REDACTED

How the grades work

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 — 147

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 — 2309

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 — 131

Recorded, with no effect on how the codebase functions. Present so the survey is complete, not because it needs doing.

Could not be resolved — 20

Something this survey could not settle from the outside, and which could be critical or serious. Either a control was required and no positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean result. These are excluded from the score rather than awarded a pass, so the number on the cover neither rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each one is named under Limitations.

Methodology & how to trust this report

This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 71 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.9, the weighted average across measured dimensions.

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

What we checked — 71 dimensions across the health lenses
D1D2D3D4D5D6D10D11D12D13D14D15D17D19D20D21D24D26D27D28D29D30D34D35D37D43D44AC1AC2AC3AC4AC5AC6AX10AX2AX3AX5AX6AX9ED4M1M2M3M4P1P2P3P5P6P7PF3R1R10R2R3R4R5R6R7R8R9X15X19X2X26X27X28X3X30X4X5

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

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

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Canine Code Analyzer duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic

Every finding is locatable in findings.md. Run 01a1e8ba-110f-7b1d-8936-b9b90ed29d81.

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

Run transparency — what happened this run

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

  • 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 348 test(s) behind this row are the ones the JavaScript/TypeScript census could read, and this repository also carries at least 269 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.
  • D14 License Compliance — 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 repository declares a Go module (REDACTED/go.sum), but the licence verdict published here was taken over its JVM dependencies. Nothing was read about its Go dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D14 License Compliance — 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 repository declares a Python pyproject.toml/requirements.txt (pip/uv/Poetry), but the licence verdict published here was taken over its JVM dependencies. Nothing was read about its Python dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • 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 (24 contributor(s) across 2481 commit(s) sampled, automation and bot accounts excluded). One of them holds 94% of the history; the other 23 hold 0.3% 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.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • 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 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is a COLLECTOR gap, not an environment fault: it declares a published package (REDACTED), but no published-package marker D22 reads admitted any project here, so this ecosystem's public API has no collector, and the remedy is to write one — no change to the scan image can close it.
  • 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. D24 compares a comment's words with the identifiers, literals and constructs of the code it annotates, using English function-word and rationale lexicons. Comments in another script or language were left unread rather than counted as clean.
  • 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.
  • D32 Data Compliance (PII/GDPR) — 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. `web/static/js/chat.js`, `web/static/js/monitor.js`, `web/static/js/webshell.js` produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • AC2 Forms & labels — 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. 101 further occurrence(s) are not listed individually; the score already reflects all 141.
  • AC4 Keyboard semantics — 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. 53 further occurrence(s) are not listed individually; the score already reflects all 93.
  • AXB1 Runtime evidence locked — no reproducible boot — 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. Subject: 45 markup document(s) — HTML, Razor, JSX, Vue, Svelte or server templates. The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These retention controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks retention controls.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These data-subject rights controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks data-subject rights controls.
  • ED5 Idempotency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check decides whether a handler's mutation is safe to re-run by recognising its persistence writes (a database save, a repository write, an event publish) and its guards. Those markers are .NET member names, so in this repository's language a write such as `repository.save(order)` is not recognised and a same-named call on an unrelated library type could be. The handlers were found; their idempotency was neither confirmed nor ruled out.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and this repository's Go, Python 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 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.
  • R10 Code Duplication — 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. 282 further occurrence(s) are not listed individually; the score already reflects all 322.
  • R2 Cyclomatic Complexity — 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. 507 further occurrence(s) are not listed individually; the score already reflects all 547.
  • S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • 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.
  • X10 Duplicated predicate — 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. 19 further occurrence(s) are not listed individually; the score already reflects all 59.
  • 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.
  • X18 Disposal-pattern correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check'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.
  • X24 Document value interpolated into markup unescaped — 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.
  • X24 Document value interpolated into markup unescaped — 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. 430 further occurrence(s) are not listed individually; the score already reflects all 470.
  • 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.
  • X26 Unsynchronised callback handoff — 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 check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X27 Collection changed while being enumerated — 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 check's reader does not cover every language in this repository. The score describes the part it read, which is most of the product; the rest is a gap in this analyzer's language reach.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check'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. 568 further occurrence(s) are not listed individually; the score already reflects all 608.
  • X7 Silent fallback defaults — 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. 7 further occurrence(s) are not listed individually; the score already reflects all 47.

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.
  • 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.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • 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.
  • 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 Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (REDACTED, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AC1 Text alternatives: Alt-text is detected structurally — the scan sees that an alternative EXISTS, not whether it meaningfully describes the image, and decorative-vs-missing is judged by attribute shape; runtime-injected images and a non-role=img decorative svg are out of scope. This is accessibility readiness, never a WCAG conformance claim.
  • AC2 Forms & labels: Label association is read from static markup — a label wired up at runtime (JS-set aria-labelledby, framework-injected ids) reads as missing, a present label says nothing about whether its text is correct. A known UI-library field component (e.g. a JSX <TextField>) is now checked conservatively — flagged only when it carries NO label/aria-label/aria-labelledby/id/name — but wrapper/context-labelled libraries (Chakra/Radix FormControl+FormLabel) aren't statically visible (possible false positive) and non-JSX lowercased components are still skipped. A 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.
  • AC5 ARIA correctness: ARIA correctness is checked against the static role/attribute shape — roles/attributes set dynamically aren't seen, a valid role says nothing about whether it matches the element's real behaviour, and required-state checks are suppressed when a JSX spread could supply them. The two-branch toggle check (a control whose state is conveyed only by which of two mutually exclusive branches renders) reads CONDITIONALS THAT ARE ATTRIBUTES — Vue v-if/v-else/v-show and Alpine x-if/x-show — so the same toggle written as a Svelte {#if} block or a JSX ternary is control flow the markup model never projects as a branch and is not seen at all.
  • 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.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • 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.
  • 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.

Dimensions

D1 · Cyclomatic Complexity2.0 / 10Critical✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

958 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was monitor.handleStreamEvent at 514. A further 10 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 knowledge.renderRetrievalLogs at 28 — 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/database/model_token_usage.go (database.usageInt64 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.

chat.renderProcessDetails::renderOneProcessDetail (cyclomatic 183) · ×2web/static/js/chat.js:4299
chat-files.renderChatFilesTable::rowHtml (cyclomatic 28) · ×2web/static/js/chat-files.js:1029
selectWebshell::ensureDbTableColumns (cyclomatic 16) · ×2web/static/js/webshell.js:3059
monitor.handleStreamEvent (cyclomatic 514)web/static/js/monitor.js:2918
loadConfig (cyclomatic 216)web/static/js/settings.js:790

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

What to do

  1. Bring the 34 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with monitor.handleStreamEvent (cyclomatic 514), loadConfig (cyclomatic 216), monitor.addTimelineItem (cyclomatic 205). — 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 34 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.

D2 · Cognitive Complexity2.0 / 10Critical✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 2.0 / 10 · rule-coverage 100% · ceiling Prevented

1092 method(s) exceeded the cognitive complexity threshold of 15; the worst was handleStreamEvent at 777.

chat-files.renderChatFilesTable::rowHtml (cognitive 28) · ×2web/static/js/chat-files.js:1029
handleStreamEvent (cognitive 777)web/static/js/monitor.js:2918
AgentHandler.createProgressCallback (cognitive 464)internal/handler/agent.go:1025
runWebshellAiSend::(anonymous)::processChunk (cognitive 403)web/static/js/webshell.js:3544
refreshWebshellUIOnLanguageChange (cognitive 276)web/static/js/webshell.js:5031

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

What to do

  1. Bring the 58 bodies over 60 down to 60 or less in Cognitive Complexity — start with handleStreamEvent (cognitive 777), AgentHandler.createProgressCallback (cognitive 464), runWebshellAiSend::(anonymous)::processChunk (cognitive 403). — 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 58 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.

D3 · God Classes5.8 / 10Adequate✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 5.8 / 10 · rule-coverage 100% · ceiling Prevented

158 god class(es) detected.

FileTooLong: js/chat.js · ×57web/static/js/chat.js
FunctionTooLong: webshell.selectWebshell · ×41web/static/js/webshell.js:2446
MethodTooLong: OpenAPIHandler.GetOpenAPISpec · ×25internal/handler/openapi.go:31
ClassTooLong: OpenAPIHandler · ×18internal/handler/openapi.go:13
TooManyMethods: DB · ×11REDACTED:55

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

What to do

  1. Resolve the 57 FileTooLong finding(s) in God Classes — start with config.go (2), agent.go (2), REDACTED (2). — One of this dimension's main actionable groups (57 warning-level).
  2. Resolve the 41 FunctionTooLong finding(s) in God Classes — start with chat.js (8), webshell.js (6), REDACTED (4). — One of this dimension's main actionable groups (41 warning-level).
  3. Resolve the 25 MethodTooLong finding(s) in God Classes — start with config.go (3), executor.go (2), openapi.go. — One of this dimension's main actionable groups (25 warning-level).

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

D4 · Code Duplication5.2 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 5.2 / 10 · rule-coverage 100% · ceiling Verified

291 duplicated block group(s) detected. 12.0 % of the production lines (12,507 of 103,810) are in a reported copy. A further 166 rows report members as variants of one another; the share counts each copied line once, however many rows cite it. 1 of the 457 are in trees this repository does not ship — vendored, example/demo, project-template, fixture and benchmark code — and are ranked below the shipped groups rather than excluded from them: the duplication there is real and is still counted in this dimension's score. The dimensions that publish a production-file census leave those trees out of theirs, so this count is deliberately drawn over the wider population.

Duplicated block (9 lines × 2) · ×22internal/app/asset_tools.go:383
Duplicated block (10 lines × 2) · ×20internal/c2/listener_tcp.go:255
Duplicated block (8 lines × 2) · ×17internal/config/config.go:1808
Duplicated block (7 lines × 2) · ×17internal/app/mcp_authorization.go:33
Duplicated block (11 lines × 2) · ×16REDACTED:228

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

What to do

  1. Resolve the 22 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with agent.go (2), REDACTED (2), asset_tools.go. — One of this dimension's main actionable groups (22 warning-level).
  2. Resolve the 20 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with REDACTED (3), REDACTED (2), REDACTED (2). — One of this dimension's main actionable groups (20 warning-level).
  3. Resolve the 17 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with config.go (2), multi_agent.go (2), manager.go (2). — One of this dimension's main actionable groups (17 warning-level).

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

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

4 production modules (Gradle+Maven+npm+Go), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; edges a convention plugin adds from buildSrc or build-logic are not visible there; 0 module(s) off the main sequence, with abstractness counted on 3 of the 4 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

D6 · Cohesion (LCOM4)9.4 / 10Stronggated by 6 serious findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.4 / 10 · rule-coverage 100% · ceiling Verified

6 of 116 classes have LCOM4 above 3.

Low cohesion: DB (LCOM4 150) · ×6REDACTED:55

What to do

  1. Resolve the 6 Low cohesion finding(s) in Cohesion (LCOM4) — start with config.go (4), REDACTED, vision.go. — One of this dimension's main actionable groups (6 warning-level).

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

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 skipped, 0 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 348 tests. Measured on the JavaScript/TypeScript suite only — at least 269 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.

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 flaky across 2 measured tier(s). JavaScript/TypeScript (node:test via `npm ci --ignore-scripts` in runtime/pi/ (2 tests)): measured (0 flaky); Go (cyberstrike-ai): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene9.1 8.7 / 10Strong✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.7 / 10 · rule-coverage 96% · ceiling Verified

13 outdated, 0 author-deprecated direct Go module(s), 1 pinning or checksum defect(s). 23 of 23 direct requirement(s) were graded against proxy.golang.org (0 not served there, 1 publishing no tagged release to be behind). Whether any of these modules is UNMAINTAINED is not graded — proxy.golang.org publishes no maintenance status, and release age does not stand in for one. Whether any is UNUSED is not graded either: that is a source question, not a registry one. Known CVEs in this module graph are D30's question, read from REDACTED and go.sum there.

Dependency pinned to a stale untagged commit: github.com/skip2/go-qrcode
Outdated: github.com/bytedance/sonic · ×13

What to do

  1. Resolve the 1 Dependency pinned to a stale untagged commit finding(s) in Dependency Hygiene. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

D14 · License Compliance10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Verified

0 of 2 declared JVM dependency artifact(s) use a banned license. Licences were resolved from the POMs Maven Central publishes, over the coordinates this repository's 2 Maven/Gradle manifest(s) declare with a version resolvable from the manifest itself — the same declaration-site closure this analysis reads for dependency currency. The JVM has no lockfile a checkout is guaranteed to carry, so this is deliberately NOT the transitive closure. ★ COVERAGE OF THIS VERDICT: it grades this repository's JVM dependencies and nothing else. The repository also declares a Go module (REDACTED/go.sum) and a Python pyproject.toml/requirements.txt (pip/uv/Poetry), and the licences of those dependency graphs were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots8.0 / 10Strong✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 8.0 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: web/static/js/monitor.js (15×514=7710); web/static/js/chat.js (17×291=4947); web/static/js/settings.js (14×205=2870) Repeated repair below the complexity floor: REDACTED (32 of 62 changes were fixes); internal/update/update.go (3 of 5 changes were fixes); internal/update/build.go (3 of 4 changes were fixes)

Hotspot: web/static/js/monitor.js · ×50web/static/js/monitor.js:2918
Repeated repair: REDACTED · ×3REDACTED:5902

What to do

  1. Resolve the 50 Hotspot finding(s) in Churn × Complexity Hotspots — start with config.go (2), REDACTED (2), monitor.js. — One of this dimension's main actionable groups (50 warning-level).
  2. Resolve the 3 Repeated repair finding(s) in Churn × Complexity Hotspots — start with REDACTED, update.go, build.go. — One of this dimension's main actionable groups (3 warning-level).

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

D17 · Explicit Debt10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Prevented

0 deducted task-comment markers across 103810 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.

✓ On the Gold path — maintain.

Detailed fixes: d17_recommendation.md.

D19 · Documentation Quality10.0 / 10Exemplary○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

2 of 2 documentation facets pass in full. 99 document(s) read across 47 unit(s).

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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.

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

No architecture decision records were found.

No ADRs foundplugins/burp-suite/cyberstrikeai-burp-extension/pom.xml:36

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality — start with pom.xml. — One of this dimension's main actionable groups (1 recommendation-level).

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

D21 · Naming Consistency8.6 / 10Strong✓ Tool-verified

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

Method: Seven vocabulary-free rules (N1-N7) mine each naming convention from the repository and flag a name that breaks a convention its structural peers in the same unit follow; production C# and TypeScript, each its own population. Deterministic, no model, no sample. Advisory.

Maturity: Documented → Verified → Prevented · effective 8.6 / 10 · rule-coverage 100% · ceiling Verified

12 naming inconsistencies among 866 declarations measured against a convention their peers follow.

`HandleWecomGET` spells `GET` where 12 names in the project spell it `Get`REDACTED:1413
`handleQQGroupATMessage` spells `AT` where 130 names in the project spell it `At`internal/robot/qq.go:142
`ResolveSKILLPath` spells `SKILL` where 30 names in the project spell it `Skill`internal/skillpackage/layout.go:16
`applyRBACToUI` spells `RBAC` where 72 names in the project spell it `Rbac`web/static/js/auth.js:557
`chatFilesIDDisplay` spells `ID` where 421 names in the project spell it `Id`web/static/js/chat-files.js:851

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

What to do

  1. Resolve the 1 `HandleWecomGET` spells `GET` where 12 names in the project spell it… finding(s) in Naming Consistency — start with REDACTED. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `handleQQGroupATMessage` spells `AT` where 130 names in the project… finding(s) in Naming Consistency — start with qq.go. — One of this dimension's main actionable groups (1 recommendation-level).
  3. Resolve the 1 `ResolveSKILLPath` spells `SKILL` where 30 names in the project spell it… finding(s) in Naming Consistency — start with layout.go. — One of this dimension's main actionable groups (1 recommendation-level).

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

D24 · Comment Value10.0 0.4 / 10Critical○ Nothing flagged

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.

Maturity: Documented → Verified → Prevented · effective 0.4 / 10 · rule-coverage 4% · ceiling Documented

0 of 96 judged comments only repeat the code they sit on (0.0 %). 2389 comment(s) in another language or script were not judged.

Detailed fixes: d24_recommendation.md.

D26 · Project Cohesion3.3 / 10Weak✓ Tool-verified

What it measures: Whether each project is a focused, coherent unit rather than an oversized grab-bag.

Method: Project size overshoot penalties (LoC / public-type count / namespace count, 2-of-3 flag) weighted by log magnitude. Exhaustive across projects, deterministic.

Maturity: Documented → Verified → Prevented · effective 3.3 / 10 · rule-coverage 100% · ceiling Documented

1 of 3 build units (Go, Maven, npm) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesionREDACTED:1

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with REDACTED. — 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.

D27 · Navigability9.1 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 9.1 / 10 · rule-coverage 100% · ceiling Documented

42 % of calls cross a namespace and 0 % go through an interface, but 56 % of collaborators are co-located — so following a call takes several hops. Baseline: small — navigation cost is tolerated.

Scattered collaborators

✓ On the Gold path — maintain.

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

D28 · Secrets (history)8.0 / 10Adequategated by 2 critical findings✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 8.0 / 10 · rule-coverage 100% · ceiling Documented

2 finding(s): 0 critical, 2 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

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

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

D29 · Static Analysis (SAST)0.0 / 10Critical✓ Tool-verified

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

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

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

Maturity: Documented → Verified → Prevented · effective 0.0 / 10 · rule-coverage 100% · ceiling Documented

97 finding(s): 0 critical, 65 high, 21 medium, 11 low. 13 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 78 file(s) — `tools/amass.yaml`, `tools/angr.yaml`, `tools/api-schema-analyzer.yaml`, `tools/arjun.yaml`, `tools/arp-scan.yaml`, … (+73 more) — so no absence of findings in them is evidence of anything, and nothing in them was analysed. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 37 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (16), REDACTED (7), REDACTED (3). — One of this dimension's main actionable groups (37 issue-level).
  2. Resolve the 6 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (6 issue-level).
  3. No action in Static Analysis (SAST) — all 13 REDACTED finding(s) are reported here at file:line but scored by D36 (supply-chain provenance), so none is charged to this dimension. — One of this dimension's main actionable groups (13 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities6.7 / 10Adequate✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 6.7 / 10 · rule-coverage 100% · ceiling Documented

8 finding(s): 1 critical, 2 high, 4 medium, 1 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 2 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  2. Resolve the 1 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  3. Resolve the 4 Medium CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (4). — One of this dimension's main actionable groups (4 warning-level).

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

D34 · Knowledge Freshness10.0 / 10Exemplary✓ Tool-verified

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

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

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Every significant source file has living knowledge — recently and meaningfully worked. Counted over 265 of the 404 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling10.0 / 10Stronggated by 2 serious findings✓ Tool-verified

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

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

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. 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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: chat.js↔i18n.js 80%; i18n.js↔monitor.js 50%

Change coupling: chat.js ↔ i18n.js · ×2web/static/js/chat.js:1

What to do

  1. Resolve the 2 Change coupling finding(s) in Change Coupling — start with chat.js, i18n.js. — One of this dimension's main actionable groups (2 warning-level).

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

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

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

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

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

D43 · Malicious Dependencies10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

No dependency in any ecosystem this repository declares is published as malicious.

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

D44 · Platform End-of-Life10.0 / 10Exemplary✓ Tool-verified

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.

Maturity: Documented → Verified → Prevented · effective 10.0 / 10 · rule-coverage 100% · ceiling Documented

0 end-of-life runtime(s) and 0 end-of-life framework(s), read from 3 platform declaration(s) and 13 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.

Frontend & cross-cutting dimensions

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

AC1 · Text alternatives10.0 / 10Exemplary○ Nothing flagged

Other · Accessibility — Whether non-text content carries a text alternative — img/area/input[type=image] have alt, a meaningful svg has a title or aria-label, video has a captions track, and object/embed/canvas have a name or fallback content. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: every img/area/input[type=image] checked for alt, svg[role=img] for a title/aria-label, video for a captions <track>. Components skipped, spreads suppressed. Deterministic, hard fact per element.

Coverage: Population: image/media elements — img, area, input[type=image], svg, video, object, embed, canvas — across the PARSED MARKUP files only (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx); components, hidden subtrees and dynamic-attribute elements are skipped. Markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is NOT read by any producer, so it contributes no element to this population; where such a frontend is present the card discloses it as an analyzer gap rather than scoring around it.

AC2 · Forms & labels5.7 / 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. (×7) — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.html:83, web/static/js/api-docs.js:544, web/static/js/c2.js:1039, …
  • This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id. (×17) — web/static/js/api-docs.js:543, web/static/js/audit.js:391, web/static/js/c2.js:1038, …
  • A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one). — web/static/js/attack-chain-context.js:96
  • This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it. (×14) — web/static/js/audit.js:392, web/static/js/c2.js:1043, web/static/js/c2.js:1053, …
  • This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label. — web/static/js/audit.js:858

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.
AC3 · Page structure6.8 / 10Adequate✓ Tool-verified

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.

  • A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>. — plugins/browser-extension/cyberstrikeai-browser-extension/popup/popup.html:2
  • No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>. (×2) — plugins/browser-extension/cyberstrikeai-browser-extension/popup/popup.html:2, web/templates/api-docs.html:2
  • Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one. (×3) — web/templates/api-docs.html:1059, REDACTED:3738, REDACTED:4996
  • A document must expose only one main landmark. Multiple visible <main> (or role="main") elements confuse the landmark map and the "skip to content" target. Keep one; remove or hide the rest. — REDACTED:2
  • With more than one navigation landmark, each needs an aria-label/aria-labelledby (e.g. "Primary", "Footer") so assistive tech can tell them apart. At least one nav here is unlabelled. — REDACTED:2
  • An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative. (×2) — REDACTED:6445, REDACTED:6453

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.
AC4 · Keyboard semantics2.8 / 10Weak✓ Tool-verified

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 click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler. (×15) — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:322, plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:379, web/static/js/audit.js:699, …
  • This <li> announces itself as a role="option" and binds a click, but nothing can put focus on it: no tabindex="0" in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabindex="0"="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="option" or point aria-activedescendant at it. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:812
  • This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. — web/static/js/audit-datetime-picker.js:118
  • A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0". (×14) — web/static/js/chat.js:5974, web/static/js/chat.js:9223, web/static/js/settings.js:1445, …
  • This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close. (×3) — web/static/js/chat.js:10470, web/static/js/projects.js:2901, web/static/js/rbac.js:699
  • This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabindex="0" in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabindex="0"="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it. (×2) — web/static/js/monitor.js:7147, REDACTED:98
  • An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action. (×4) — REDACTED:597, REDACTED:758, REDACTED:820, …

What to do

  • Make custom controls keyboard-operable (role + tabindex + key handler), drop positive tabindex, and give anchors a real href.
AC5 · ARIA correctness8.0 / 10Strong✓ Tool-verified

Other · Accessibility — Whether ARIA is used correctly — valid non-abstract roles, the ARIA state a role requires, valid (non-misspelled) aria-* attribute names, in-enum values for token-typed aria-* attributes, and no aria-hidden on (or wrapping) a focusable element. Static markup readiness, not a WCAG conformance claim.

Method: Static markup-model scan: role values checked against the WAI-ARIA role set (abstract/invalid flagged), required ARIA state for a role, and aria-hidden on a focusable element. Deterministic, role/attribute level.

Coverage: Population: elements in the PARSED MARKUP files (.html/.htm/.cshtml/.razor/.vue/.svelte/.jsx/.tsx) that carry a role or an aria-* attribute; roles and token values are checked against the ARIA enums exhaustively within that set. An expression-valued (dynamic) role or aria-* value is skipped rather than guessed, and markup built in script — tagged-template (html`…`) UIs and hyperscript DOM factories — is not read at all.

  • A plain <span> has the implicit role "generic", which supports no ARIA states, so this aria-expanded is dropped and assistive tech is never told the state at all. Put aria-expanded on the element that owns the behaviour (the button or control the user operates), or give this <span> a role that supports aria-expanded. — web/static/js/chat.js:1401

What to do

  • Use valid, non-abstract roles, supply the ARIA state each role requires, and never put aria-hidden on a focusable element.
AC6 · Visual & motion safety5.4 / 10Adequate✓ Tool-verified

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.

  • The inline foreground/background colours fall below the 4.5:1 WCAG AA minimum for normal text. Darken/lighten one of them. — REDACTED:511
  • `.auth-info-body` moves (`animation: slideDown 0.2s ease`) 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. — web/templates/api-docs.html:100
  • `.description-toggle-icon` moves (`transition: transform 0.2s ease`) 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. — web/templates/api-docs.html:471
  • `.api-description-detail` moves (`animation: slideDown 0.2s ease`) 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. — web/templates/api-docs.html:478
  • `.loading-spinner` moves (`animation: spin 0.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. — web/templates/api-docs.html:814
  • `.api-method.post` sets color: white on background-color: #49cc90 — 2.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:214
  • `.api-method.get` sets color: white on background-color: #61affe — 2.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:219
  • `.api-method.put` sets color: white on background-color: #fca130 — 2.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:224
  • `.api-method.delete` sets color: white on background-color: #f93e3e — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:229
  • `.api-test-btn.copy-curl` sets color: white on background-color: #ffc107 — 1.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:713
  • `.api-test-btn.clear-result` sets color: white on background-color: #ff6b6b — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/templates/api-docs.html:732
  • `.c2-listener-card-actions .btn-primary, .c2-payload-card .btn-primary, .c2-modal-footer .btn-primary` sets color: #fff on background-color: #60a5fa — 2.5:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:507
  • `.c2-file-table th` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:1773
  • `.c2-tasks-stat` sets color: #6b778a on background-color: #131a27 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:2092
  • `.c2-tasks-time-preset-btn` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:2141
  • `.c2-status-badge.queued` sets color: #64748b on background-color: #f1f5f9 — 4.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:2442
  • `.c2-status-badge.cancelled` sets color: #94a3b8 on background-color: #f1f5f9 — 2.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:2447
  • `.c2-events-stat` sets color: #6b778a on background-color: #131a27 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:2955
  • `.c2-events-time-preset-btn` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — web/static/css/c2.css:3004
  • `.btn--primary` sets color: #fff on background-color: #ea580c — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:359
  • `.tab.active` sets color: #ea580c on background-color: #ffffff — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:738
  • `.pane-title` sets color: #6b7280 on background-color: #2a2f38 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:776
  • `.tool-guard-page .tool-guard-rule-summary:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible. — web/static/css/tool-guard.css:154
  • `.c2-form-select-caret` moves (`transition: transform 0.15s ease`) 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. — web/static/css/c2.css:412
  • `.c2-session-item` moves (`transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease`) 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. — web/static/css/c2.css:1203
  • `.c2-session-live-dot.active` moves (`animation: c2-pulse-dot 2.2s ease-in-out 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. — web/static/css/c2.css:1275
  • `.c2-file-upload-progress-fill` moves (`transition: width 0.2s ease`) 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. — web/static/css/c2.css:1752
  • `.c2-modal` moves (`animation: c2-slide-up 0.18s ease-out`) 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. — web/static/css/c2.css:4098
  • `.agent-plan-task-status--in_progress` moves (`animation: agent-plan-spin 820ms 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. — web/static/css/chat-plan-progress.css:160
  • `html body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal)` moves (`animation: app-panel-in .18s ease-out`) 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. — web/static/css/design-system.css:103
  • `.m-tab` moves (`transition: color 0.16s ease, transform 0.16s ease`) 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. — web/static/css/mobile.css:545
  • `.modal-content` moves (`animation: m-sheet-up 0.26s var(--m-ease)`) 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. — web/static/css/mobile.css:933
  • `.m-chat-bar-btn` moves (`transition: transform 0.12s var(--m-ease), background 0.15s`) 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. — web/static/css/mobile.css:1285
  • `.m-tab` moves (`transition: transform 0.12s ease, background-color 0.12s ease, color 0.16s ease, opacity 0.12s ease`) 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. — web/static/css/mobile.css:3277
  • `.btn` moves (`transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s`) 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. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:351
  • `.cs-select-caret` moves (`transition: transform 0.15s ease`) 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. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:920

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.
AX10 · Code composition5.6 / 10Adequate✓ Tool-verified

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.

AX2 · Stateful singletons10.0 / 10Exemplary✓ Tool-verified

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.

AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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.

AX5 · Architecture & structure10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether the codebase has a recognisable, scale-appropriate structure (a named architectural style, or modular enough for its size) rather than being an ad-hoc ball of mud.

Method: Roslyn plus csproj analysis: architecture style detection (DDD, clean, vertical-slice, CQRS) and structure fitness for repo size. Deterministic.

AX6 · Interface segregation10.0 / 10Exemplary✓ Tool-verified

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.

AX9 · CQS / query purity10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether read (query) handlers stay side-effect-free — a query that writes persistent state or raises events breaks CQS and makes reads unsafe to retry, cache, or route to a read replica.

Method: Roslyn scan: CQRS handlers classified query-vs-command by interface (IQueryHandler/ICommandHandler/IRequestHandler<TQuery,TResult>) and name convention (*Query/Get*/Find* vs *Command); each query handler's body checked for persistent-state writes (SaveChanges/repository Add-Update) or event publishes by resolved invocation. Deterministic, type-level, exhaustive over the detected handlers.

Coverage: Population: CQRS handlers identified by IQueryHandler/ICommandHandler/IRequestHandler interface + *Query/Get*/Find*/*Command NAME convention; query purity then checked exhaustively within that set — a query handler using neither convention is invisible, and mutation is a resolved persistence/publish CALL, not full dataflow.

ED4 · Outbox / dual-write7.9 / 10Strong✓ Tool-verified

Other · Event-Driven — Whether state changes and message publishes are atomic (a transactional outbox) rather than a crash-unsafe dual write.

Method: Roslyn semantic scan (event-driven gated): event-handler methods scanned for DB-save plus bus-publish without a transactional outbox reference. Deterministic, semantic-resolved.

  • `AgentHandler.executeOneBatchSubTask` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem). — internal/handler/batch_queue_executor.go:113
  • `AgentHandler.MultiAgentLoopStream` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem). — internal/handler/multi_agent.go:23
  • `AgentHandler.SingleAgentLoopStream` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem). — internal/handler/single_agent.go:22

What to do

  • Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
M1 · Documentation (README)9.0 / 10Exemplary✓ Tool-verified

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.

M2 · Architecture documentation5.0 / 10Adequate✓ Tool-verified

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

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

  • No Architecture Decision Records found — no conventional ADR directory, no 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.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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.

M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

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.

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

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

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

P2 · Observability5.5 / 10Adequate✓ Tool-verified

Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.

Method: Filesystem/Roslyn scan: structured-logging frameworks (Serilog, NLog), OpenTelemetry, and health-check endpoint patterns. Exhaustive, deterministic.

  • Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.

What to do

  • Extend structured logging to the remaining runnable modules so everything you run is diagnosable in production.
  • Add a health-check endpoint (@godaddy/terminus or a /health route) so orchestrators and load balancers can probe liveness/readiness.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add gosec / govulncheck (or golangci-lint) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 5 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:5
  • `runtime/pi/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`. — runtime/pi/package.json:12

What to do

  • Add a SAST step to CI running what this repository's stack ships: gosec / govulncheck (or golangci-lint) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
  • Enable Dependabot/Renovate or a dependency-review gate.
  • Add gitleaks/trufflehog in CI to block PRs that introduce committed secrets.
P5 · DR & Backup4.0 / 10Weak✓ 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.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
P6 · Release Hygiene8.0 / 10Strong✓ Tool-verified

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

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

  • The changelog this check read carries 1 versioned entry, against a bar of 3. Counted as either the distinct `x.y.z` versions it names (a link's target is not counted) or its version-shaped section headings (`## [1.2.0]`, `## V14.x.x`, `## Updates in 8.0.x`), whichever is the larger — so a log sectioned by minor series counts its sections, not its individual patch numbers. Entries recorded somewhere this check does not read — release notes generated at tag time from a generator config it did not recognise, or a log kept outside the repository — are not counted here, and this row is about what is re-findable in the tree rather than about how often you release.

What to do

  • Keep the changelog current — add a versioned entry (Keep-a-Changelog ## [x.y.z]) for each release so the history isn't a stub.
P7 · Outbound HTTP resilience10.0 / 10Exemplary○ Nothing flagged

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.

PF3 · Async & latency hygiene7.0 / 10Strong✓ Tool-verified

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.

  • `fs.writeFileSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/check-ui-design-system.cjs:360
  • `writeFileSync` in `exports` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs. — scripts/ui-realistic-scenarios.cjs:276

What to do

  • TypeScript/JavaScript: use the promise APIs (fs/promises, a promisified child_process.execFile, the async zlib/crypto functions) and await them instead of the *Sync variants.
R1 · Type Safety0.3 / 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.

  • 4 typed · 117 plain JS — the untyped files are plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js, plugins/browser-extension/cyberstrikeai-browser-extension/devtools.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/auth-session.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/capture.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/catalog-cache.js (+111 more).
R10 · Code Duplication5.6 / 10Adequate✓ Tool-verified

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.

  • web/static/js/projects.js:83 · web/static/js/workflows.js:628 — the two spans are one implementation copied and then locally edited — 962 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. — web/static/js/projects.js:83
  • web/static/js/c2.js:3348 · web/static/js/c2.js:3975 — 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. — web/static/js/c2.js:3348
  • web/static/js/audit.js:795 · web/static/js/webshell.js:677 — the two spans are one implementation copied and then locally edited — 528 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. — web/static/js/audit.js:795
  • web/static/js/chat-files.js:1765 · web/static/js/chat.js:2625 — the two spans are one implementation copied and then locally edited — 462 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. — web/static/js/chat-files.js:1765
  • web/static/js/settings.js:2192 · web/static/js/settings.js:4185 — all 2 copies are in the same file, 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. — web/static/js/settings.js:2192
  • web/static/js/rbac.js:1227 · web/static/js/rbac.js:1349 — the two spans are one implementation copied and then locally edited — 398 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. — web/static/js/rbac.js:1227
  • web/static/js/c2.js:3217 · web/static/js/c2.js:4155 — 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. — web/static/js/c2.js:3217
  • scripts/mobile-shot.mjs:17 · scripts/mobile-tap-audit.mjs:25 — the two spans are one implementation copied and then locally edited — 530 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/mobile-shot.mjs:17
  • web/static/js/webshell.js:2404 · web/static/js/webshell.js:3340 — 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. — web/static/js/webshell.js:2404
  • web/static/js/monitor.js:7377 · web/static/js/monitor.js:7611 — 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. — web/static/js/monitor.js:7377
  • web/static/js/info-collect.js:495 · web/static/js/settings.js:244 — the two spans are one implementation copied and then locally edited — 353 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. — web/static/js/info-collect.js:495
  • web/static/js/c2.js:3308 · web/static/js/c2.js:4251 — all 2 copies are in the same file, 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. — web/static/js/c2.js:3308
  • web/static/js/mobile-ui.js:297 · web/static/js/mobile-ui.js:1024 — the two spans are one implementation copied and then locally edited — 295 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. — web/static/js/mobile-ui.js:297
  • web/static/js/tasks.js:2548 · web/static/js/tasks.js:2616 — 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. — web/static/js/tasks.js:2548
  • web/static/js/chat.js:9827 · web/static/js/projects.js:464 — 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. — web/static/js/chat.js:9827
  • REDACTED:1543 · REDACTED:2029 — all 2 copies are in the same file, 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. — REDACTED:1543
  • web/static/js/chat.js:9193 · web/static/js/workflows.js:419 — 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. — web/static/js/chat.js:9193
  • web/static/js/roles.js:139 · web/static/js/webshell.js:769 — 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. — web/static/js/roles.js:139
  • web/static/js/chat.js:1276 · web/static/js/chat.js:1309 — 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. — web/static/js/chat.js:1276
  • web/static/js/chat.js:4265 · web/static/js/monitor.js:2730 — 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. — web/static/js/chat.js:4265
  • web/static/js/chat.js:9860 · web/static/js/projects.js:497 — 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. — web/static/js/chat.js:9860
  • web/static/js/roles.js:1323 · web/static/js/roles.js:1435 — all 2 copies are in the same file, 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. — web/static/js/roles.js:1323
  • web/static/js/tasks.js:2004 · web/static/js/tasks.js:2035 · web/static/js/tasks.js:2066 — all 3 copies are in the same file, 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. — web/static/js/tasks.js:2004
  • web/static/js/tasks.js:2596 · web/static/js/tasks.js:2661 — 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. — web/static/js/tasks.js:2596
  • web/static/js/monitor.js:2802 · web/static/js/monitor.js:2828 — 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. — web/static/js/monitor.js:2802
  • web/static/js/settings.js:3058 · web/static/js/settings.js:3119 — 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. — web/static/js/settings.js:3058
  • web/static/js/settings.js:3480 · web/static/js/settings.js:3506 · web/static/js/settings.js:3532 · web/static/js/settings.js:3558 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. — web/static/js/settings.js:3480
  • web/static/js/chat.js:283 · web/static/js/settings.js:257 — 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. — web/static/js/chat.js:283
  • web/static/js/chat.js:7802 · web/static/js/chat.js:7847 · web/static/js/chat.js:7902 — all 3 copies are in the same file, 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. — web/static/js/chat.js:7802
  • web/static/js/chat.js:9161 · web/static/js/workflows.js:475 — 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. — web/static/js/chat.js:9161
  • web/static/js/api-docs.js:638 · web/static/js/api-docs.js:738 — all 2 copies are in the same file, 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. — web/static/js/api-docs.js:638
  • web/static/js/c2.js:3281 · web/static/js/c2.js:4223 — 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. — web/static/js/c2.js:3281
  • web/static/js/chat-files.js:99 · web/static/js/monitor.js:7475 · web/static/js/roles.js:71 — 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. — web/static/js/chat-files.js:99
  • web/static/js/dashboard.js:549 · web/static/js/dashboard.js:1296 — 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. — web/static/js/dashboard.js:549
  • web/static/js/monitor.js:2881 · web/static/js/webshell.js:2199 — 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. — web/static/js/monitor.js:2881
  • web/static/js/c2.js:204 · web/static/js/chat-files.js:65 · web/static/js/hitl.js:1361 · web/static/js/monitor.js:7441 · +7 more site(s) not listed — the 11 copies are spread across 9 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. — web/static/js/c2.js:204
  • web/static/js/chat.js:4226 · web/static/js/monitor.js:2768 — 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. — web/static/js/chat.js:4226
  • web/static/js/roles.js:1116 · web/static/js/roles.js:1148 — all 2 copies are in the same file, 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. — web/static/js/roles.js:1116
  • web/static/js/chat-files.js:1047 · web/static/js/chat-files.js:1216 — 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. — web/static/js/chat-files.js:1047
  • web/static/js/chat.js:9407 · web/static/js/chat.js:9487 — 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. — web/static/js/chat.js:9407

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.
R2 · Cyclomatic Complexity0.0 / 10Critical✓ Tool-verified

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.

  • handleStreamEvent has cyclomatic complexity 502 and cognitive complexity 756; 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. — web/static/js/monitor.js:2918
  • loadConfig has cyclomatic complexity 206 and cognitive complexity 263; 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. — web/static/js/settings.js:790
  • addTimelineItem has cyclomatic complexity 204 and cognitive complexity 257; 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. — web/static/js/monitor.js:6638
  • processChunk has cyclomatic complexity 193 and cognitive complexity 403; 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. — web/static/js/webshell.js:3544
  • renderOneProcessDetail has cyclomatic complexity 183 and cognitive complexity 269; 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. — web/static/js/chat.js:4299
  • refreshWebshellUIOnLanguageChange has cyclomatic complexity 140 and cognitive complexity 274; 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. — web/static/js/webshell.js:5031
  • applySettings has cyclomatic complexity 122 and cognitive complexity 129; 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. — web/static/js/settings.js:1908
  • refreshDashboard has cyclomatic complexity 101 and cognitive complexity 151; 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. — web/static/js/dashboard.js:42
  • buildWebshellTimelineItemFromDetail has cyclomatic complexity 93 and cognitive complexity 135; 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. — web/static/js/webshell.js:2220
  • loadConversation has cyclomatic complexity 93 and cognitive complexity 124; 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. — web/static/js/chat.js:6381
  • selectWebshell has cyclomatic complexity 92 and cognitive complexity 33; 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. — web/static/js/webshell.js:2446
  • sendMessage has cyclomatic complexity 80 and cognitive complexity 97; 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. — web/static/js/chat.js:2248
  • initPage has cyclomatic complexity 77 and cognitive complexity 81; 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. — web/static/js/router.js:410
  • (anonymous) has cyclomatic complexity 73 and cognitive complexity 92; 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. — web/static/js/monitor.js:5625
  • loadProcessDetailsPaginated has cyclomatic complexity 70 and cognitive complexity 88; 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. — web/static/js/monitor.js:2369
  • (anonymous) has cyclomatic complexity 64 and cognitive complexity 83; 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. — web/static/js/monitor.js:9573
  • buildInlineHitlApprovalHtml has cyclomatic complexity 60 and cognitive complexity 68; 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. — web/static/js/monitor.js:4607
  • renderExternalMCPList has cyclomatic complexity 54 and cognitive complexity 85; 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. — web/static/js/settings.js:4502
  • (anonymous) has cyclomatic complexity 53 and cognitive complexity 68; 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. — web/static/js/c2.js:2355
  • run has cyclomatic complexity 53 and cognitive complexity 59; 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. — runtime/pi/src/worker.ts:181
  • restoreHitlInlineForConversation has cyclomatic complexity 51 and cognitive complexity 91; 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. — web/static/js/monitor.js:5375
  • renderOneMessage has cyclomatic complexity 50 and cognitive complexity 66; 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. — web/static/js/chat.js:6531
  • syncVulnerabilityFiltersFromLocationHash has cyclomatic complexity 49 and cognitive complexity 49; 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. — web/static/js/vulnerability.js:272
  • assetImportRecord has cyclomatic complexity 49 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 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. — REDACTED:319
  • showBatchQueueDetail has cyclomatic complexity 48 and cognitive complexity 65; 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. — web/static/js/tasks.js:1761
  • renderMCPDetailModal has cyclomatic complexity 45 and cognitive complexity 70; 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. — web/static/js/chat.js:5600
  • syncModelListFetchButtons has cyclomatic complexity 45 and cognitive complexity 60; 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. — web/static/js/settings.js:3478
  • saveKnowledgeItem has cyclomatic complexity 44 and cognitive complexity 49; 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. — REDACTED:994
  • renderProcessDetails has cyclomatic complexity 43 and cognitive complexity 54; 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. — web/static/js/chat.js:4069
  • saveExternalMCP has cyclomatic complexity 42 and cognitive complexity 57; 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. — web/static/js/settings.js:4734
  • readTypedConfig has cyclomatic complexity 41 and cognitive complexity 35; 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. — web/static/js/workflows.js:1175
  • fetchChatSystemModelsForChannel has cyclomatic complexity 40 and cognitive complexity 36; 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. — web/static/js/chat.js:1547
  • watchdogProbe has cyclomatic complexity 39 and cognitive complexity 34; 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. — web/static/js/update.js:290
  • appendTimelineItem has cyclomatic complexity 38 and cognitive complexity 57; 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. — web/static/js/webshell.js:3418
  • updateNavState has cyclomatic complexity 38 and cognitive complexity 49; 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. — web/static/js/router.js:183
  • loadConversations has cyclomatic complexity 38 and cognitive complexity 47; 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. — web/static/js/chat.js:10004
  • (anonymous) has cyclomatic complexity 37 and cognitive complexity 50; 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. — web/static/js/chat.js:7188
  • addMessage has cyclomatic complexity 37 and cognitive complexity 46; 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. — web/static/js/chat.js:3558
  • resolveInlineHitlDecision has cyclomatic complexity 37 and cognitive complexity 31; 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. — web/static/js/monitor.js:4529
  • restoreWorkflowHitlInlineForConversation has cyclomatic complexity 36 and cognitive complexity 49; 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. — web/static/js/monitor.js:5218
R3 · Large Files0.0 / 10Critical✓ 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.

  • web/static/js/chat.js has 10350 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/chat.js:1
  • web/static/js/monitor.js has 9005 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/monitor.js:1
  • web/static/js/webshell.js has 5064 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/webshell.js:1
  • web/static/js/settings.js has 4662 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/settings.js:1
  • web/static/js/c2.js has 4287 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/c2.js:1
  • web/static/js/projects.js has 3892 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/projects.js:1
  • web/static/js/workflows.js has 2916 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/workflows.js:1
  • web/static/js/tasks.js has 2706 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/tasks.js:1
  • web/static/js/vulnerability.js has 2475 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/vulnerability.js:1
  • web/static/js/dashboard.js has 2301 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/dashboard.js:1
  • REDACTED has 2085 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • web/static/js/hitl.js has 1900 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/hitl.js:1
  • web/static/js/chat-files.js has 1795 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/chat-files.js:1
  • web/static/js/roles.js has 1724 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/roles.js:1
  • REDACTED has 1721 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — REDACTED:1
  • web/static/js/info-collect.js has 1572 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/info-collect.js:1
  • web/static/js/rbac.js has 1469 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/rbac.js:1
  • web/static/js/mobile-ui.js has 1150 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/mobile-ui.js:1
  • plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js has 1143 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:1
  • web/static/js/skills.js has 1014 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/skills.js:1
  • web/static/js/update.js has 986 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/update.js:1
  • web/static/js/auth.js has 944 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/auth.js:1
  • web/static/js/api-docs.js has 937 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/api-docs.js:1
  • web/static/js/audit.js has 843 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/audit.js:1
  • web/static/js/fact-graph.js has 766 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/fact-graph.js:1
  • web/static/js/chat-scroll.js has 752 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/chat-scroll.js:1
  • web/static/js/tool-guard.js has 701 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/tool-guard.js:1
  • web/static/js/router.js has 658 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/router.js:1
  • web/static/js/terminal.js has 494 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module. — web/static/js/terminal.js:1

What to do

  • Split each oversized file along the responsibilities already in it, into smaller focused modules in the same package.
R4 · Test Coverage5.7 / 10Adequate✓ 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. (×27) — web/static/js/dashboard.js:1, web/static/js/chat-files.js:1, web/static/js/roles.js:1, …

What to do

  • Add tests that import the unreached modules (directly or through their public entry).
R5 · Dependency Freshness9.5 / 10Exemplary✓ Tool-verified

React / JS · Readiness — How outdated the npm dependencies are (a maturity signal). JS/npm CVEs are scored separately in D30 (JS/npm Dependency Vulnerabilities).

Method: npm dependency staleness from manifest/registry metadata (a maturity signal; JS/npm CVEs are scored separately in D30, which answers dependency vulnerabilities for every ecosystem). Deterministic.

R6 · Tooling6.7 / 10Adequate✓ 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.

  • test ✓ · lint ✗ · typecheck ✓ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.

What to do

  • Add eslint as package.json scripts and run them in CI.
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.

  • This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it. — scripts/mobile-tap-audit.mjs:67
R8 · Dependency Hygiene10.0 / 10Exemplary✓ Tool-verified

React / JS · Readiness — npm dependency truthfulness (D-386): unused dependencies, imports not declared anywhere, and type-/test-only packages shipped as production deps.

Method: npm dependency truthfulness: unused dependencies, imports declared nowhere, and type-/test-only packages shipped as production deps — from the manifest + import graph. Deterministic.

R9 · Circular Imports10.0 / 10Exemplary✓ Tool-verified

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.

X15 · Unvalidated length from an untrusted reader10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a length read out of the stream being parsed is bounded before it is allocated or read — an unchecked count taken from the input lets the input choose the allocation.

Method: Roslyn syntax + semantics: integer lengths read from a BinaryReader and spent on a bulk read or an array allocation, checked for any comparison or bounding call on the value anywhere in the method. Deterministic, provable per finding. Advisory.

X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

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.

X2 · Cancellation propagation8.2 / 10Strong✓ Tool-verified

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 21/30 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.
  • `loadAPISpec` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — web/static/js/api-docs.js:100
  • `testAPI` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — web/static/js/api-docs.js:629
  • `apiFetch` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — web/static/js/auth.js:201
  • `logout` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — web/static/js/auth.js:972
  • `loadLanguageResources` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`. — web/static/js/i18n.js:53
  • `sendWecomMessageViaAPI` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — REDACTED:1869
  • `ExecWithConnection` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — REDACTED:992
  • `FileOpWithConnection` calls `http.NewRequest(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`. — REDACTED:1032
  • `newHTTPExecFn` 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, …)`. — internal/handler/webshell_probe.go:70

What to do

  • Thread a context.Context or an AbortSignal through functions that make requests, so the work stops when its caller gives up.
X26 · Unsynchronised callback handoff5.4 / 10Adequate✓ Tool-verified

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.

  • `Shutdown` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 736. The loop never waits on `wg` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `wg` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `wg` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`. — internal/handler/task_manager.go:736
  • `RunCommandWS` hands values from a goroutine to the body waiting on it through `_`, a variable — the goroutine writes it with `_ = …` on line 67, and the body touches it at line 78. Those two spans provably run concurrently: this body waits on `doneChan`, which nothing but the goroutine raises, so the goroutine cannot be the flow that is waiting for it. The touch comes after the goroutine is started and BEFORE the body waits on `doneChan`, so the Go memory model orders nothing between it and the goroutine's write. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `doneChan` is a channel, which orders the handoff's signal and takes no exclusion over the variable's own state. Hand the values over the channel itself instead of beside it, or guard every access to `_` on both sides with one `sync.Mutex`. — internal/handler/terminal_ws_unix.go:67

What to do

  • In Go, hand values from a goroutine to the body waiting on it over a channel the body receives from, rather than through a map or slice beside a `sync.WaitGroup` or a signal channel — or hold one `sync.Mutex` over every access to the shared map or slice on both sides. The wait orders the signal; it takes no exclusion over the map's or slice's own state.
X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether an enhanced `for` leaves the collection it is walking alone — a body that adds to or removes from the very collection the loop is iterating invalidates the fail-fast iterator it is holding, so the next `next()` throws `ConcurrentModificationException` and the remaining elements are never seen. 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.

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.

X3 · Exception handling5.3 / 10Adequate✓ Tool-verified

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.

  • `catch (error)` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included. — REDACTED:703
  • 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. (×31) — REDACTED:1254, web/static/js/attack-chain-context.js:46, web/static/js/audit.js:172, …
  • `catch (_)` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included. — web/static/js/audit.js:529
  • `.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. — web/static/js/auth.js:984
  • `.catch(function(){})` 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. (×6) — web/static/js/c2.js:146, web/static/js/c2.js:2372, web/static/js/c2.js:2497, …

What to do

  • Swallowed exception (caught, then discarded)
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.

X4 · Structured logging8.0 / 10Strong✓ Tool-verified

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.

  • `Info` at line 170 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Info("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Info("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Info("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog. — cmd/server/main.go:170

What to do

  • Interpolated log message defeats structured logging
X5 · Nullable reference types8.3 / 10Strong✓ Tool-verified

Other · Code Health — Whether strict null checking is enabled and not undermined by heavy `!` assertion — TypeScript's `strictNullChecks` (which `strict` turns on) is what makes `string` exclude `null` and `undefined`, and the postfix `!` is the operator that silences it.

Method: Roslyn compiler-options scan: NullableContextOptions per project; null-forgiving (!) suppression density per 1k syntax nodes. Deterministic, adoption plus suppression penalty.

  • ~4.3 `!` null assertions per 1k TypeScript source lines — 2 assertion(s) across the 462 source line(s) of the 4 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: runtime/pi/src/worker.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.

What to do

  • The findings name the configuration each number was taken from and, for the assertions, the files that hold them. Turn null checking on where it is off — `"strict": true` in the base tsconfig that the others extend switches `strictNullChecks` on with the rest of the family — and then resolve the assertions rather than adding to them. A `!` on a value the checker could show to be null is a promise the author cannot check from where they are standing, and each one is a `TypeError: Cannot read properties of null` waiting for the path that makes it true; where the value genuinely cannot be null, say something the checker can see instead (narrow it with a test, make the property required, drop the `?`).

WCAG coverage — what static analysis assessed

Statically assessed 15 of 55 WCAG 2.2 Level A/AA success criteria (27%; ≈30% of the 50 WCAG 2.1 AA criteria for EN 301 549). The other 40 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).

DimensionWCAG 2.2 A/AA criteriaCoverage
AC1 · Text alternatives1.1.1, 1.2.2, 1.2.5Partial signal
AC2 · Forms & labels1.3.1, 3.3.2, 4.1.2Partial signal
AC3 · Page structure1.4.4, 2.2.1, 2.4.1, 2.4.2, 3.1.1, 4.1.2Partial signal
AC4 · Keyboard semantics2.1.1, 2.4.3Partial signal
AC5 · ARIA correctness4.1.2Partial signal
AC6 · Visual & motion safety1.4.3, 2.4.7Partial — literal CSS only

Not statically assessed — these 40 Level A/AA criteria need runtime or manual evaluation (WCAG-EM): 1.2.1, 1.2.3, 1.2.4, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.4.1, 1.4.2, 1.4.5, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 2.1.2, 2.1.4, 2.2.2, 2.3.1, 2.4.4, 2.4.5, 2.4.6, 2.4.11, 2.5.1, 2.5.2, 2.5.3, 2.5.4, 2.5.7, 2.5.8, 3.1.2, 3.2.1, 3.2.2, 3.2.3, 3.2.4, 3.2.6, 3.3.1, 3.3.3, 3.3.4, 3.3.7, 3.3.8, 4.1.3.

Reference — by lens

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

LensScoreRatingImpact
Code Health24.6Critical — gated by D1, D2, R1, R2, R3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture83.8Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity79.3StrongSolid.
Readiness47.0Weak — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security70.0Checked 5 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Event-Driven79.3StrongStrongest area.
Accessibility54.0Adequate — gated by AC4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance70.0StrongSolid.
Unscored — 3 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.

  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X9 Subsumed condition operand — 3 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 4 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.
  • P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
Not included — 52 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.

  • 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 Java 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; this repository's TypeScript 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.
  • AX4 Dependency direction — not applicable to a CQRS architecture (the inward-dependency rule is for layered/clean styles)
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB1 Runtime evidence locked — no reproducible boot — 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.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Aggregate roots were found in only one source directory (c2), which is a layered codebase, not two contexts. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/REDACTED` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D25 ADR Conformance — no ADRs to check
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 3 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D36 Supply-chain Provenance & Signing — The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
  • 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
  • D8 Code Coverage — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the node:test suite in runtime/pi/ ran and not one test passed (throw new ERR_MODULE_NOT_FOUND(), so the coverage would describe the failed run, not the code. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
  • DM1 Domain Modelling — applicable but not scored (1 of 2 signals for this style — below the bar we score at): 2 aggregate root(s) (types guarding their own state behind command methods — this language has no AggregateRoot base to inherit)
  • ED1 Handler temporal coupling — no event handlers detected — temporal-coupling check not applicable
  • ED2 Event/command shape — no command-shaped messages detected — single-handler-per-command check not applicable
  • ED3 Event naming — no domain or integration events detected — event-naming check not applicable
  • ED5 Idempotency — Not assessed, and this one is on us: 1 command handler(s) or message consumer(s) were found here, but this check does not yet recognise persistence writes in this repository's language. Idempotency was neither confirmed nor ruled out — this is a limit of the analyzer, not a finding about your code.
  • ES1 Event Sourcing — not scored — this repository shows only 1 of the 3 signals this lens looks for (4 Go aggregate(s) recording domain events (own events-slice append / raise-record))
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — coverage not measured: this check compares the coverage of the analyzer's own test run across the domain and web layers, and that run measured none here — Test coverage (D8) says why
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for a `func BenchmarkXxx(b *testing.B)` in any `_test.go` file, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • 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.
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • SC1 Supply-chain hygiene — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X1 Async correctness — X1 reached only 43% of this repository's production lines — go (100,823 lines), java (2,080 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 44% of this repository's production lines — go (100,823 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
  • X16 Unfloored truncation loop — X16 reached only 44% of this repository's production lines — go (100,823 lines), python (470 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 — X18 reached only 44% of this repository's production lines — go (100,823 lines), python (470 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X20 Mistyped argument guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X21 Side-effecting pattern guard — X21 reached only 44% of this repository's production lines — go (100,823 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 — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — X24 reached only 44% of this repository's production lines — go (100,823 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X25 Inert configuration knob — X25 reached only 44% of this repository's production lines — go (100,823 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 — X29 reached only 44% of this repository's production lines — go (100,823 lines), python (470 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • 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.
  • 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 — 147 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • + 12 more in this group — see findings.md.
AC2 · Forms & labels · <label> that labels no control · ×17
  • <label> that labels no control web/static/js/api-docs.js:543 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/audit.js:391 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1038 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1042 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1052 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1057 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1062 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1067 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1073 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1078 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1286 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1290 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1295 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1299 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1304 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1310 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
  • <label> that labels no control web/static/js/c2.js:1315 — This <label> has no for and wraps no form control, so it names nothing: assistive tech never announces it, and clicking the caption focuses no field. Note that an id on the label is not an association — it is the TARGET of one, so a control still has to point at it. Give the label for="<the control's id>", move the control inside the label, or point the control's aria-labelledby at this label's id.
AC2 · Forms & labels · <input> without a programmatic label · ×13
  • <input> without a programmatic label plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.html:83 — 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 web/static/js/c2.js:1039 — 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 web/static/js/c2.js:1058 — 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 web/static/js/c2.js:1063 — 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 web/static/js/c2.js:1074 — 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 web/static/js/c2.js:1079 — 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 web/static/js/c2.js:1287 — 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 web/static/js/c2.js:1296 — 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 web/static/js/c2.js:1300 — 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 web/static/js/c2.js:1311 — 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 web/static/js/c2.js:1316 — 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 web/static/js/c2.js:1413 — 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 web/static/js/c2.js:1808 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
AC4 · Keyboard semantics · Click handler on a non-interactive <div> · ×13
  • Click handler on a non-interactive <div> web/static/js/chat.js:5974 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> web/static/js/chat.js:9223 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:88 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> REDACTED:90 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> web/static/js/settings.js:1422 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> web/static/js/webshell.js:2350 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <div> REDACTED:1814 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3634 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3640 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3643 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3646 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3649 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <div> REDACTED:3652 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
AC4 · Keyboard semantics · Click handler on a non-interactive <span> · ×11
  • Click handler on a non-interactive <span> web/static/js/audit.js:699 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> REDACTED:1833 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/settings.js:1445 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <span> web/static/js/tasks.js:583 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/tasks.js:1898 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/tasks.js:1899 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/tasks.js:1900 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/tasks.js:1902 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> web/static/js/tasks.js:1903 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <span> REDACTED:2119 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
  • Click handler on a non-interactive <span> REDACTED:2194 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
AC2 · Forms & labels · <select> without a programmatic label · ×7
  • <select> without a programmatic label web/static/js/audit.js:392 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1043 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1053 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1069 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1291 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1306 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
  • <select> without a programmatic label web/static/js/c2.js:1411 — This control has no associated label. Add a <label for> / wrapping <label> / aria-label / aria-labelledby so assistive tech can name it.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
ED4 · Outbox / dual-write · Dual write (no outbox) · ×3
  • Dual write (no outbox): AgentHandler.executeOneBatchSubTask internal/handler/batch_queue_executor.go:113 — `AgentHandler.executeOneBatchSubTask` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem).
  • Dual write (no outbox): AgentHandler.MultiAgentLoopStream internal/handler/multi_agent.go:23 — `AgentHandler.MultiAgentLoopStream` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem).
  • Dual write (no outbox): AgentHandler.SingleAgentLoopStream internal/handler/single_agent.go:22 — `AgentHandler.SingleAgentLoopStream` writes to the database AND publishes to the message bus in the same flow, with no outbox referenced in this path. These two writes aren't atomic — a crash between them either loses the message (DB committed, publish failed) or emits a phantom event (publish succeeded, DB rolled back). Use the transactional outbox pattern — write the message to an outbox table in the SAME transaction as the state change, and dispatch it from there afterwards — or your platform's equivalent (a broker transaction, or an outbox library from your own ecosystem).
AC4 · Keyboard semantics · Click handler on a non-interactive <li> · ×2
  • Click handler on a non-interactive <li> plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:322 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <li> plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:379 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics · Click handler on a non-interactive <code> · ×2
  • Click handler on a non-interactive <code> REDACTED:1448 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
  • Click handler on a non-interactive <code> REDACTED:1454 — A click handler on a plain element isn't keyboard-operable. Use a <button>, or add role + tabindex="0" + a key handler.
AC4 · Keyboard semantics · Clickable role="button" that no keyboard user can reach · ×2
  • Clickable role="button" that no keyboard user can reach web/static/js/monitor.js:7147 — This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabindex="0" in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabindex="0"="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it.
  • Clickable role="button" that no keyboard user can reach REDACTED:98 — This <div> announces itself as a role="button" and binds a click, but nothing can put focus on it: no tabindex="0" in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabindex="0"="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="button" or point aria-activedescendant at it.
D28 · Secrets (history) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×2
  • REDACTED
  • REDACTED
AC2 · Forms & labels · <textarea> without a programmatic label · ×1
  • <textarea> without a programmatic label web/static/js/api-docs.js:544 — 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.
AC2 · Forms & labels · <button> with no accessible text · ×1
  • <button> with no accessible text web/static/js/attack-chain-context.js:96 — A button with no text and no aria-label has no accessible name. Add visible text or an aria-label (an icon-only button still needs one).
AC2 · Forms & labels · Custom control with no accessible name on <div> · ×1
  • Custom control with no accessible name on <div> web/static/js/audit.js:858 — This <div> carries a click handler, which makes it a control, but it has no text, aria-label or labelled child (the icon-only case), so assistive tech has no name to announce for it. Note that switching it to <button type="button"> — the right fix for its keyboard operability — does not give it a name either: an icon-only button still needs one. Add visible text or an aria-label.
AC3 · Page structure · Document without a <title> · ×1
  • Document without a <title> plugins/browser-extension/cyberstrikeai-browser-extension/popup/popup.html:2 — A page with no <title> gives no name in the tab, history or screen-reader page list. Add a descriptive <title> in <head>.
AC4 · Keyboard semantics · Clickable role="option" that no keyboard user can reach · ×1
  • Clickable role="option" that no keyboard user can reach plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:812 — This <li> announces itself as a role="option" and binds a click, but nothing can put focus on it: no tabindex="0" in any spelling, no key handler, and nothing in this file moves focus or sets aria-activedescendant. The role tells assistive tech what the control IS; it does not make the control reachable, so a keyboard user cannot operate it at all (WCAG 2.1.1). Give it tabindex="0"="0" and an Enter/Space key handler, or make it a native <button>. If a parent widget owns the keyboard model, that parent must move focus onto the active role="option" or point aria-activedescendant at it.
AC4 · Keyboard semantics · Click handler on a non-interactive <pre> · ×1
  • Click handler on a non-interactive <pre> REDACTED:3168 — A click handler on a plain element with no role and no tabindex: even where another element's key handler can reach it, assistive tech can neither focus it nor announce what it is. Use a <button>, or add role + tabindex="0".
AC5 · ARIA correctness · aria-expanded on a <span> with no role to carry it · ×1
  • aria-expanded on a <span> with no role to carry it web/static/js/chat.js:1401 — A plain <span> has the implicit role "generic", which supports no ARIA states, so this aria-expanded is dropped and assistive tech is never told the state at all. Put aria-expanded on the element that owns the behaviour (the button or control the user operates), or give this <span> a role that supports aria-expanded.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×1
  • REDACTED
Serious — 2309 finding(s)
D3 · God Classes · FileTooLong · ×57
  • FileTooLong: js/chat.js web/static/js/chat.js — FileTooLong — 8073 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 7573 over it, 16.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: js/monitor.js web/static/js/monitor.js — FileTooLong — 7208 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 6708 over it, 14.42× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: handler/openapi.go internal/handler/openapi.go — FileTooLong — 4597 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: OpenAPIHandler (3 blocks, 13-6662). The bar is 500 significant lines; this is 4097 over it, 9.19× 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: js/webshell.js web/static/js/webshell.js — FileTooLong — 4218 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 3718 over it, 8.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: js/settings.js web/static/js/settings.js — FileTooLong — 3691 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 3191 over it, 7.38× 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: js/c2.js web/static/js/c2.js — FileTooLong — 3641 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 1500 significant lines; this is 2141 over it, 2.43× 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: js/projects.js web/static/js/projects.js — FileTooLong — 3292 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 2792 over it, 6.58× 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: js/workflows.js web/static/js/workflows.js — FileTooLong — 2438 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 1500 significant lines; this is 938 over it, 1.63× 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: js/tasks.js web/static/js/tasks.js — FileTooLong — 2095 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 1595 over it, 4.19× 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: handler/config.go internal/handler/config.go — FileTooLong — 2086 significant lines (blank, comment-only and punctuation-only lines excluded), about 64% of them inside a single declaration: ConfigHandler (40 blocks, 77-3067). The bar is 500 significant lines; this is 1586 over it, 4.17× 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: js/vulnerability.js web/static/js/vulnerability.js — FileTooLong — 2048 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 1548 over it, 4.10× 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: js/dashboard.js web/static/js/dashboard.js — FileTooLong — 1830 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 1330 over it, 3.66× 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: handler/agent.go internal/handler/agent.go — FileTooLong — 1699 significant lines (blank, comment-only and punctuation-only lines excluded), about 73% of them inside a single declaration: AgentHandler (51 blocks, 184-2569). The bar is 500 significant lines; this is 1199 over it, 3.40× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1681 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1181 over it, 3.36× 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: js/hitl.js web/static/js/hitl.js — FileTooLong — 1576 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 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 — 1563 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 1063 over it, 3.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: config/config.go internal/config/config.go — FileTooLong — 1532 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1032 over it, 3.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 1484 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 984 over it, 2.97× 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: js/chat-files.js web/static/js/chat-files.js — FileTooLong — 1472 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 972 over it, 2.94× 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 — 1402 significant lines (blank, comment-only and punctuation-only lines excluded), about 84% of them inside a single declaration: RobotHandler (65 blocks, 79-1977). The bar is 500 significant lines; this is 902 over it, 2.80× 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: js/info-collect.js web/static/js/info-collect.js — FileTooLong — 1289 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 789 over it, 2.58× 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: js/rbac.js web/static/js/rbac.js — FileTooLong — 1275 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 775 over it, 2.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: js/roles.js web/static/js/roles.js — FileTooLong — 1251 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 751 over it, 2.50× 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 — 1225 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: DB (48 blocks, 48-1866). The bar is 500 significant lines; this is 725 over it, 2.45× 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 — 1207 significant lines (blank, comment-only and punctuation-only lines excluded), about 75% of them inside a single declaration: DB (51 blocks, 155-1953). The bar is 500 significant lines; this is 707 over it, 2.41× 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.
  • + 32 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×50
  • Hotspot: web/static/js/monitor.js web/static/js/monitor.js:2918 — web/static/js/monitor.js changed 15 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 514 in monitor.handleStreamEvent at line 2918. 6 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/monitor.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: web/static/js/chat.js web/static/js/chat.js:4069 — web/static/js/chat.js changed 17 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 291 in chat.renderProcessDetails at line 4069. 4 of those changes were fix/bug commits, and the other 13 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/chat.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: web/static/js/settings.js web/static/js/settings.js:790 — web/static/js/settings.js changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 205 in settings.loadConfig at line 790. 7 of those changes were fix/bug commits, and the other 7 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/settings.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: web/static/js/webshell.js web/static/js/webshell.js:2446 — web/static/js/webshell.js changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 331 in webshell.selectWebshell at line 2446. 3 of those changes were fix/bug commits, and the other 4 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/webshell.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/handler/agent.go internal/handler/agent.go:1025 — internal/handler/agent.go changed 12 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 185 in AgentHandler.createProgressCallback at line 1025. 5 of those changes were fix/bug commits, and the other 7 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/agent.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/handler/config.go internal/handler/config.go:799 — internal/handler/config.go changed 18 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 90 in ConfigHandler.UpdateConfig at line 799. 7 of those changes were fix/bug commits, and the other 11 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/config.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:83 — REDACTED changed 24 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 57 in app.New at line 83. 6 of those changes were fix/bug commits, and the other 18 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +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: internal/config/config.go internal/config/config.go:1546 — internal/config/config.go changed 28 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in config.Load at line 1546. 11 of those changes were fix/bug commits, and the other 17 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/config/config.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: web/static/js/tasks.js web/static/js/tasks.js:1761 — web/static/js/tasks.js changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 91 in tasks.showBatchQueueDetail at line 1761. 3 of those changes were fix/bug commits, and the other 4 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/tasks.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/handler/multi_agent.go internal/handler/multi_agent.go:23 — internal/handler/multi_agent.go changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 66 in AgentHandler.MultiAgentLoopStream at line 23. 3 of those changes were fix/bug commits, and the other 6 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/multi_agent.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/handler/single_agent.go internal/handler/single_agent.go:22 — internal/handler/single_agent.go changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 64 in AgentHandler.SingleAgentLoopStream at line 22. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/single_agent.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: web/static/js/dashboard.js web/static/js/dashboard.js:42 — web/static/js/dashboard.js changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 114 in dashboard.refreshDashboard at line 42. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/dashboard.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: web/static/js/router.js web/static/js/router.js:410 — web/static/js/router.js changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 82 in router.initPage at line 410. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/router.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: REDACTED REDACTED:1452 — REDACTED changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 46 in DB.GetProcessDetailsSummary at line 1452. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +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: internal/update/apply.go internal/update/apply.go:399 — internal/update/apply.go changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in update.finishPendingBuild at line 399. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/update/apply.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/security/rbac_middleware.go internal/security/rbac_middleware.go:91 — internal/security/rbac_middleware.go changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in security.permissionForRequest at line 91. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/security/rbac_middleware.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/handler/batch_queue_executor.go internal/handler/batch_queue_executor.go:113 — internal/handler/batch_queue_executor.go changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in AgentHandler.executeOneBatchSubTask at line 113. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/batch_queue_executor.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: web/static/js/update.js web/static/js/update.js:290 — web/static/js/update.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in update.watchdogProbe at line 290. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/update.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: web/static/js/vulnerability.js web/static/js/vulnerability.js:1274 — web/static/js/vulnerability.js changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 31 in vulnerability.loadVulnerabilities at line 1274. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/vulnerability.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/multiagent/pi_runner.go internal/multiagent/pi_runner.go:226 — internal/multiagent/pi_runner.go changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 84 in piRun.run at line 226. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/multiagent/pi_runner.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/server/main.go cmd/server/main.go:24 — cmd/server/main.go changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in main.main at line 24. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- cmd/server/main.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/handler/multi_agent_prepare.go internal/handler/multi_agent_prepare.go:36 — internal/handler/multi_agent_prepare.go changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 55 in AgentHandler.prepareMultiAgentSession at line 36. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/handler/multi_agent_prepare.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: runtime/pi/src/worker.ts runtime/pi/src/worker.ts:181 — runtime/pi/src/worker.ts changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in worker.run at line 181. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- runtime/pi/src/worker.ts`: 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/attackchain/builder.go internal/attackchain/builder.go:87 — internal/attackchain/builder.go changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 38 in Builder.BuildChainFromConversation at line 87. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/attackchain/builder.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: web/static/js/auth.js web/static/js/auth.js:278 — web/static/js/auth.js changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in auth.submitLogin at line 278. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- web/static/js/auth.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.
  • + 25 more in this group — see findings.md.
D3 · God Classes · FunctionTooLong · ×41
  • FunctionTooLong: webshell.selectWebshell web/static/js/webshell.js:2446 — FunctionTooLong — selectWebshell runs 736 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 636 over it, 7.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: handler.RegisterBatchTaskMCPTools internal/handler/batch_task_mcp.go:22 — FunctionTooLong — RegisterBatchTaskMCPTools runs 462 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 362 over it, 4.62× 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: app.setupRoutes REDACTED:948 — FunctionTooLong — setupRoutes runs 452 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 352 over it, 4.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: chat.renderAttackChain web/static/js/chat.js:7135 — FunctionTooLong — renderAttackChain runs 451 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 351 over it, 4.51× 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: webshell.runWebshellAiSend web/static/js/webshell.js:3383 — FunctionTooLong — runWebshellAiSend runs 436 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 336 over it, 4.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: app.New REDACTED:83 — FunctionTooLong — New runs 401 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 301 over it, 4.01× 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: chat.renderProcessDetails web/static/js/chat.js:4069 — FunctionTooLong — renderProcessDetails runs 379 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 279 over it, 3.79× 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: chat._acBuildSvgString web/static/js/chat.js:8484 — FunctionTooLong — _acBuildSvgString runs 354 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 254 over it, 3.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.
  • FunctionTooLong: app.registerWebshellManagementTools REDACTED:1686 — FunctionTooLong — registerWebshellManagementTools runs 319 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 219 over it, 3.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: dashboard.refreshDashboard web/static/js/dashboard.js:42 — FunctionTooLong — refreshDashboard runs 317 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 217 over it, 3.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: chat-files.renderChatFilesTable web/static/js/chat-files.js:992 — FunctionTooLong — renderChatFilesTable runs 273 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 173 over it, 2.73× 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: app.registerProjectFactTools internal/app/project_fact_tools.go:40 — FunctionTooLong — registerProjectFactTools runs 266 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 166 over it, 2.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: chat.loadConversation web/static/js/chat.js:6381 — FunctionTooLong — loadConversation runs 248 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 148 over it, 2.48× 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: chat.sendMessage web/static/js/chat.js:2248 — FunctionTooLong — sendMessage runs 223 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 123 over it, 2.23× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: webshell.initWebshellTerminal web/static/js/webshell.js:3985 — FunctionTooLong — initWebshellTerminal runs 170 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 70 over it, 1.70× 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: app.mcpToolAuthorizer internal/app/mcp_authorization.go:15 — FunctionTooLong — mcpToolAuthorizer runs 168 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 68 over it, 1.68× 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: tasks.showBatchQueueDetail web/static/js/tasks.js:1761 — FunctionTooLong — showBatchQueueDetail 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: workflow.RunRoleBoundWorkflow internal/workflow/runner.go:28 — FunctionTooLong — RunRoleBoundWorkflow 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: knowledge.RegisterKnowledgeTool internal/knowledge/tool.go:17 — FunctionTooLong — RegisterKnowledgeTool 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.
  • FunctionTooLong: chat.loadConversations web/static/js/chat.js:10004 — FunctionTooLong — loadConversations 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: router.initPage web/static/js/router.js:410 — FunctionTooLong — initPage 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: webshell.refreshWebshellUIOnLanguageChange web/static/js/webshell.js:5031 — FunctionTooLong — refreshWebshellUIOnLanguageChange runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× 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: fact-graph.render web/static/js/fact-graph.js:550 — FunctionTooLong — render runs 143 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 43 over it, 1.43× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: update.Apply internal/update/apply.go:186 — FunctionTooLong — Apply runs 139 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 39 over it, 1.39× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: workflow.GenerateDraftFromNaturalLanguage internal/workflow/draft_generator.go:95 — FunctionTooLong — GenerateDraftFromNaturalLanguage runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • + 16 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (empty catch) · ×38
  • Swallowed exception (empty catch) REDACTED:1254 — 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) web/static/js/attack-chain-context.js:46 — 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) web/static/js/audit.js:172 — 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) web/static/js/audit.js:185 — 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) web/static/js/audit.js:272 — 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) web/static/js/auth.js:984 — `.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) web/static/js/c2.js:146 — `.catch(function(){})` 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) web/static/js/c2.js:179 — 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) web/static/js/c2.js:2372 — `.catch(function(){})` 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) web/static/js/c2.js:2497 — `.catch(function(){})` 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) web/static/js/c2.js:2502 — `.catch(function(){})` 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) web/static/js/c2.js:2577 — 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) web/static/js/c2.js:4381 — 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) web/static/js/c2.js:4416 — `.catch(function(){})` 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) web/static/js/c2.js:4421 — 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) web/static/js/c2.js:4441 — 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) web/static/js/chat-files.js:220 — 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) web/static/js/chat-files.js:231 — 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) web/static/js/chat-files.js:262 — 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) web/static/js/chat-files.js:273 — 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) web/static/js/chat-files.js:458 — 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) web/static/js/chat-files.js:564 — 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) web/static/js/chat-files.js:595 — 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) web/static/js/chat-files.js:682 — 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) web/static/js/chat-files.js:1396 — 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.
  • + 13 more in this group — see findings.md.
R4 · Test Coverage · No test reaches this file · ×27
  • No test reaches this file web/static/js/dashboard.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.
  • No test reaches this file web/static/js/chat-files.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.
  • No test reaches this file web/static/js/roles.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.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.
  • No test reaches this file web/static/js/api-docs.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.
  • No test reaches this file web/static/js/fact-graph.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.
  • No test reaches this file web/static/js/terminal.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.
  • No test reaches this file web/static/js/audit-datetime-picker.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.
  • No test reaches this file web/static/js/wechat-robot.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.
  • No test reaches this file web/static/js/storage.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.
  • No test reaches this file web/static/js/agents.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.
  • No test reaches this file web/static/js/vulnerability-workspace.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.
  • No test reaches this file web/static/js/modal.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.
  • No test reaches this file web/static/js/sanitize-markdown.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.
  • No test reaches this file web/static/js/theme.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/markdown.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/http-normalize.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/capture.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/devtools.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.
  • No test reaches this file web/static/js/vulnerability-download.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/auth-session.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/popup/popup.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/formatter.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.
  • No test reaches this file plugins/browser-extension/cyberstrikeai-browser-extension/lib/catalog-cache.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.
  • + 2 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×25
  • MethodTooLong: OpenAPIHandler.GetOpenAPISpec internal/handler/openapi.go:31 — MethodTooLong — GetOpenAPISpec runs 4554 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4454 over it, 45.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: AgentHandler.createProgressCallback internal/handler/agent.go:1025 — MethodTooLong — createProgressCallback runs 359 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 259 over it, 3.59× 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: AgentHandler.MultiAgentLoopStream internal/handler/multi_agent.go:23 — MethodTooLong — MultiAgentLoopStream runs 315 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 215 over it, 3.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: ConfigHandler.UpdateConfig internal/handler/config.go:799 — MethodTooLong — UpdateConfig runs 310 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 210 over it, 3.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AgentHandler.SingleAgentLoopStream internal/handler/single_agent.go:22 — MethodTooLong — SingleAgentLoopStream runs 308 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 208 over it, 3.08× 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: piRun.run internal/multiagent/pi_runner.go:226 — MethodTooLong — run runs 249 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 149 over it, 2.49× 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: piRun.executePiLocal internal/multiagent/pi_local_tools.go:121 — MethodTooLong — executePiLocal runs 204 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 104 over it, 2.04× 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: ConfigHandler.GetTools internal/handler/config.go:413 — MethodTooLong — GetTools runs 183 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 83 over it, 1.83× 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: AgentHandler.executeOneBatchSubTask internal/handler/batch_queue_executor.go:113 — MethodTooLong — executeOneBatchSubTask runs 180 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 80 over it, 1.80× 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: Pi.Run internal/agentruntime/pi.go:89 — MethodTooLong — Run runs 177 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× 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: ConfigHandler.ApplyConfig internal/handler/config.go:1781 — MethodTooLong — ApplyConfig 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.
  • MethodTooLong: Server.handleCallTool internal/mcp/server.go:521 — MethodTooLong — handleCallTool runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: TCPReverseListener.handleTCPBeaconSession internal/c2/tcp_beacon_server.go:73 — MethodTooLong — handleTCPBeaconSession 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.
  • MethodTooLong: Executor.buildCommandArgs internal/security/executor.go:354 — MethodTooLong — buildCommandArgs runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× 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: DB.GetProcessDetailsSummary REDACTED:1452 — MethodTooLong — GetProcessDetailsSummary runs 147 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 47 over it, 1.47× 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: AgentHandler.waitHITLApproval internal/handler/hitl.go:624 — MethodTooLong — waitHITLApproval 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.
  • MethodTooLong: AgentHandler.prepareMultiAgentSession internal/handler/multi_agent_prepare.go:36 — MethodTooLong — prepareMultiAgentSession runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Builder.BuildChainFromConversation internal/attackchain/builder.go:87 — MethodTooLong — BuildChainFromConversation runs 131 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 31 over it, 1.31× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BurpExtender.sendMessage plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/BurpExtender.java:47 — MethodTooLong — sendMessage runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× 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: RobotHandler.handleRobotCommand REDACTED:1247 — MethodTooLong — handleRobotCommand runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.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: PayloadBuilder.BuildBeacon internal/c2/payload_builder.go:66 — MethodTooLong — BuildBeacon runs 113 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 13 over it, 1.13× 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: CyberStrikeAITab.wireActions plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:426 — MethodTooLong — wireActions runs 111 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 11 over it, 1.11× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatUploadsHandler.collectFiles REDACTED:323 — MethodTooLong — collectFiles 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.
  • MethodTooLong: Executor.ExecuteTool internal/security/executor.go:122 — MethodTooLong — ExecuteTool 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.
  • MethodTooLong: SendOptionsDialog.show plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SendOptionsDialog.java:31 — MethodTooLong — show runs 101 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 1 over it, 1.01× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×22
  • Duplicated block (9 lines × 2) internal/app/asset_tools.go:383 — internal/app/asset_tools.go:383-391 | internal/handler/asset.go:240-248 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (9 lines × 2) internal/attackchain/builder.go:344 — internal/attackchain/builder.go:344-352 | internal/attackchain/builder.go:357-365 — 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/attackchain/builder.go:344` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:105 — REDACTED:105-113 | REDACTED:1488-1496 — 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 (9 lines × 2) internal/handler/agent.go:492 — internal/handler/agent.go:492-500 | internal/handler/agent.go:610-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 (9 lines × 2) internal/handler/c2.go:325 — internal/handler/c2.go:325-333 | internal/handler/c2.go:446-454 — 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) REDACTED:110 — REDACTED:110-118 | REDACTED:128-136 — 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/handler/config.go:2275 — internal/handler/config.go:2275-2283 | internal/handler/config.go:2342-2350 — 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/handler/config.go:2275` 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) internal/handler/markdown_agents.go:228 — internal/handler/markdown_agents.go:228-236 | internal/handler/markdown_agents.go:320-328 — 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/handler/markdown_agents.go:228` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: `internal/handler/markdown_agents.go:228` is reached only past a guard at line 159 that tests `h.dir` and leaves the function early, and `internal/handler/markdown_agents.go:320` reads `h.dir` with no such check. What separates these copies is not which lines they run but which PRECONDITION they enforce, so one of them is operating on state the other one refuses. Decide which is intended BEFORE unifying them — extract the shared part and whichever copy is missing the check keeps running unchecked, and if the guard is the correct behaviour then that hole is already live.
  • Duplicated block (9 lines × 2) internal/handler/monitor.go:592 — internal/handler/monitor.go:592-600 | internal/handler/monitor.go:866-874 — 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/handler/rbac.go:124 — internal/handler/rbac.go:124-132 | internal/handler/rbac.go:157-165 — 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) REDACTED:102 — REDACTED:102-110 | REDACTED:235-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 (9 lines × 2) internal/mcp/external_manager.go:699 — internal/mcp/external_manager.go:699-707 | internal/mcp/server.go:924-932 — 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 (9 lines × 2) REDACTED:138 — REDACTED:138-146 | internal/update/apply.go:187-195 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) internal/database/project.go:641 — internal/database/project.go:641-649 | internal/database/project.go:662-670 — 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/database/project.go:641` 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/database/project.go:651` calls `Errorf` and `internal/database/project.go:671` 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 (9 lines × 2) internal/handler/agent.go:632 — internal/handler/agent.go:632-640 | REDACTED:1391-1399 — 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 (9 lines × 2) REDACTED:1578 — REDACTED:1578-1586 | REDACTED:1595-1604 — 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:1578` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:1141 — REDACTED:1141-1150 | REDACTED:1183-1191 — 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:1141` 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) REDACTED:133 — REDACTED:133-141 | REDACTED:227-235 — 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:133` 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) REDACTED:1993 — REDACTED:1993-2001 | REDACTED:2035-2043 — 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:1993` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) REDACTED:588 — REDACTED:588-596 | REDACTED:377-385 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:588` 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) internal/robot/qq.go:129 — internal/robot/qq.go:129-137 | internal/robot/qq.go:156-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) REDACTED:805 — REDACTED:805-813 | REDACTED:937-945 — 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:805` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:803` calls `Warn`, `String`, `Error` and `REDACTED:935` 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.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×20
  • Duplicated block (10 lines × 2) internal/c2/listener_tcp.go:255 — internal/c2/listener_tcp.go:255-264 | REDACTED:250-259 — 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/c2/listener_tcp.go:255` 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) REDACTED:493 — REDACTED:493-502 | REDACTED:520-529 — 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:493` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:519` calls `appendConversationAccessFilter` and `REDACTED:492` 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 (10 lines × 2) REDACTED:1391 — REDACTED:1391-1400 | REDACTED:1788-1797 — 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:1391` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) REDACTED:314 — REDACTED:314-323 | REDACTED:1007-1016 — 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:314` 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/handler/agent_multi_json_runner.go:30 — internal/handler/agent_multi_json_runner.go:30-39 | internal/handler/multi_agent.go:209-219 — 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/handler/agent_multi_json_runner.go:30` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/handler/c2.go:138 — internal/handler/c2.go:138-147 | internal/handler/c2.go:155-164 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/handler/c2.go:1017 — internal/handler/c2.go:1017-1026 | internal/handler/c2.go:1054-1063 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/handler/c2.go:1027` calls `JSON`, `CreateProfile` and `internal/handler/c2.go:1065` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) internal/handler/c2.go:1032 — internal/handler/c2.go:1032-1041 | internal/handler/c2.go:1065-1074 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/c2.go:1027` calls `JSON`, `CreateProfile` and `internal/handler/c2.go:1063` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) internal/handler/knowledge.go:242 — internal/handler/knowledge.go:242-251 | internal/handler/knowledge.go:275-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/handler/markdown_agents.go:212 — internal/handler/markdown_agents.go:212-221 | internal/handler/markdown_agents.go:304-313 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) internal/handler/multi_agent.go:29 — internal/handler/multi_agent.go:29-38 | internal/handler/single_agent.go:30-39 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:29` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (10 lines × 2) REDACTED:68 — REDACTED:68-77 | REDACTED:257-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) internal/handler/task_manager.go:248 — internal/handler/task_manager.go:248-257 | internal/handler/task_manager.go:274-283 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) REDACTED:777 — REDACTED:777-786 | REDACTED:911-920 — 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:777` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/mcp/server.go:1433 — internal/mcp/server.go:1433-1442 | internal/mcp/server.go:1542-1551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) internal/workflow/resume.go:105 — internal/workflow/resume.go:105-114 | internal/workflow/runner.go:203-212 — 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) REDACTED:281 — REDACTED:281-290 | REDACTED:985-994 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) internal/handler/knowledge.go:169 — internal/handler/knowledge.go:169-178 | internal/handler/knowledge.go:213-222 — 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/handler/knowledge.go:169` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) internal/database/asset.go:751 — internal/database/asset.go:751-760 | REDACTED:601-610 — 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/database/asset.go:751` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:611` calls `TrimSpace` and `internal/database/asset.go:761` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) cmd/test-config/main.go:11 — cmd/test-config/main.go:11-20 | cmd/test-external-mcp/main.go:15-24 — 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/test-config/main.go:11` 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.
D3 · God Classes · ClassTooLong · ×18
  • ClassTooLong: OpenAPIHandler internal/handler/openapi.go:13 — ClassTooLong — 4585 significant lines (blank, comment-only and punctuation-only lines excluded), 2 methods, 3 blocks, lines 13-6662. The bar is 400 significant lines; this is 4185 over it, 11.46× 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: ConfigHandler internal/handler/config.go:77 — ClassTooLong — 1325 significant lines (blank, comment-only and punctuation-only lines excluded), 47 methods, 40 blocks, lines 77-3067. The bar is 400 significant lines; this is 925 over it, 3.31× 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: AgentHandler internal/handler/agent.go:184 — ClassTooLong — 1240 significant lines (blank, comment-only and punctuation-only lines excluded), 143 methods, 51 blocks, lines 184-2569. The bar is 400 significant lines; this is 840 over it, 3.10× 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: RobotHandler REDACTED:79 — ClassTooLong — 1174 significant lines (blank, comment-only and punctuation-only lines excluded), 68 methods, 65 blocks, lines 79-1977. The bar is 400 significant lines; this is 774 over it, 2.94× 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: Server internal/mcp/server.go:37 — ClassTooLong — 1048 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods, 57 blocks, lines 37-1742. The bar is 400 significant lines; this is 648 over it, 2.62× 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: ChatUploadsHandler REDACTED:43 — ClassTooLong — 985 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods, 35 blocks, lines 43-1516. The bar is 400 significant lines; this is 585 over it, 2.46× 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: ExternalMCPManager internal/mcp/external_manager.go:53 — ClassTooLong — 928 significant lines (blank, comment-only and punctuation-only lines excluded), 67 methods, 59 blocks, lines 53-1661. The bar is 400 significant lines; this is 528 over it, 2.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.
  • ClassTooLong: C2Handler internal/handler/c2.go:29 — ClassTooLong — 817 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods, 40 blocks, lines 29-1268. The bar is 400 significant lines; this is 417 over it, 2.04× 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: BatchTaskManager internal/handler/batch_task_manager.go:97 — ClassTooLong — 795 significant lines (blank, comment-only and punctuation-only lines excluded), 40 methods, 41 blocks, lines 97-1479. The bar is 400 significant lines; this is 395 over it, 1.99× 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: CyberStrikeAITab plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:12 — ClassTooLong — 631 significant lines (blank, comment-only and punctuation-only lines excluded), 42 methods. The bar is 400 significant lines; this is 231 over it, 1.58× 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: WebShellHandler REDACTED:326 — ClassTooLong — 567 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods, 20 blocks, lines 201-1098. The bar is 400 significant lines; this is 167 over it, 1.42× 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: Executor internal/security/executor.go:34 — ClassTooLong — 556 significant lines (blank, comment-only and punctuation-only lines excluded), 16 methods, 17 blocks, lines 34-1496. The bar is 400 significant lines; this is 156 over it, 1.39× 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: Manager internal/c2/manager.go:27 — ClassTooLong — 517 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods, 24 blocks, lines 27-941. The bar is 400 significant lines; this is 117 over it, 1.29× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Manager internal/knowledge/manager.go:18 — ClassTooLong — 473 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods, 18 blocks, lines 18-885. The bar is 400 significant lines; this is 73 over it, 1.18× 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: AgentTaskManager internal/handler/task_manager.go:326 — ClassTooLong — 471 significant lines (blank, comment-only and punctuation-only lines excluded), 34 methods, 31 blocks, lines 76-821. The bar is 400 significant lines; this is 71 over it, 1.18× 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: MonitorHandler internal/handler/monitor.go:24 — ClassTooLong — 469 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods, 26 blocks, lines 24-1012. The bar is 400 significant lines; this is 69 over it, 1.17× 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: FofaHandler REDACTED:25 — ClassTooLong — 420 significant lines (blank, comment-only and punctuation-only lines excluded), 9 methods, 10 blocks, lines 25-1117. The bar is 400 significant lines; this is 20 over it, 1.05× 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: SkillsHandler internal/handler/skills.go:22 — ClassTooLong — 415 significant lines (blank, comment-only and punctuation-only lines excluded), 18 methods, 19 blocks, lines 22-663. The bar is 400 significant lines; this is 15 over it, 1.04× 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.
AC6 · Visual & motion safety · Animation without a prefers-reduced-motion guard · ×17
  • Animation without a prefers-reduced-motion guard web/templates/api-docs.html:100 — `.auth-info-body` moves (`animation: slideDown 0.2s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/templates/api-docs.html:471 — `.description-toggle-icon` moves (`transition: transform 0.2s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/templates/api-docs.html:478 — `.api-description-detail` moves (`animation: slideDown 0.2s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/templates/api-docs.html:814 — `.loading-spinner` moves (`animation: spin 0.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.
  • Animation without a prefers-reduced-motion guard web/static/css/c2.css:412 — `.c2-form-select-caret` moves (`transition: transform 0.15s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/c2.css:1203 — `.c2-session-item` moves (`transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, transform 0.15s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/c2.css:1275 — `.c2-session-live-dot.active` moves (`animation: c2-pulse-dot 2.2s ease-in-out 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.
  • Animation without a prefers-reduced-motion guard web/static/css/c2.css:1752 — `.c2-file-upload-progress-fill` moves (`transition: width 0.2s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/c2.css:4098 — `.c2-modal` moves (`animation: c2-slide-up 0.18s ease-out`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/chat-plan-progress.css:160 — `.agent-plan-task-status--in_progress` moves (`animation: agent-plan-spin 820ms 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.
  • Animation without a prefers-reduced-motion guard web/static/css/design-system.css:103 — `html body [data-ui-surface="drawer"] > :is(.modal-content, .projects-modal-dialog, .c2-modal)` moves (`animation: app-panel-in .18s ease-out`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/mobile.css:545 — `.m-tab` moves (`transition: color 0.16s ease, transform 0.16s ease`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/mobile.css:933 — `.modal-content` moves (`animation: m-sheet-up 0.26s var(--m-ease)`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/mobile.css:1285 — `.m-chat-bar-btn` moves (`transition: transform 0.12s var(--m-ease), background 0.15s`) 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.
  • Animation without a prefers-reduced-motion guard web/static/css/mobile.css:3277 — `.m-tab` moves (`transition: transform 0.12s ease, background-color 0.12s ease, color 0.16s ease, opacity 0.12s ease`) 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.
  • Animation without a prefers-reduced-motion guard plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:351 — `.btn` moves (`transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s`) 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.
  • Animation without a prefers-reduced-motion guard plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:920 — `.cs-select-caret` moves (`transition: transform 0.15s ease`) 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.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×17
  • Duplicated block (8 lines × 2) internal/config/config.go:1808 — internal/config/config.go:1808-1815 | internal/config/config.go:1849-1856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) REDACTED:1378 — REDACTED:1378-1385 | REDACTED:1776-1783 — 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:1378` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) internal/handler/agent.go:1490 — internal/handler/agent.go:1490-1497 | internal/handler/agent.go:1512-1519 — 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/handler/agent.go:1490` 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) REDACTED:1282 — REDACTED:1282-1289 | REDACTED:1363-1370 — 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/handler/config.go:1037 — internal/handler/config.go:1037-1044 | internal/handler/config.go:2003-2010 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) internal/handler/hitl.go:838 — internal/handler/hitl.go:838-845 | REDACTED:185-192 — 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/handler/hitl.go:838` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) internal/handler/markdown_agents.go:330 — internal/handler/markdown_agents.go:330-337 | internal/handler/markdown_agents.go:352-359 — 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/handler/markdown_agents.go:330` 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) internal/handler/multi_agent.go:40 — internal/handler/multi_agent.go:40-47 | internal/handler/single_agent.go:27-34 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) internal/handler/task_manager.go:77 — internal/handler/task_manager.go:77-84 | internal/handler/task_manager.go:91-98 — 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/handler/task_manager.go:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) internal/knowledge/manager.go:401 — internal/knowledge/manager.go:401-408 | internal/knowledge/manager.go:488-495 — 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/knowledge/manager.go:401` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `m *Manager) SearchItemsByKeyword(keyword` in one and `m *Manager) GetItemsSummary(category` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) internal/knowledge/manager.go:660 — internal/knowledge/manager.go:660-667 | internal/knowledge/manager.go:715-722 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) internal/security/executor.go:197 — internal/security/executor.go:197-204 | internal/security/executor.go:850-857 — 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/security/executor.go:197` 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) internal/agentfinalizer/decision.go:190 — internal/agentfinalizer/decision.go:190-197 | internal/multiagent/empty_response.go:20-27 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) REDACTED:771 — REDACTED:771-778 | REDACTED:876-883 — 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:771` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) internal/processguard/platform_linux.go:214 — internal/processguard/platform_linux.go:214-221 | REDACTED:95-102 — 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/processguard/platform_linux.go:214` 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) internal/handler/multi_agent.go:456 — internal/handler/multi_agent.go:456-463 | internal/handler/single_agent.go:437-444 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:456` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (8 lines × 2) internal/robot/slack.go:88 — internal/robot/slack.go:88-95 | internal/robot/slack.go:102-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/robot/slack.go:88` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×17
  • Duplicated block (7 lines × 2) internal/app/mcp_authorization.go:33 — internal/app/mcp_authorization.go:33-39 | internal/app/mcp_authorization.go:298-304 — 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/app/mcp_authorization.go:33` 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 (7 lines × 2) REDACTED:516 — REDACTED:516-522 | REDACTED:608-614 — 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/handler/c2.go:376 — internal/handler/c2.go:376-382 | internal/handler/c2.go:567-573 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/c2.go:376` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/handler/hitl.go:818 — internal/handler/hitl.go:818-824 | REDACTED:164-170 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) internal/openai/openai.go:218 — internal/openai/openai.go:218-225 | internal/openai/openai.go:369-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/openai/openai.go:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 2) internal/security/executor.go:204 — internal/security/executor.go:204-210 | internal/security/executor.go:216-222 — 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/security/executor.go:204` 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) internal/security/executor.go:857 — internal/security/executor.go:857-863 | internal/security/executor.go:868-874 — 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/security/executor.go:857` 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) internal/handler/hitl.go:826 — internal/handler/hitl.go:826-832 | REDACTED:173-179 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) REDACTED:299 — REDACTED:299-305 | REDACTED:308-314 — 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/handler/project.go:628 — internal/handler/project.go:628-634 | internal/handler/project.go:649-655 — 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/handler/project.go:628` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) internal/app/vulnerability_tools.go:179 — internal/app/vulnerability_tools.go:179-185 | internal/project/scope_block.go:69-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) internal/openai/openai.go:584 — internal/openai/openai.go:584-592 | internal/typesafe/client.go:178-184 — 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 `internal/openai/openai.go:584` 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 (7 lines × 2) internal/handler/agent.go:1701 — internal/handler/agent.go:1701-1707 | internal/handler/agent.go:1730-1737 — 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/handler/agent.go:1701` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/config/config.go:1818 — internal/config/config.go:1818-1825 | internal/config/config.go:1858-1864 — 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/config/config.go:1818` 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 (7 lines × 2) REDACTED:1184 — REDACTED:1184-1190 | internal/handler/markdown_agents.go:352-358 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1184` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) internal/handler/external_mcp.go:203 — internal/handler/external_mcp.go:203-209 | internal/handler/external_mcp.go:242-248 — 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/handler/external_mcp.go:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) REDACTED:156 — REDACTED:156-162 | REDACTED:830-836 — 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:156` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×16
  • Duplicated block (11 lines × 2) REDACTED:228 — REDACTED:228-238 | REDACTED:2140-2150 — 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:228` 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/app/project_fact_tools.go:336 — internal/app/project_fact_tools.go:336-346 | internal/app/project_fact_tools.go:371-381 — 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) internal/config/config.go:2147 — internal/config/config.go:2147-2157 | internal/config/config.go:2209-2219 — 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/config/config.go:2147` 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) REDACTED:652 — REDACTED:652-662 | REDACTED:672-682 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) REDACTED:523 — REDACTED:523-533 | REDACTED:595-605 — 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:523` 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 (11 lines × 2) internal/handler/config.go:1374 — internal/handler/config.go:1374-1384 | internal/handler/config.go:1415-1425 — 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) internal/handler/config.go:2458 — internal/handler/config.go:2458-2468 | internal/handler/hitl.go:321-331 — 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) internal/handler/hitl.go:342 — internal/handler/hitl.go:342-352 | internal/multiagent/tool_metadata.go:39-49 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (11 lines × 2) internal/handler/workflow_run.go:27 — internal/handler/workflow_run.go:27-37 | internal/handler/workflow_run.go:113-123 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/workflow_run.go:27` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/openai/openai.go:265 — internal/openai/openai.go:265-275 | internal/openai/openai.go:431-441 — 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) internal/handler/config.go:933 — internal/handler/config.go:933-943 | internal/handler/config.go:1974-1984 — 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) internal/mcp/external_manager.go:154 — internal/mcp/external_manager.go:154-164 | internal/mcp/server.go:141-151 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `int` to `m *ExternalMCPManager) ConfigureToolResultMaxBytes(maxBytes` in one and `s *Server) ConfigureToolResultMaxBytes(maxBytes` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) internal/mcp/external_manager.go:168 — internal/mcp/external_manager.go:168-178 | internal/mcp/server.go:155-165 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `m *ExternalMCPManager) ConfigureToolResultSpillRoot(rootDir` in one and `s *Server) ConfigureToolResultSpillRoot(rootDir` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) internal/handler/hitl.go:703 — internal/handler/hitl.go:703-713 | internal/handler/hitl.go:775-785 — 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/handler/hitl.go:703` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) internal/database/project_fact_edges.go:166 — internal/database/project_fact_edges.go:166-176 | internal/database/project_fact_edges.go:210-220 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/database/project_fact_edges.go:166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) internal/handler/config.go:1432 — internal/handler/config.go:1432-1442 | internal/handler/config.go:1707-1717 — 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/handler/config.go:1432` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×15
  • Duplicated block (6 lines × 2) REDACTED:256 — REDACTED:256-261 | REDACTED:2168-2173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/handler/agent.go:606 — internal/handler/agent.go:606-611 | REDACTED:1462-1467 — 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/handler/agent.go:960 — internal/handler/agent.go:960-965 | internal/handler/batch_queue_executor.go:195-200 — 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/handler/agent.go:960` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/handler/rbac.go:81 — internal/handler/rbac.go:81-86 | internal/handler/rbac.go:230-235 — 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/handler/rbac.go:81` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/workflow/draft_generator.go:152 — internal/workflow/draft_generator.go:152-157 | internal/workflow/draft_generator.go:210-215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/mcp/external_manager.go:111 — internal/mcp/external_manager.go:111-116 | internal/mcp/server.go:87-92 — 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) REDACTED:726 — REDACTED:726-731 | REDACTED:749-756 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) internal/app/asset_tools.go:133 — internal/app/asset_tools.go:133-138 | internal/app/asset_tools.go:175-181 — 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/app/asset_tools.go:133` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (6 lines × 2) REDACTED:347 — REDACTED:347-353 | REDACTED:397-402 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) internal/app/mcp_authorization.go:125 — internal/app/mcp_authorization.go:125-130 | internal/app/mcp_authorization.go:166-171 — 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/app/mcp_authorization.go:125` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) internal/database/schema_reconcile.go:87 — internal/database/schema_reconcile.go:87-92 | internal/database/schema_reconcile.go:129-134 — 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/database/schema_reconcile.go:87` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) internal/knowledge/rerank_http.go:123 — internal/knowledge/rerank_http.go:123-128 | internal/knowledge/rerank_http.go:170-175 — 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/knowledge/rerank_http.go:123` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 2) internal/handler/batch_task_mcp.go:627 — internal/handler/batch_task_mcp.go:627-632 | internal/handler/batch_task_mcp.go:660-665 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/batch_task_mcp.go:627` 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 (6 lines × 2) REDACTED:848 — REDACTED:848-853 | REDACTED:872-877 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:845` calls `parsePositiveIntQuery` and `REDACTED:870` 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) internal/handler/config.go:927 — internal/handler/config.go:927-932 | internal/handler/config.go:1964-1969 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×14
  • Duplicated block (12 lines × 2) REDACTED:108 — REDACTED:108-119 | internal/mcp/server.go:335-346 — 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/mcp/server.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 (12 lines × 2) internal/database/asset.go:726 — internal/database/asset.go:726-737 | REDACTED:287-298 — 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 `internal/database/asset.go:726` 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) internal/handler/agent.go:1805 — internal/handler/agent.go:1805-1816 | internal/handler/agent.go:1820-1831 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) internal/handler/agent.go:2264 — internal/handler/agent.go:2264-2275 | internal/handler/agent.go:2296-2307 — 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 (12 lines × 2) internal/handler/agent_multi_json_runner.go:20 — internal/handler/agent_multi_json_runner.go:20-31 | internal/handler/agent_single_json_runner.go:21-32 — 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 (12 lines × 2) internal/handler/config.go:417 — internal/handler/config.go:417-428 | internal/handler/monitor.go:106-117 — 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 (12 lines × 2) internal/handler/hitl.go:858 — internal/handler/hitl.go:858-869 | internal/handler/hitl.go:886-897 — 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 (12 lines × 2) internal/handler/knowledge.go:396 — internal/handler/knowledge.go:396-408 | internal/knowledge/indexer.go:320-331 — 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 (12 lines × 2) internal/handler/markdown_agents.go:187 — internal/handler/markdown_agents.go:187-198 | internal/handler/markdown_agents.go:280-291 — 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/handler/markdown_agents.go:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/handler/markdown_agents.go:199` calls `Base` and `internal/handler/markdown_agents.go:292` 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 (12 lines × 2) internal/handler/multi_agent.go:282 — internal/handler/multi_agent.go:282-293 | internal/handler/single_agent.go:268-279 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:282` 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 (12 lines × 2) internal/knowledge/rerank_http.go:109 — internal/knowledge/rerank_http.go:109-120 | internal/knowledge/rerank_http.go:156-167 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/knowledge/rerank_http.go:109` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) internal/robot/qq.go:170 — internal/robot/qq.go:170-181 | internal/robot/qq.go:191-202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/robot/qq.go:170` 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) internal/mcp/external_manager.go:183 — internal/mcp/external_manager.go:183-194 | internal/mcp/server.go:183-194 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `int` to `m *ExternalMCPManager) ConfigureToolWaitTimeoutSeconds(seconds` in one and `s *Server) ConfigureToolWaitTimeoutSeconds(seconds` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) internal/knowledge/tool.go:68 — internal/knowledge/tool.go:68-79 | internal/knowledge/tool.go:263-274 — 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/knowledge/tool.go:68` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×13
  • Duplicated block (14 lines × 2) REDACTED:308 — REDACTED:308-321 | REDACTED:2238-2251 — 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:308` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) internal/config/config.go:1762 — internal/config/config.go:1762-1775 | internal/config/config.go:1830-1843 — 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 (14 lines × 2) internal/handler/agent.go:2049 — internal/handler/agent.go:2049-2062 | REDACTED:221-234 — 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/handler/agent.go:2049` 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) internal/handler/batch_task_mcp.go:208 — internal/handler/batch_task_mcp.go:208-221 | internal/handler/batch_task_mcp.go:500-513 — 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 (14 lines × 2) REDACTED:990 — REDACTED:990-1003 | REDACTED:1030-1043 — 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:990` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:528 — REDACTED:528-541 | internal/handler/hitl_audit_agent.go:220-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. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:528` 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 (14 lines × 2) internal/handler/terminal_stream_unix.go:34 — internal/handler/terminal_stream_unix.go:34-47 | internal/handler/terminal_stream_windows.go:53-66 — 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/handler/terminal_stream_unix.go:34` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/terminal_stream_windows.go:52` calls `Wait` and `internal/handler/terminal_stream_unix.go:33` 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 (14 lines × 2) internal/mcp/external_manager.go:810 — internal/mcp/external_manager.go:810-823 | internal/mcp/server.go:979-992 — 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/mcp/external_manager.go:810` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:1382 — REDACTED:1382-1395 | REDACTED:1845-1858 — 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:1382` 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) internal/handler/knowledge.go:256 — internal/handler/knowledge.go:256-269 | internal/handler/knowledge.go:289-302 — 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/handler/knowledge.go:256` 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 (14 lines × 2) internal/app/c2_tools.go:452 — internal/app/c2_tools.go:452-468 | internal/app/c2_tools.go:847-860 — 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/app/c2_tools.go:452` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) internal/knowledge/tool.go:40 — internal/knowledge/tool.go:40-53 | internal/knowledge/tool.go:137-150 — 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/knowledge/tool.go:40` 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:832 — REDACTED:832-845 | REDACTED:850-863 — 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:832` 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.
D3 · God Classes · TooManyMethods · ×11
  • TooManyMethods: DB REDACTED:55 — TooManyMethods — 372 methods, declared across 36 files: REDACTED (51), REDACTED (48), REDACTED (38), database/batch_task.go (24), +32 more file(s). The bar is 30 methods; this is 342 over it, 12.40× 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: AgentHandler internal/handler/agent.go:184 — TooManyMethods — 143 methods, declared across 24 files: handler/agent.go (50), handler/hitl.go (20), REDACTED (12), handler/async_agent_runs.go (9), +20 more file(s). The bar is 30 methods; this is 113 over it, 4.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: RobotHandler REDACTED:79 — TooManyMethods — 68 methods, declared across 2 files: REDACTED (64), handler/vulnerability_alert.go (4). The bar is 30 methods; this is 38 over it, 2.27× 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: ExternalMCPManager internal/mcp/external_manager.go:53 — TooManyMethods — 67 methods, declared across 2 files: mcp/external_manager.go (58), mcp/connection_recovery.go (9). The bar is 30 methods; this is 37 over it, 2.23× 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: Server internal/mcp/server.go:37 — TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× 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: ConfigHandler internal/handler/config.go:77 — TooManyMethods — 47 methods, declared across 4 files: handler/config.go (39), handler/tool_guard.go (6), handler/config_probe_headers.go (1), handler/config_secrets.go (1). The bar is 30 methods; this is 17 over it, 1.57× 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: CyberStrikeAITab plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:12 — TooManyMethods — 42 methods. The bar is 30 methods; this is 12 over it, 1.40× 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: BatchTaskManager internal/handler/batch_task_manager.go:97 — TooManyMethods — 40 methods. The bar is 30 methods; this is 10 over it, 1.33× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: C2Handler internal/handler/c2.go:29 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× 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: ChatUploadsHandler REDACTED:43 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× 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: AgentTaskManager internal/handler/task_manager.go:326 — TooManyMethods — 34 methods, declared across 2 files: handler/task_manager.go (30), handler/hitl_cognition.go (4). The bar is 30 methods; this is 4 over it, 1.13× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×11
  • Duplicated block (5 lines × 2) REDACTED:1630 — REDACTED:1630-1634 | REDACTED:1664-1668 — 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:1630` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/app/project_fact_tools.go:246 — internal/app/project_fact_tools.go:246-258 | internal/app/vulnerability_tools.go:374-378 — 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/app/project_fact_tools.go:246` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) REDACTED:732 — REDACTED:732-736 | REDACTED:837-841 — 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:732` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `db *DB) lookupRBACResourceOptionsByIDs(resourceType` in one and `resourceType` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:842` calls `New` and `REDACTED:737` 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 (5 lines × 2) REDACTED:1258 — REDACTED:1258-1262 | internal/handler/markdown_agents.go:181-185 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1258` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/handler/knowledge.go:211 — internal/handler/knowledge.go:211-217 | internal/handler/knowledge.go:458-462 — 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/handler/knowledge.go:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) internal/openai/summarization_diag.go:58 — internal/openai/summarization_diag.go:58-62 | internal/openai/summarization_diag.go:65-70 — 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/openai/summarization_diag.go:58` 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 (5 lines × 2) internal/handler/hitl.go:1149 — internal/handler/hitl.go:1149-1153 | internal/handler/hitl_audit_agent.go:366-370 — 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/handler/hitl.go:1149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) REDACTED:403 — REDACTED:403-407 | REDACTED:412-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. 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) internal/update/apply.go:723 — internal/update/apply.go:723-727 | internal/update/apply.go:795-799 — 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/update/apply.go:723` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) internal/handler/token_usage.go:19 — internal/handler/token_usage.go:19-23 | internal/handler/token_usage.go:35-39 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/token_usage.go:19` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:433 — plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:433-437 | plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SimpleJson.java:42-46 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:433` 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.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×9
  • Edited copy of a member (11 corresponding lines) internal/handler/agent.go:796 — internal/handler/agent.go:796-806 | internal/handler/agent.go:816-827 — 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) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SendOptionsDialog.java:187 — plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SendOptionsDialog.java:187-197 | plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SendOptionsDialog.java:199-209 — 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) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:658 — plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:658-668 | plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:670-680 — 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) internal/update/apply.go:91 — internal/update/apply.go:91-101 | internal/update/apply.go:124-135 — 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) internal/handler/config.go:2723 — internal/handler/config.go:2723-2734 | internal/handler/config.go:2789-2799 — 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) internal/database/project.go:176 — internal/database/project.go:176-186 | REDACTED:670-680 — 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) REDACTED:24 — REDACTED:24-35 | internal/handler/skills.go:700-710 — 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) REDACTED:565 — REDACTED:565-575 | internal/project/fact_edges.go:75-85 — 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) internal/mcp/types.go:333 — internal/mcp/types.go:333-344 | internal/project/blackboard.go:12-22 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×8
  • Edited copy of a member (14 corresponding lines) internal/handler/rbac.go:188 — internal/handler/rbac.go:188-203 | internal/handler/rbac.go:341-354 — 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/project/workspace.go:27 — internal/project/workspace.go:27-40 | internal/tooloutput/spill.go:57-70 — 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/config/config.go:1672 — internal/config/config.go:1672-1689 | internal/config/config.go:1694-1707 — 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/database/workflow.go:139 — internal/database/workflow.go:139-152 | internal/database/workflow.go:355-368 — 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/project/fact_edges.go:268 — internal/project/fact_edges.go:268-283 | internal/project/fact_template.go:24-37 — 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/handler/batch_task_manager.go:1247 — internal/handler/batch_task_manager.go:1247-1260 | internal/handler/batch_task_manager.go:1263-1279 — 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/security/auth_manager.go:273 — internal/security/auth_manager.go:273-286 | internal/security/auth_manager.go:290-306 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) REDACTED:441 — REDACTED:441-454 | REDACTED:470-490 — 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.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×8
  • Edited copy of a member (12 corresponding lines) internal/handler/project.go:560 — internal/handler/project.go:560-571 | internal/handler/project.go:579-590 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/multiagent/runtime_dispatch.go:28 — internal/multiagent/runtime_dispatch.go:28-39 | internal/multiagent/runtime_dispatch.go:57-68 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/database/webshell.go:134 — internal/database/webshell.go:134-145 | internal/database/webshell.go:148-164 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:645 — plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:645-656 | plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:719-730 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/handler/knowledge.go:227 — internal/handler/knowledge.go:227-238 | REDACTED:140-151 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/robot/discord.go:110 — internal/robot/discord.go:110-121 | internal/robot/slack.go:123-135 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/handler/config.go:2474 — internal/handler/config.go:2474-2485 | internal/handler/config.go:2488-2500 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) internal/security/executor.go:1108 — internal/security/executor.go:1108-1123 | internal/tooloutput/spill.go:190-201 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×8
  • Duplicated block (13 lines × 2) internal/agentfinalizer/decision.go:222 — internal/agentfinalizer/decision.go:222-234 | internal/agentfinalizer/decision.go:248-260 — 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/agentfinalizer/decision.go:222` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) internal/c2/listener_http.go:162 — internal/c2/listener_http.go:162-174 | internal/c2/listener_http.go:284-296 — 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 (13 lines × 2) REDACTED:732 — REDACTED:732-744 | REDACTED:1135-1147 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `db *DB) lookupRBACResourceOptionsByIDs(resourceType` in one and `message` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 2) internal/database/storage_activity.go:19 — internal/database/storage_activity.go:19-31 | internal/database/storage_activity.go:42-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. Read the line range as the matched WINDOW rather than a finished unit: at `internal/database/storage_activity.go:19` 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/handler/attackchain.go:57 — internal/handler/attackchain.go:57-69 | internal/handler/attackchain.go:125-137 — 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 (13 lines × 2) REDACTED:503 — REDACTED:503-515 | REDACTED:640-652 — 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:503` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) internal/handler/config.go:2070 — internal/handler/config.go:2070-2082 | internal/handler/external_mcp.go:383-395 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/config.go:2067` calls `NormalizeAIProviderProfiles` and `internal/handler/external_mcp.go:382` 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 (13 lines × 2) internal/handler/multi_agent.go:149 — internal/handler/multi_agent.go:149-161 | internal/handler/single_agent.go:131-144 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/multi_agent.go:147` calls `TrimSpace` and `internal/handler/single_agent.go:129` 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.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×8
  • Duplicated block (10 lines × 3) internal/handler/batch_task_mcp.go:126 — internal/handler/batch_task_mcp.go:126-135 | internal/handler/batch_task_mcp.go:318-327 | internal/handler/batch_task_mcp.go:487-496 — 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/handler/batch_task_mcp.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 (10 lines × 3) REDACTED:461 — REDACTED:461-470 | REDACTED:537-546 | REDACTED:609-618 — 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, `REDACTED:472` calls `Join` and `REDACTED:619` 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 × 3) REDACTED:1044 — REDACTED:1044-1053 | REDACTED:1330-1339 | REDACTED:1417-1426 — 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 before the matched lines, `REDACTED:1415` calls `TrimSpace`, `PostForm` and `REDACTED:1043` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 3) internal/handler/multi_agent.go:362 — internal/handler/multi_agent.go:362-371 | internal/handler/single_agent.go:348-357 | internal/handler/workflow_integration.go:146-155 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:362` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) REDACTED:567 — REDACTED:567-576 | REDACTED:674-683 | REDACTED:1009-1019 — 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 `REDACTED:567` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) internal/attackchain/builder.go:343 — internal/attackchain/builder.go:343-352 | internal/attackchain/builder.go:356-365 | internal/attackchain/builder.go:369-379 — 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/attackchain/builder.go:343` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) REDACTED:790 — REDACTED:790-799 | REDACTED:1375-1384 | REDACTED:1797-1806 — 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 `REDACTED:790` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 3) internal/update/apply.go:454 — internal/update/apply.go:454-463 | internal/update/apply.go:468-477 | internal/update/apply.go:535-544 — 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/update/apply.go:454` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×7
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/app/c2_tools.go:54 — internal/app/c2_tools.go:54-231 | internal/app/c2_tools.go:237-341 | internal/app/c2_tools.go:532-634 | internal/app/c2_tools.go:689-835 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/database/asset.go:961 — internal/database/asset.go:961-1064 | internal/database/asset.go:1073-1109 | internal/database/asset.go:1113-1177 | internal/database/asset.go:1182-1226 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) REDACTED:764 — REDACTED:764-799 | REDACTED:1349-1384 | REDACTED:1455-1474 | REDACTED:1771-1806 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/handler/agent.go:951 — internal/handler/agent.go:951-965 | internal/handler/batch_queue_executor.go:113-353 | internal/handler/multi_agent.go:23-445 | internal/handler/single_agent.go:22-431 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/handler/c2.go:239 — internal/handler/c2.go:239-253 | internal/handler/c2.go:276-290 | internal/handler/c2.go:597-649 | internal/handler/c2.go:652-670 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/handler/config.go:1368 — internal/handler/config.go:1368-1405 | internal/handler/config.go:1408-1526 | internal/handler/config.go:1538-1589 | internal/handler/config.go:1601-1671 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) internal/knowledge/manager.go:253 — internal/knowledge/manager.go:253-348 | internal/knowledge/manager.go:369-451 | internal/knowledge/manager.go:454-538 | internal/knowledge/manager.go:541-595 — 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 (17 corresponding lines) · ×7
  • Edited copy of a member (17 corresponding lines) internal/handler/asset.go:373 — internal/handler/asset.go:373-393 | internal/handler/asset.go:395-411 — 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) internal/database/project.go:640 — internal/database/project.go:640-659 | internal/database/project.go:661-677 — 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) internal/handler/agent.go:2076 — internal/handler/agent.go:2076-2092 | internal/handler/agent.go:2372-2394 — 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) internal/processguard/platform_linux.go:210 — internal/processguard/platform_linux.go:210-226 | REDACTED:91-108 — 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) internal/agents/markdown.go:202 — internal/agents/markdown.go:202-218 | internal/skillpackage/content.go:68-87 — 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) internal/database/asset.go:705 — internal/database/asset.go:705-721 | internal/database/pi_sessions.go:31-48 — 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) REDACTED:827 — REDACTED:827-845 | REDACTED:847-863 — 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 (13 corresponding lines) · ×7
  • Edited copy of a member (13 corresponding lines) internal/handler/finalization_helpers.go:85 — internal/handler/finalization_helpers.go:85-97 | internal/handler/finalization_helpers.go:120-142 — 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) internal/handler/token_usage.go:17 — internal/handler/token_usage.go:17-29 | internal/handler/token_usage.go:32-45 — 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:108 — REDACTED:108-120 | REDACTED: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) internal/workflow/graph_types.go:92 — internal/workflow/graph_types.go:92-104 | internal/workflow/graph_types.go:106-118 — 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) internal/robot/slack.go:83 — internal/robot/slack.go:83-98 | internal/robot/slack.go:100-112 — 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:280 — REDACTED:280-292 | REDACTED:1022-1039 — 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) internal/handler/hitl_cognition.go:37 — internal/handler/hitl_cognition.go:37-49 | internal/handler/hitl_cognition.go:52-68 — 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.
D3 · God Classes · TooManyFields · ×6
  • TooManyFields: AgentTuningConfig internal/config/config.go:156 — TooManyFields — 38 stored fields beside 16 methods. The bar is 30 stored fields; this is 8 over it, 1.27× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Asset internal/database/asset.go:21 — TooManyFields — 34 stored fields. The bar is 30 stored fields; this is 4 over it, 1.13× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: App REDACTED:46 — TooManyFields — 33 stored fields beside 11 methods. The bar is 30 stored fields; this is 3 over it, 1.10× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: ExternalMCPManager internal/mcp/external_manager.go:53 — TooManyFields — 32 stored fields beside 67 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: Config internal/config/config.go:23 — TooManyFields — 32 stored fields beside 5 methods. The bar is 30 stored fields; this is 2 over it, 1.07× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
  • TooManyFields: AssetListFilter internal/database/asset.go:58 — TooManyFields — 31 stored fields. The bar is 30 stored fields; this is 1 over it, 1.03× the bar. This is width in DATA, not behaviour: every reader that takes the whole type couples to all of its fields, so a change to any one of them is a change every reader has to be checked against. To reduce it, group the fields that are read together by the same callers into a smaller type of their own, and have this one hold that type as a single member — each reader then names only the group it uses.
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×6
  • Edited copy of a member (16 corresponding lines) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:229 — plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:229-244 | plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:279-295 — 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/database/asset.go:923 — internal/database/asset.go:923-938 | internal/handler/config.go:1350-1365 — 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/monitor/reconcile.go:36 — internal/monitor/reconcile.go:36-51 | internal/monitor/reconcile.go:69-84 — 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/database/project.go:155 — internal/database/project.go:155-173 | internal/database/project_fact_edges.go:244-259 — 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/attackchain/truncate.go:193 — internal/attackchain/truncate.go:193-208 | internal/attackchain/truncate.go:210-225 — 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) REDACTED:306 — REDACTED:306-321 | REDACTED:334-350 — 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 (10 corresponding lines) · ×6
  • Edited copy of a member (10 corresponding lines) internal/database/project.go:234 — internal/database/project.go:234-243 | internal/database/project.go:245-255 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/handler/agent.go:1834 — internal/handler/agent.go:1834-1843 | internal/handler/agent.go:1846-1855 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/config/envexpand.go:77 — internal/config/envexpand.go:77-86 | internal/reasoning/provider.go:109-118 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/mcp/external_manager.go:1014 — internal/mcp/external_manager.go:1014-1023 | internal/mcp/server.go:1288-1297 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/handler/skills.go:44 — internal/handler/skills.go:44-54 | internal/skillpackage/layout.go:25-34 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) internal/security/procattr_unix.go:11 — internal/security/procattr_unix.go:11-20 | internal/security/procattr_windows.go:13-23 — 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×6
  • Low cohesion: DB (LCOM4 150) REDACTED:55 — DB's methods fall into 150 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 150 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AgentTuningConfig (LCOM4 15) internal/config/config.go:156 — AgentTuningConfig's methods fall into 15 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 15 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: VisionConfig (LCOM4 8) internal/config/vision.go:6 — VisionConfig's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: HitlConfig (LCOM4 7) internal/config/config.go:1033 — HitlConfig's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: StorageConfig (LCOM4 4) internal/config/config.go:1345 — StorageConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: AuditConfig (LCOM4 4) internal/config/config.go:1424 — AuditConfig's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×5
  • Edited copy of a member (18 corresponding lines) internal/handler/config.go:2454 — internal/handler/config.go:2454-2471 | internal/handler/hitl.go:314-333 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:599 — REDACTED:599-616 | internal/knowledge/manager.go:137-154 — 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/database/workflow.go:236 — internal/database/workflow.go:236-253 | internal/database/workflow.go:279-296 — 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/config/config.go:761 — internal/config/config.go:761-778 | internal/config/config.go:780-797 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:982 — REDACTED:982-999 | REDACTED:1338-1358 — 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 (7 corresponding lines) · ×5
  • Edited copy of a member (7 corresponding lines) internal/handler/asset.go:534 — internal/handler/asset.go:534-540 | internal/handler/project.go:230-236 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/app/asset_tools.go:417 — internal/app/asset_tools.go:417-423 | internal/app/c2_tools.go:677-683 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) REDACTED:162 — REDACTED:162-168 | REDACTED:1065-1071 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/handler/c2.go:1242 — internal/handler/c2.go:1242-1248 | REDACTED:332-338 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) internal/robot/discord.go:19 — internal/robot/discord.go:19-25 | internal/robot/telegram.go:71-77 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) internal/database/project_fact_edges.go:177 — internal/database/project_fact_edges.go:177-184 | internal/database/project_fact_edges.go:225-232 | internal/database/project_fact_edges.go:278-285 — 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/database/project_fact_edges.go:177` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 3) internal/handler/asset.go:346 — internal/handler/asset.go:346-353 | internal/handler/asset.go:375-382 | internal/handler/asset.go:397-404 — 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 (8 lines × 3) REDACTED:523 — REDACTED:523-530 | REDACTED:595-602 | REDACTED:660-667 — 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 `REDACTED:523` 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 (8 lines × 3) internal/handler/external_mcp.go:197 — internal/handler/external_mcp.go:197-204 | internal/handler/external_mcp.go:273-280 | internal/handler/external_mcp.go:328-335 — 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 (8 lines × 3) internal/handler/audit_query.go:40 — internal/handler/audit_query.go:40-47 | internal/handler/c2.go:495-502 | internal/handler/c2.go:892-899 — 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/handler/audit_query.go:40` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X2 · Cancellation propagation · Async function without AbortSignal · ×5
  • Async function without AbortSignal: loadAPISpec web/static/js/api-docs.js:100 — `loadAPISpec` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: testAPI web/static/js/api-docs.js:629 — `testAPI` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: apiFetch web/static/js/auth.js:201 — `apiFetch` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: logout web/static/js/auth.js:972 — `logout` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
  • Async function without AbortSignal: loadLanguageResources web/static/js/i18n.js:53 — `loadLanguageResources` awaits `fetch(…)` but neither accepts an AbortSignal nor passes one on, so its caller cannot stop the request once it has started. Accept `{ signal }` and pass it through: `fetch(url, { signal })`.
AC4 · Keyboard semantics · Modal dialog does not manage focus · ×4
  • Modal dialog does not manage focus web/static/js/audit-datetime-picker.js:118 — This <div role="dialog"> is a modal dialog, but nothing moves focus into it when it opens and nothing keeps focus inside it while it is open, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus web/static/js/chat.js:10470 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus web/static/js/projects.js:2901 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
  • Modal dialog does not manage focus web/static/js/rbac.js:699 — This <div role="dialog"> is a modal dialog, but focus is moved into it, but nothing keeps it there: Tab walks out to the page behind, so a keyboard or screen-reader user keeps acting on the content behind it (WCAG 2.4.3). Use a native <dialog> opened with showModal(), a dialog component that traps focus, or move focus to the dialog on open, trap Tab inside it (or make the page behind inert) and return focus to the control that opened it on close.
AC4 · Keyboard semantics · Anchor without href · ×4
  • Anchor without href REDACTED:597 — An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
  • Anchor without href REDACTED:758 — An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
  • Anchor without href REDACTED:820 — An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
  • Anchor without href REDACTED:850 — An <a> with no href, role or tabindex isn't focusable or keyboard-activatable. Give it a real href, or use a <button> for an action.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium CVE · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×4
  • Edited copy of a member (28 corresponding lines) internal/app/main_server_tls.go:103 — internal/app/main_server_tls.go:103-133 | internal/c2/listener_http.go:534-561 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) REDACTED:155 — REDACTED:155-182 | REDACTED:829-864 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) REDACTED:98 — REDACTED:98-131 | REDACTED:1481-1508 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) internal/c2/crypto.go:62 — internal/c2/crypto.go:62-89 | internal/c2/crypto.go:116-143 — 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 (24 corresponding lines) · ×4
  • Edited copy of a member (24 corresponding lines) REDACTED:479 — REDACTED:479-502 | REDACTED:504-529 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/handler/task_manager.go:247 — internal/handler/task_manager.go:247-270 | internal/handler/task_manager.go:273-296 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) internal/agentfinalizer/decision.go:216 — internal/agentfinalizer/decision.go:216-241 | internal/agentfinalizer/decision.go:243-266 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) REDACTED:488 — REDACTED:488-511 | REDACTED:541-566 — 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 (22 corresponding lines) · ×4
  • Edited copy of a member (22 corresponding lines) internal/handler/rbac.go:79 — internal/handler/rbac.go:79-100 | internal/handler/rbac.go:228-249 — 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) REDACTED:579 — REDACTED:579-604 | REDACTED:372-393 — 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/handler/hitl.go:336 — internal/handler/hitl.go:336-362 | internal/multiagent/tool_metadata.go:36-57 — 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/storage/category.go:174 — internal/storage/category.go:174-202 | internal/storage/category.go:267-288 — 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 (20 corresponding lines) · ×4
  • Edited copy of a member (20 corresponding lines) REDACTED:1836 — REDACTED:1836-1855 | REDACTED:1858-1882 — 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/mcp/external_manager.go:1096 — internal/mcp/external_manager.go:1096-1115 | internal/mcp/server.go:1329-1348 — 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/robot/qq.go:169 — internal/robot/qq.go:169-188 | internal/robot/qq.go:190-209 — 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/agent/token_counter.go:24 — internal/agent/token_counter.go:24-43 | internal/knowledge/retrieval_postprocess.go:37-56 — 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 (9 corresponding lines) · ×4
  • Edited copy of a member (9 corresponding lines) internal/agent/agent.go:626 — internal/agent/agent.go:626-635 | internal/handler/attackchain.go:37-45 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/c2/listener.go:61 — internal/c2/listener.go:61-69 | internal/mcp/server.go:911-920 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/database/skill_stats.go:133 — internal/database/skill_stats.go:133-142 | REDACTED:709-717 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) internal/workflow/engine.go:144 — internal/workflow/engine.go:144-152 | internal/workflow/validation.go:327-336 — 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 · Duplicated block (25 lines × 2) · ×4
  • Duplicated block (25 lines × 2) internal/handler/config.go:529 — internal/handler/config.go:529-553 | internal/handler/config.go:584-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 `internal/handler/config.go:529` 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 (25 lines × 2) internal/mcp/external_manager.go:826 — internal/mcp/external_manager.go:826-850 | internal/mcp/server.go:995-1019 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (25 lines × 2) internal/mcp/external_manager.go:979 — internal/mcp/external_manager.go:979-1003 | internal/mcp/server.go:1302-1326 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (25 lines × 2) REDACTED:270 — REDACTED:270-294 | REDACTED:317-341 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:270` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×4
  • Duplicated block (22 lines × 2) REDACTED:1688 — REDACTED:1688-1709 | REDACTED:1728-1749 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1750` calls `scanC2EventRows` and `REDACTED:1710` 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 (22 lines × 2) REDACTED:488 — REDACTED:488-509 | REDACTED:564-585 — 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:488` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) internal/mcp/external_manager.go:1060 — internal/mcp/external_manager.go:1060-1081 | internal/mcp/server.go:787-808 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (22 lines × 2) REDACTED:34 — REDACTED:34-55 | internal/mcp/types.go:131-152 — 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 `REDACTED:34` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Check import visibility before settling on that home: `internal/mcp/types.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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×4
  • Duplicated block (16 lines × 2) internal/c2/crypto.go:40 — internal/c2/crypto.go:40-55 | internal/c2/crypto.go:94-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) REDACTED:618 — REDACTED:618-633 | REDACTED:710-725 — 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:618` 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 lines × 2) internal/handler/agent.go:1932 — internal/handler/agent.go:1932-1947 | internal/handler/agent.go:2187-2202 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/agent.go:1931` calls `NormalizeAgentMode` and `internal/handler/agent.go:2186` 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 (16 lines × 2) REDACTED:573 — REDACTED:573-588 | REDACTED:605-620 — 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:573` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×4
  • Duplicated block (14 lines × 3) internal/database/c2_http_auth.go:48 — internal/database/c2_http_auth.go:48-61 | REDACTED:1207-1220 | REDACTED:1224-1237 — 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/database/c2_http_auth.go:48` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 3) REDACTED:175 — REDACTED:175-188 | REDACTED:195-208 | REDACTED:215-228 — 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 `REDACTED:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 3) REDACTED:473 — REDACTED:473-486 | REDACTED:549-562 | REDACTED:619-632 — 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 `REDACTED:473` 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, `REDACTED:472` calls `Join` and `REDACTED:618` 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 (14 lines × 3) internal/handler/multi_agent.go:376 — internal/handler/multi_agent.go:376-389 | internal/handler/single_agent.go:362-375 | internal/handler/workflow_integration.go:158-171 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:376` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×4
  • Duplicated block (13 lines × 3) internal/database/asset.go:926 — internal/database/asset.go:926-938 | internal/handler/config.go:1353-1365 | internal/handler/finalization_auto_continue.go:165-177 — 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/database/asset.go:926` 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 (13 lines × 3) REDACTED:766 — REDACTED:766-778 | internal/project/workspace.go:11-23 | internal/tooloutput/spill.go:218-230 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 3) internal/handler/config.go:1492 — internal/handler/config.go:1492-1504 | internal/handler/config.go:1564-1576 | internal/handler/config.go:1752-1764 — 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/handler/config.go:1492` 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 × 3) internal/mcp/execution_control_tools.go:34 — internal/mcp/execution_control_tools.go:34-47 | internal/mcp/execution_control_tools.go:59-73 | internal/mcp/execution_control_tools.go:93-105 — 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/mcp/execution_control_tools.go:34` 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.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×4
  • Duplicated block (9 lines × 3) internal/handler/batch_queue_executor.go:190 — internal/handler/batch_queue_executor.go:190-198 | internal/handler/multi_agent.go:71-79 | internal/handler/single_agent.go:54-62 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) internal/handler/c2.go:584 — internal/handler/c2.go:584-592 | internal/handler/c2.go:688-696 | internal/handler/c2.go:1191-1199 — 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 (9 lines × 3) REDACTED:678 — REDACTED:678-686 | REDACTED:699-707 | REDACTED:720-728 — 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 `REDACTED:678` 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 × 3) REDACTED:920 — REDACTED:920-928 | REDACTED:1007-1015 | REDACTED:1076-1084 — 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 `REDACTED:920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) REDACTED:809 — REDACTED:809-814 | REDACTED:1394-1399 | REDACTED:1816-1821 — 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 (6 lines × 3) internal/handler/config.go:1038 — internal/handler/config.go:1038-1043 | internal/handler/config.go:1865-1870 | internal/handler/config.go:2004-2009 — 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/handler/config.go:2014` calls `RestartRobotConnections` and `internal/handler/config.go:1871` 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 × 3) internal/app/project_fact_tools.go:32 — internal/app/project_fact_tools.go:32-37 | internal/handler/batch_task_mcp.go:768-773 | internal/vision/tool.go:96-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (6 lines × 3) REDACTED:94 — REDACTED:94-99 | internal/handler/project.go:69-74 | REDACTED:120-125 — 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 `REDACTED:94` 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: sendWecomMessageViaAPI REDACTED:1869 — `sendWecomMessageViaAPI` calls `http.Get(…)` but takes no context.Context and reaches none its caller controls, so its caller cannot cancel the request once it has started. Take `ctx context.Context` as the first parameter and build the request with it: `http.NewRequestWithContext(ctx, …)`, `(&net.Dialer{}).DialContext(ctx, …)`.
  • Function without context.Context: ExecWithConnection REDACTED:992 — `ExecWithConnection` 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: FileOpWithConnection REDACTED:1032 — `FileOpWithConnection` 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: newHTTPExecFn internal/handler/webshell_probe.go:70 — `newHTTPExecFn` 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, …)`.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.6 · ×3
  • Low contrast colour pair in CSS (3.6:1) web/templates/api-docs.html:229 — `.api-method.delete` sets color: white on background-color: #f93e3e — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.6:1) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:359 — `.btn--primary` sets color: #fff on background-color: #ea580c — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (3.6:1) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:738 — `.tab.active` sets color: #ea580c on background-color: #ffffff — 3.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (4.1 · ×3
  • Low contrast colour pair in CSS (4.1:1) web/static/css/c2.css:1773 — `.c2-file-table th` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (4.1:1) web/static/css/c2.css:2141 — `.c2-tasks-time-preset-btn` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
  • Low contrast colour pair in CSS (4.1:1) web/static/css/c2.css:3004 — `.c2-events-time-preset-btn` sets color: #6b778a on background-color: #0c1220 — 4.1:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
D15 · Churn × Complexity Hotspots · Repeated repair · ×3
  • Repeated repair: REDACTED REDACTED:5902 — REDACTED changed 62 times in last 90 days and 32 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 1 (its worst body is REDACTED.load at line 5902), 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(ui): migrate remaining detail dialogs to drawers”; “fix(ui): open skill previews in the shared drawer”; “fix(ui): use square corners for detail drawers”; “fix(vulnerabilities): remove empty scope heading space”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +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.
  • Repeated repair: internal/update/update.go internal/update/update.go:266 — internal/update/update.go changed 5 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 15 (its worst body is update.Status at line 266), 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: serialize installation updates and recover interrupted adoption and rollback”; “fix: a rollback keeps a recreated role, and an owed build is finished first”; “fix: a rollback keeps the operator's edits, and a retry really compiles”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/update/update.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/update/build.go internal/update/build.go:74 — internal/update/build.go changed 4 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 9 (its worst body is update.installBinary at line 74), 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: serialize installation updates and recover interrupted adoption and rollback”; “fix: preserve rollback binaries during ambiguous recovery and YAML settings”; “fix: a rollback keeps a recreated role, and an owed build is finished first”. 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-18..2026-11-16, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-08-18 11:43:34 +08:00' --until='2026-11-16 11:43:34 +08:00' --full-history --no-merges -- internal/update/build.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.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:1002 — REDACTED:1002-1062 | REDACTED:1065-1118 | REDACTED:1370-1403 | REDACTED:1406-1426 | REDACTED:1757-1800 | REDACTED:1833-1866 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) internal/handler/external_mcp.go:153 — internal/handler/external_mcp.go:153-218 | internal/handler/external_mcp.go:221-257 | internal/handler/external_mcp.go:260-306 | internal/handler/external_mcp.go:309-339 | REDACTED:96-205 | REDACTED:208-253 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) REDACTED:470 — REDACTED:470-542 | REDACTED:545-567 | REDACTED:570-599 | REDACTED:602-646 | REDACTED:649-670 | REDACTED:673-693 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×3
  • Edited copy of a member (26 corresponding lines) internal/handler/hitl.go:1070 — internal/handler/hitl.go:1070-1102 | internal/handler/hitl.go:1110-1135 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) internal/c2/listener_tcp.go:245 — internal/c2/listener_tcp.go:245-270 | REDACTED:240-265 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) REDACTED:1206 — REDACTED:1206-1236 | REDACTED:1726-1751 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×3
  • Edited copy of a member (21 corresponding lines) internal/c2/crypto.go:39 — internal/c2/crypto.go:39-59 | internal/c2/crypto.go:93-113 — 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/database/storage_activity.go:11 — internal/database/storage_activity.go:11-31 | internal/database/storage_activity.go:34-54 — 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/project/fact_body_links.go:220 — internal/project/fact_body_links.go:220-240 | internal/project/fact_body_links.go:243-263 — 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 · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) internal/app/c2_tools.go:745 — internal/app/c2_tools.go:745-767 | internal/app/c2_tools.go:799-821 — 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/app/c2_tools.go:745` 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 (23 lines × 2) internal/handler/config.go:2284 — internal/handler/config.go:2284-2306 | internal/handler/config.go:2354-2376 — 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 (23 lines × 2) REDACTED:327 — REDACTED:327-349 | internal/handler/skills.go:608-630 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:327` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) internal/app/c2_tools.go:68 — internal/app/c2_tools.go:68-89 | internal/app/c2_tools.go:543-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 `internal/app/c2_tools.go:68` 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 (19 lines × 2) REDACTED:591 — REDACTED:591-609 | REDACTED:639-657 — 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 (19 lines × 2) REDACTED:906 — REDACTED:906-924 | internal/database/skill_stats.go:23-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:906` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×3
  • Duplicated block (18 lines × 2) internal/knowledge/manager.go:267 — internal/knowledge/manager.go:267-284 | internal/knowledge/manager.go:468-485 — 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/knowledge/manager.go:267` 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 (18 lines × 2) internal/handler/batch_task_mcp.go:600 — internal/handler/batch_task_mcp.go:600-621 | internal/handler/batch_task_mcp.go:638-655 — 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/handler/batch_task_mcp.go:600` 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 (18 lines × 2) REDACTED:978 — REDACTED:978-995 | internal/database/skill_stats.go:91-108 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:978` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×3
  • Duplicated block (17 lines × 2) REDACTED:328 — REDACTED:328-344 | REDACTED:2258-2274 — 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:328` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) internal/database/project_fact_edges.go:177 — internal/database/project_fact_edges.go:177-193 | internal/database/project_fact_edges.go:225-241 — 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/database/project_fact_edges.go:177` 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 (17 lines × 2) internal/handler/multi_agent.go:424 — internal/handler/multi_agent.go:424-440 | internal/handler/single_agent.go:410-426 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:424` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) internal/agentfinalizer/decision.go:200 — internal/agentfinalizer/decision.go:200-210 | internal/database/asset.go:924-934 | internal/handler/config.go:1351-1361 — 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/agentfinalizer/decision.go:200` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `db *DB) GetAsset(id` in one and `contextProfile` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 3) internal/handler/agent.go:2278 — internal/handler/agent.go:2278-2288 | internal/handler/agent.go:2310-2320 | internal/handler/agent.go:2377-2387 — 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 (11 lines × 3) internal/handler/c2.go:362 — internal/handler/c2.go:362-372 | internal/handler/c2.go:553-563 | internal/handler/c2.go:941-951 — 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.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×3
  • Duplicated block (9–10 lines × 2) internal/handler/task_manager.go:745 — internal/handler/task_manager.go:745-754 | internal/handler/task_manager.go:799-807 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) internal/mcp/external_manager.go:1482 — internal/mcp/external_manager.go:1482-1491 | internal/mcp/external_manager.go:1520-1528 — 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/external_manager.go:1482` 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–10 lines × 2) internal/security/executor.go:1185 — internal/security/executor.go:1185-1194 | internal/security/executor.go:1340-1348 — 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/security/executor.go:1185` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×3
  • Duplicated block (7 lines × 3) REDACTED:136 — REDACTED:136-142 | REDACTED:210-216 | internal/database/robot_session.go:37-43 — 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.
  • Duplicated block (7 lines × 3) internal/openai/openai.go:116 — internal/openai/openai.go:116-122 | internal/openai/openai.go:209-215 | internal/openai/openai.go:360-366 — 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/openai/openai.go:116` 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/handler/c2.go:1219 — internal/handler/c2.go:1219-1225 | REDACTED:135-141 | REDACTED:546-552 — 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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×3
  • Duplicated block (5 lines × 3) REDACTED:1381 — REDACTED:1381-1385 | REDACTED:1779-1783 | REDACTED:1844-1848 — 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 `REDACTED:1381` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) REDACTED:1558 — REDACTED:1558-1562 | REDACTED:1593-1597 | REDACTED:1625-1629 — 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 `REDACTED:1558` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) REDACTED:1563 — REDACTED:1563-1567 | REDACTED:1630-1634 | REDACTED:1664-1668 — 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 `REDACTED:1563` 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.
R10 · Code Duplication · Duplicated block (25 lines × 2 locations) · ×3
  • Duplicated block (25 lines × 2 locations) web/static/js/chat.js:9860 — web/static/js/chat.js:9860 · web/static/js/projects.js:497 — 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 (25 lines × 2 locations) web/static/js/roles.js:1323 — web/static/js/roles.js:1323 · web/static/js/roles.js:1435 — all 2 copies are in the same file, 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 (25 lines × 2 locations) web/static/js/tasks.js:2596 — web/static/js/tasks.js:2596 · web/static/js/tasks.js:2661 — 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.
R10 · Code Duplication · Duplicated block (21 lines × 2 locations) · ×3
  • Duplicated block (21 lines × 2 locations) web/static/js/api-docs.js:638 — web/static/js/api-docs.js:638 · web/static/js/api-docs.js:738 — all 2 copies are in the same file, 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 (21 lines × 2 locations) web/static/js/c2.js:3281 — web/static/js/c2.js:3281 · web/static/js/c2.js:4223 — 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 (21 lines × 2 locations) web/static/js/dashboard.js:549 — web/static/js/dashboard.js:549 · web/static/js/dashboard.js:1296 — 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.
AC3 · Page structure · Page without a main landmark · ×2
  • Page without a main landmark plugins/browser-extension/cyberstrikeai-browser-extension/popup/popup.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
  • Page without a main landmark web/templates/api-docs.html:2 — No <main> (or role="main") means no "skip to content" target and a weaker landmark map. Wrap the primary content in <main>.
AC3 · Page structure · Empty <h2> heading · ×2
  • Empty <h2> heading REDACTED:6445 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
  • Empty <h2> heading REDACTED:6453 — An empty heading appears in the document outline announced with no text. Give the heading text, or remove it if it's decorative.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.0 · ×2
  • Low contrast colour pair in CSS (2.0:1) web/templates/api-docs.html:214 — `.api-method.post` sets color: white on background-color: #49cc90 — 2.0: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.0:1) web/templates/api-docs.html:224 — `.api-method.put` sets color: white on background-color: #fca130 — 2.0:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.3 · ×2
  • Low contrast colour pair in CSS (2.3:1) web/templates/api-docs.html:219 — `.api-method.get` sets color: white on background-color: #61affe — 2.3: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.3:1) web/static/css/c2.css:2447 — `.c2-status-badge.cancelled` sets color: #94a3b8 on background-color: #f1f5f9 — 2.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.8 · ×2
  • Low contrast colour pair in CSS (2.8:1) web/templates/api-docs.html:732 — `.api-test-btn.clear-result` sets color: white on background-color: #ff6b6b — 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) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.css:776 — `.pane-title` sets color: #6b7280 on background-color: #2a2f38 — 2.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (3.8 · ×2
  • Low contrast colour pair in CSS (3.8:1) web/static/css/c2.css:2092 — `.c2-tasks-stat` sets color: #6b778a on background-color: #131a27 — 3.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 (3.8:1) web/static/css/c2.css:2955 — `.c2-events-stat` sets color: #6b778a on background-color: #131a27 — 3.8:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
D1 · Cyclomatic Complexity · chat.renderProcessDetails · ×2
  • chat.renderProcessDetails::renderOneProcessDetail (cyclomatic 183) web/static/js/chat.js:4299 — chat.renderProcessDetails::renderOneProcessDetail has cyclomatic complexity 183 (threshold 15). To reduce it, separate the cases: extract each independent 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 shape REPEATS in the file: 2 other methods here (chat.renderProcessDetails, chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage (cyclomatic 29) web/static/js/chat.js:4261 — chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage 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. This shape REPEATS in the file: 2 other methods here (chat.renderProcessDetails, chat.renderProcessDetails::renderOneProcessDetail) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · chat-files.renderChatFilesTable · ×2
  • chat-files.renderChatFilesTable::rowHtml (cyclomatic 28) web/static/js/chat-files.js:1029 — chat-files.renderChatFilesTable::rowHtml has cyclomatic complexity 28 (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. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable, chat-files.renderChatFilesTable::rowHtmlTreeFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • chat-files.renderChatFilesTable::rowHtmlTreeFile (cyclomatic 20) web/static/js/chat-files.js:1202 — chat-files.renderChatFilesTable::rowHtmlTreeFile 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. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable, chat-files.renderChatFilesTable::rowHtml) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · selectWebshell · ×2
  • selectWebshell::ensureDbTableColumns (cyclomatic 16) web/static/js/webshell.js:3059 — selectWebshell::ensureDbTableColumns 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.
  • selectWebshell::ensureDbDatabaseColumns (cyclomatic 16) web/static/js/webshell.js:3098 — selectWebshell::ensureDbDatabaseColumns 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.
D2 · Cognitive Complexity · chat-files.renderChatFilesTable · ×2
  • chat-files.renderChatFilesTable::rowHtml (cognitive 28) web/static/js/chat-files.js:1029 — chat-files.renderChatFilesTable::rowHtml has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, ternaries 10, if/else 7. 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. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable, chat-files.renderChatFilesTable::rowHtmlTreeFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
  • chat-files.renderChatFilesTable::rowHtmlTreeFile (cognitive 19) web/static/js/chat-files.js:1202 — chat-files.renderChatFilesTable::rowHtmlTreeFile has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 5. 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. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable, chat-files.renderChatFilesTable::rowHtml) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: chat.js ↔ i18n.js web/static/js/chat.js:1 — `web/static/js/chat.js` and `web/static/js/i18n.js` change together 80% of the time (8 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). Neither file is a module — they declare no import/export and are loaded together into one shared scope by a script tag or a bundle — so there is no dependency edge that COULD be declared between them, and this pass cannot tell a real relationship from a coincidence of release. Read the pair before acting: if one defines what the other uses through the shared global, that is the coupling, and making it explicit (a module boundary, or one named object they both go through) is what removes it; if they duplicate structure, extract the common part; if neither holds, the co-change is incidental and there is nothing to do. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `78973e84` feat: add Russian UI locale (#341); `38b96ec6` feat: add TypeSafe Jev as HITL audit backend; `8e42e72e` Add files via upload — run `git show` on any of them.
  • Change coupling: i18n.js ↔ monitor.js web/static/js/i18n.js:1 — `web/static/js/i18n.js` and `web/static/js/monitor.js` change together 50% of the time (5 of the 10 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). Neither file is a module — they declare no import/export and are loaded together into one shared scope by a script tag or a bundle — so there is no dependency edge that COULD be declared between them, and this pass cannot tell a real relationship from a coincidence of release. Read the pair before acting: if one defines what the other uses through the shared global, that is the coupling, and making it explicit (a module boundary, or one named object they both go through) is what removes it; if they duplicate structure, extract the common part; if neither holds, the co-change is incidental and there is nothing to do. You can check this without leaving the row: of the 5 shared commits counted here, the most recent 3 are `78973e84` feat: add Russian UI locale (#341); `ee9559e0` Add files via upload; `71f6a97a` Add files via upload — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (41 corresponding lines) · ×2
  • Edited copy of a member (41 corresponding lines) REDACTED:334 — REDACTED:334-389 | REDACTED:627-667 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (41 corresponding lines) internal/knowledge/rerank_http.go:101 — internal/knowledge/rerank_http.go:101-141 | internal/knowledge/rerank_http.go:143-190 — These two members are one piece of code written twice and then edited apart: 41 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×2
  • Edited copy of a member (35 corresponding lines) REDACTED:1142 — REDACTED:1142-1204 | REDACTED:1238-1272 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) REDACTED:995 — REDACTED:995-1029 | REDACTED:1522-1589 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) internal/mcp/server.go:1431 — internal/mcp/server.go:1431-1468 | internal/mcp/server.go:1540-1577 — 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.
  • Edited copy of a member (38 corresponding lines) REDACTED:933 — REDACTED:933-974 | internal/database/skill_stats.go:50-87 — 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 (19 corresponding lines) · ×2
  • Edited copy of a member (19 corresponding lines) internal/handler/project.go:614 — internal/handler/project.go:614-636 | internal/handler/project.go:639-657 — 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/knowledge/indexer.go:250 — internal/knowledge/indexer.go:250-268 | internal/knowledge/indexer.go:270-294 — 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 (37 corresponding lines) · ×2
  • Edited copy of a member (37 corresponding lines) internal/config/config.go:2133 — internal/config/config.go:2133-2169 | internal/config/config.go:2195-2239 — These two members are one piece of code written twice and then edited apart: 37 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 (37 corresponding lines) REDACTED:527 — REDACTED:527-563 | internal/handler/hitl_audit_agent.go:219-256 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×2
  • Edited copy of a member (23 corresponding lines) REDACTED:571 — REDACTED:571-600 | REDACTED:688-710 — 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.
  • Edited copy of a member (23 corresponding lines) internal/database/workflow.go:209 — internal/database/workflow.go:209-234 | internal/database/workflow.go:255-277 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×2
  • Edited copy of a member (33 corresponding lines) internal/handler/batch_task_manager.go:917 — internal/handler/batch_task_manager.go:917-949 | internal/handler/batch_task_manager.go:1124-1162 — 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.
  • Edited copy of a member (33 corresponding lines) REDACTED:172 — REDACTED:172-207 | REDACTED:122-154 — 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 copies of one member (3 members, 19+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 19+ corresponding lines) REDACTED:172 — REDACTED:172-190 | REDACTED:192-210 | REDACTED:212-230 — 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.
  • Edited copies of one member (3 members, 19+ corresponding lines) REDACTED:343 — REDACTED:343-361 | REDACTED:727-748 | REDACTED:1031-1055 — 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, 13+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 13+ corresponding lines) internal/handler/c2.go:137 — internal/handler/c2.go:137-151 | internal/handler/c2.go:582-594 | internal/handler/c2.go:1016-1028 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 13+ corresponding lines) internal/handler/batch_task_manager.go:832 — internal/handler/batch_task_manager.go:832-846 | internal/handler/batch_task_manager.go:849-861 | internal/handler/batch_task_manager.go:864-877 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 16+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 16+ corresponding lines) internal/handler/config.go:2674 — internal/handler/config.go:2674-2693 | internal/handler/finalization_auto_continue.go:162-177 | REDACTED:1133-1149 | internal/knowledge/retrieval_postprocess.go:100-122 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 16+ corresponding lines) internal/robot/discord.go:27 — internal/robot/discord.go:27-42 | internal/robot/qq.go:39-57 | internal/robot/slack.go:29-44 | internal/robot/telegram.go:79-94 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 15+ corresponding lines) REDACTED:275 — REDACTED:275-289 | REDACTED:291-305 | REDACTED:307-321 — 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.
  • Edited copies of one member (3 members, 15+ corresponding lines) internal/audit/retention.go:13 — internal/audit/retention.go:13-27 | internal/hitl/retention.go:57-71 | internal/monitor/retention.go:57-71 — 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 (8 corresponding lines) · ×2
  • Edited copy of a member (8 corresponding lines) REDACTED:402 — REDACTED:402-409 | REDACTED:411-418 — 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/mcp/external_manager.go:1005 — internal/mcp/external_manager.go:1005-1012 | internal/mcp/server.go:1279-1286 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×2
  • Edited copy of a member (15 corresponding lines) internal/mcp/execution_control_tools.go:228 — internal/mcp/execution_control_tools.go:228-242 | internal/knowledge/metadata.go:42-56 — 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) internal/mcp/client_sdk.go:176 — internal/mcp/client_sdk.go:176-191 | internal/mcp/client_sdk.go:194-208 — 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.
D4 · Code Duplication · Duplicated block (33 lines × 2) · ×2
  • Duplicated block (33 lines × 2) internal/database/batch_task.go:182 — internal/database/batch_task.go:182-214 | internal/database/batch_task.go:254-286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (33 lines × 2) internal/handler/multi_agent.go:114 — internal/handler/multi_agent.go:114-146 | internal/handler/single_agent.go:97-129 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `internal/handler/multi_agent.go:147` calls `TrimSpace` and `internal/handler/single_agent.go:131` 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.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) REDACTED:388 — REDACTED:388-417 | internal/handler/skills.go:668-697 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (30 lines × 2) internal/handler/multi_agent.go:465 — internal/handler/multi_agent.go:465-494 | internal/handler/single_agent.go:446-475 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) REDACTED:410 — REDACTED:410-435 | REDACTED:481-506 — 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 (26 lines × 2) REDACTED:1000 — REDACTED:1000-1025 | REDACTED:1069-1094 — 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:1000` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×2
  • Duplicated block (21 lines × 2) internal/c2/crypto.go:63 — internal/c2/crypto.go:63-83 | internal/c2/crypto.go:117-137 — 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 (21 lines × 2) internal/handler/multi_agent.go:395 — internal/handler/multi_agent.go:395-415 | internal/handler/single_agent.go:381-401 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:395` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×2
  • Duplicated block (18–19 lines × 2) REDACTED:159 — REDACTED:159-176 | REDACTED:282-300 — 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:159` 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, `REDACTED:303` calls `Info`, `String` and `REDACTED:178` 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 (18–19 lines × 2) internal/mcp/server.go:548 — internal/mcp/server.go:548-566 | internal/mcp/server.go:1043-1060 — 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/server.go:548` 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.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×2
  • Duplicated block (15 lines × 3) REDACTED:966 — REDACTED:966-980 | REDACTED:1186-1200 | REDACTED:1254-1268 — 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 (15 lines × 3) internal/handler/multi_agent.go:179 — internal/handler/multi_agent.go:179-193 | internal/handler/single_agent.go:172-186 | internal/handler/workflow_integration.go:95-109 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×2
  • Duplicated block (15 lines × 2) REDACTED:1710 — REDACTED:1710-1724 | REDACTED:1754-1768 — 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:1710` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1750` calls `scanC2EventRows` and `REDACTED:1709` 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 (15 lines × 2) REDACTED:130 — REDACTED:130-144 | REDACTED:178-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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×2
  • Duplicated block (8 lines × 4) internal/handler/c2.go:242 — internal/handler/c2.go:242-249 | internal/handler/c2.go:279-286 | internal/handler/c2.go:636-643 | internal/handler/c2.go:659-666 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/c2.go:242` 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 × 4) internal/handler/c2.go:362 — internal/handler/c2.go:362-369 | internal/handler/c2.go:553-560 | internal/handler/c2.go:941-948 | internal/handler/monitor.go:930-939 — there are 4 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 4 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/handler/c2.go:362` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×2
  • Duplicated block (10 lines × 4) internal/mcp/run_context.go:63 — internal/mcp/run_context.go:63-72 | internal/mcp/run_context.go:84-93 | internal/mcp/run_context.go:105-114 | internal/openai/request_headers.go:25-34 — there are 4 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 4 sites; resolving a subset leaves the remainder to drift apart.
  • Duplicated block (10 lines × 4) REDACTED:344 — REDACTED:344-353 | REDACTED:728-740 | REDACTED:1032-1045 | REDACTED:1592-1605 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×2
  • Duplicated block (5 lines × 4) REDACTED:1824 — REDACTED:1824-1828 | REDACTED:1939-1943 | REDACTED:2014-2027 | REDACTED:2056-2073 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:1824` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) REDACTED:96 — REDACTED:96-100 | internal/handler/project.go:71-75 | REDACTED:122-126 | REDACTED:450-454 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:96` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×2
  • Sync-over-async blocking scripts/check-ui-design-system.cjs:360 — `fs.writeFileSync` in `anonymous function` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
  • Sync-over-async blocking scripts/ui-realistic-scenarios.cjs:276 — `writeFileSync` in `exports` blocks the event loop until it finishes — a blocking call inside async code stalls the event loop — every other request waits for as long as it runs.
R10 · Code Duplication · Duplicated block (35 lines × 2 locations) · ×2
  • Duplicated block (35 lines × 2 locations) web/static/js/c2.js:3308 — web/static/js/c2.js:3308 · web/static/js/c2.js:4251 — all 2 copies are in the same file, 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 (35 lines × 2 locations) web/static/js/tasks.js:2548 — web/static/js/tasks.js:2548 · web/static/js/tasks.js:2616 — 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.
R10 · Code Duplication · Duplicated block (33 lines × 2 locations) · ×2
  • Duplicated block (33 lines × 2 locations) web/static/js/chat.js:9827 — web/static/js/chat.js:9827 · web/static/js/projects.js:464 — 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 (33 lines × 2 locations) REDACTED:1543 — REDACTED:1543 · REDACTED:2029 — all 2 copies are in the same file, 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 (26 lines × 2 locations) · ×2
  • Duplicated block (26 lines × 2 locations) web/static/js/chat.js:1276 — web/static/js/chat.js:1276 · web/static/js/chat.js:1309 — 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 (26 lines × 2 locations) web/static/js/chat.js:4265 — web/static/js/chat.js:4265 · web/static/js/monitor.js:2730 — 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.
R10 · Code Duplication · Duplicated block (24 lines × 2 locations) · ×2
  • Duplicated block (24 lines × 2 locations) web/static/js/monitor.js:2802 — web/static/js/monitor.js:2802 · web/static/js/monitor.js:2828 — 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 (24 lines × 2 locations) web/static/js/settings.js:3058 — web/static/js/settings.js:3058 · web/static/js/settings.js:3119 — 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.
R10 · Code Duplication · Duplicated block (19 lines × 2 locations) · ×2
  • Duplicated block (19 lines × 2 locations) web/static/js/chat.js:4226 — web/static/js/chat.js:4226 · web/static/js/monitor.js:2768 — 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 (19 lines × 2 locations) web/static/js/roles.js:1116 — web/static/js/roles.js:1116 · web/static/js/roles.js:1148 — all 2 copies are in the same file, 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 (18 lines × 2 locations) · ×2
  • Duplicated block (18 lines × 2 locations) web/static/js/chat-files.js:1047 — web/static/js/chat-files.js:1047 · web/static/js/chat-files.js:1216 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2 locations) web/static/js/chat.js:9407 — web/static/js/chat.js:9407 · web/static/js/chat.js:9487 — 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.
X26 · Unsynchronised callback handoff · Collection crosses a callback boundary unsynchronised · ×2
  • Collection crosses a callback boundary unsynchronised internal/handler/task_manager.go:736 — `Shutdown` starts a goroutine on every pass of a loop, and each one writes `_`, a variable declared before the loop — `_ = …` on line 736. The loop never waits on `wg` before its next pass, so the goroutines of successive passes run at the same time and each one's write races the next one's; waiting on `wg` after the loop orders only what follows the wait. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `wg` is a `sync.WaitGroup`, which orders the handoff's signal and takes no exclusion over the variable's own state. Guard every write to `_` with one `sync.Mutex`, or have each goroutine send its result on a channel that this body alone receives from and writes into `_`.
  • Collection crosses a callback boundary unsynchronised internal/handler/terminal_ws_unix.go:67 — `RunCommandWS` hands values from a goroutine to the body waiting on it through `_`, a variable — the goroutine writes it with `_ = …` on line 67, and the body touches it at line 78. Those two spans provably run concurrently: this body waits on `doneChan`, which nothing but the goroutine raises, so the goroutine cannot be the flow that is waiting for it. The touch comes after the goroutine is started and BEFORE the body waits on `doneChan`, so the Go memory model orders nothing between it and the goroutine's write. A goroutine's closure captures `_` by reference, so every goroutine and the body use ONE variable, and a plain variable has no synchronisation of its own: by the Go memory model a write concurrent with any other access to it is a data race (the race detector reports it), a racing `++` loses updates, and a racing read sees a stale or torn value. `doneChan` is a channel, which orders the handoff's signal and takes no exclusion over the variable's own state. Hand the values over the channel itself instead of beside it, or guard every access to `_` on both sides with one `sync.Mutex`.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×2
  • Swallowed exception (caught, then discarded) REDACTED:703 — `catch (error)` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
  • Swallowed exception (caught, then discarded) web/static/js/audit.js:529 — `catch (_)` 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, or keep only the failure you expect and rethrow the rest (`catch (e) { if (!(e instanceof SyntaxError)) throw e; … }`, or test `e.name`), because a JavaScript catch takes every exception, programming errors included.
AC3 · Page structure · Heading level jumps from h1 to h3 · ×1
  • Heading level jumps from h1 to h3 web/templates/api-docs.html:1059 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC3 · Page structure · More than one main landmark · ×1
  • More than one main landmark REDACTED:2 — A document must expose only one main landmark. Multiple visible <main> (or role="main") elements confuse the landmark map and the "skip to content" target. Keep one; remove or hide the rest.
AC3 · Page structure · Multiple navigation landmarks without distinguishing labels · ×1
  • Multiple navigation landmarks without distinguishing labels REDACTED:2 — With more than one navigation landmark, each needs an aria-label/aria-labelledby (e.g. "Primary", "Footer") so assistive tech can tell them apart. At least one nav here is unlabelled.
AC3 · Page structure · Heading level jumps from h4 to h6 · ×1
  • Heading level jumps from h4 to h6 REDACTED:3738 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC3 · Page structure · Heading level jumps from h2 to h4 · ×1
  • Heading level jumps from h2 to h4 REDACTED:4996 — Skipping heading levels breaks the document outline assistive tech relies on. Don't jump levels — increase by at most one.
AC6 · Visual & motion safety · Low contrast colour pair (4.0 · ×1
  • Low contrast colour pair (4.0:1) REDACTED:511 — The inline foreground/background colours fall below the 4.5:1 WCAG AA minimum for normal text. Darken/lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (1.6 · ×1
  • Low contrast colour pair in CSS (1.6:1) web/templates/api-docs.html:713 — `.api-test-btn.copy-curl` sets color: white on background-color: #ffc107 — 1.6:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (2.5 · ×1
  • Low contrast colour pair in CSS (2.5:1) web/static/css/c2.css:507 — `.c2-listener-card-actions .btn-primary, .c2-payload-card .btn-primary, .c2-modal-footer .btn-primary` sets color: #fff on background-color: #60a5fa — 2.5:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Low contrast colour pair in CSS (4.3 · ×1
  • Low contrast colour pair in CSS (4.3:1) web/static/css/c2.css:2442 — `.c2-status-badge.queued` sets color: #64748b on background-color: #f1f5f9 — 4.3:1, below the 4.5:1 WCAG AA minimum for normal text. Darken or lighten one of them.
AC6 · Visual & motion safety · Focus outline removed in CSS without a · ×1
  • Focus outline removed in CSS without a :focus replacement web/static/css/tool-guard.css:154 — `.tool-guard-page .tool-guard-rule-summary:focus-visible` sets the outline to none/0 and no visible :focus / :focus-visible style for that element replaces it in this stylesheet, so a keyboard user cannot see where focus is. Draw a focus ring (outline, box-shadow or border) under :focus-visible.
D1 · Cyclomatic Complexity · monitor.handleStreamEvent (cyclomatic 514) · ×1
  • monitor.handleStreamEvent (cyclomatic 514) web/static/js/monitor.js:2918 — monitor.handleStreamEvent has cyclomatic complexity 514 (threshold 15). Of this number, 502 points are the body's own statements and 12 belong to 5 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.
D1 · Cyclomatic Complexity · loadConfig (cyclomatic 216) · ×1
  • loadConfig (cyclomatic 216) web/static/js/settings.js:790 — loadConfig has cyclomatic complexity 216 (threshold 15). Of this number, 206 points are the body's own statements and 10 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.
D1 · Cyclomatic Complexity · monitor.addTimelineItem (cyclomatic 205) · ×1
  • monitor.addTimelineItem (cyclomatic 205) web/static/js/monitor.js:6638 — monitor.addTimelineItem has cyclomatic complexity 205 (threshold 15). Of this number, 204 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · runWebshellAiSend · ×1
  • runWebshellAiSend::(anonymous)::processChunk (cyclomatic 193) web/static/js/webshell.js:3544 — runWebshellAiSend::(anonymous)::processChunk has cyclomatic complexity 193 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentHandler.createProgressCallback (cyclomatic 185) · ×1
  • AgentHandler.createProgressCallback (cyclomatic 185) internal/handler/agent.go:1025 — AgentHandler.createProgressCallback has cyclomatic complexity 185 (threshold 15). Most of this is not in the body itself: 4 of the 185 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1163, 1128, 1036, …). 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.
D1 · Cyclomatic Complexity · applySettings (cyclomatic 151) · ×1
  • applySettings (cyclomatic 151) web/static/js/settings.js:1908 — applySettings has cyclomatic complexity 151 (threshold 15). Of this number, 122 points are the body's own statements and 29 belong to 14 function items 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.
D1 · Cyclomatic Complexity · webshell.refreshWebshellUIOnLanguageChange (cyclomatic 142) · ×1
  • webshell.refreshWebshellUIOnLanguageChange (cyclomatic 142) web/static/js/webshell.js:5031 — webshell.refreshWebshellUIOnLanguageChange has cyclomatic complexity 142 (threshold 15). Of this number, 140 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · renderAttackChain (cyclomatic 126) · ×1
  • renderAttackChain (cyclomatic 126) web/static/js/chat.js:7135 — renderAttackChain has cyclomatic complexity 126 (threshold 15). Of this number, 20 points are the body's own statements and 106 belong to 36 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.
D1 · Cyclomatic Complexity · initTerminal (cyclomatic 118) · ×1
  • initTerminal (cyclomatic 118) web/static/js/c2.js:2190 — initTerminal has cyclomatic complexity 118 (threshold 15). Most of this is not in the body itself: 13 of the 118 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 2355, a function literal at line 2488, handlePasteText, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · refreshDashboard (cyclomatic 117) · ×1
  • refreshDashboard (cyclomatic 117) web/static/js/dashboard.js:42 — refreshDashboard has cyclomatic complexity 117 (threshold 15). Of this number, 101 points are the body's own statements and 16 belong to 11 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.
D1 · Cyclomatic Complexity · sendMessage (cyclomatic 100) · ×1
  • sendMessage (cyclomatic 100) web/static/js/chat.js:2248 — sendMessage has cyclomatic complexity 100 (threshold 15). Of this number, 80 points are the body's own statements and 20 belong to 13 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.
D1 · Cyclomatic Complexity · app.mcpToolAuthorizer (cyclomatic 98) · ×1
  • app.mcpToolAuthorizer (cyclomatic 98) internal/app/mcp_authorization.go:15 — app.mcpToolAuthorizer has cyclomatic complexity 98 (threshold 15). Most of this is not in the body itself: 1 of the 98 points is its own statement and the rest belongs to one function literal inside it that branches (line 16). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · webshell.buildWebshellTimelineItemFromDetail (cyclomatic 93) · ×1
  • webshell.buildWebshellTimelineItemFromDetail (cyclomatic 93) web/static/js/webshell.js:2220 — webshell.buildWebshellTimelineItemFromDetail has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loadConversation (cyclomatic 93) · ×1
  • loadConversation (cyclomatic 93) web/static/js/chat.js:6381 — loadConversation has cyclomatic complexity 93 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · webshell.selectWebshell (cyclomatic 92) · ×1
  • webshell.selectWebshell (cyclomatic 92) web/static/js/webshell.js:2446 — webshell.selectWebshell has cyclomatic complexity 92 (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 shape REPEATS in the file: one other method here (webshell.selectWebshell::applyActiveDbProfileToForm) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · tasks.showBatchQueueDetail (cyclomatic 91) · ×1
  • tasks.showBatchQueueDetail (cyclomatic 91) web/static/js/tasks.js:1761 — tasks.showBatchQueueDetail has cyclomatic complexity 91 (threshold 15). Of this number, 48 points are the body's own statements and 43 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · attachRunningTaskEventStream (cyclomatic 91) · ×1
  • attachRunningTaskEventStream (cyclomatic 91) web/static/js/monitor.js:5611 — attachRunningTaskEventStream has cyclomatic complexity 91 (threshold 15). Most of this is not in the body itself: 6 of the 91 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 5625, (anonymous)::dispatchTaskEvent, a function literal at line 5630, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · ConfigHandler.UpdateConfig (cyclomatic 90) · ×1
  • ConfigHandler.UpdateConfig (cyclomatic 90) internal/handler/config.go:799 — ConfigHandler.UpdateConfig has cyclomatic complexity 90 (threshold 15). Of this number, 89 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.refreshProgressAndTimelineI18n (cyclomatic 87) · ×1
  • monitor.refreshProgressAndTimelineI18n (cyclomatic 87) web/static/js/monitor.js:9533 — monitor.refreshProgressAndTimelineI18n has cyclomatic complexity 87 (threshold 15). Most of this is not in the body itself: 1 of the 87 points is its own statement and the rest belongs to 8 function items inside it that branch (a function literal at line 9573, a function literal at line 9680, a function literal at line 9555, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · initPage (cyclomatic 85) · ×1
  • initPage (cyclomatic 85) web/static/js/router.js:410 — initPage has cyclomatic complexity 85 (threshold 15). Of this number, 77 points are the body's own statements and 8 belong to 7 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.
D1 · Cyclomatic Complexity · piRun.run (cyclomatic 84) · ×1
  • piRun.run (cyclomatic 84) internal/multiagent/pi_runner.go:226 — piRun.run has cyclomatic complexity 84 (threshold 15). Of this number, 40 points are the body's own statements and 44 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.
D1 · Cyclomatic Complexity · RobotHandler.handleRobotCommand (cyclomatic 83) · ×1
  • RobotHandler.handleRobotCommand (cyclomatic 83) REDACTED:1247 — RobotHandler.handleRobotCommand has cyclomatic complexity 83 (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.
D1 · Cyclomatic Complexity · piRun.executePiLocal (cyclomatic 79) · ×1
  • piRun.executePiLocal (cyclomatic 79) internal/multiagent/pi_local_tools.go:121 — piRun.executePiLocal has cyclomatic complexity 79 (threshold 15). Of this number, 57 points are the body's own statements and 22 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.RegisterBatchTaskMCPTools (cyclomatic 75) · ×1
  • handler.RegisterBatchTaskMCPTools (cyclomatic 75) internal/handler/batch_task_mcp.go:22 — handler.RegisterBatchTaskMCPTools has cyclomatic complexity 75 (threshold 15). Most of this is not in the body itself: 4 of the 75 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 200, 58, 319, …). 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.
D1 · Cyclomatic Complexity · ConfigHandler.GetTools (cyclomatic 73) · ×1
  • ConfigHandler.GetTools (cyclomatic 73) internal/handler/config.go:413 — ConfigHandler.GetTools has cyclomatic complexity 73 (threshold 15). Of this number, 71 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · loadProcessDetailsPaginated (cyclomatic 71) · ×1
  • loadProcessDetailsPaginated (cyclomatic 71) web/static/js/monitor.js:2369 — loadProcessDetailsPaginated has cyclomatic complexity 71 (threshold 15). Of this number, 70 points are the body's own statements and 1 belongs to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Executor.buildCommandArgs (cyclomatic 69) · ×1
  • Executor.buildCommandArgs (cyclomatic 69) internal/security/executor.go:354 — Executor.buildCommandArgs has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat._acBuildSvgString (cyclomatic 69) · ×1
  • chat._acBuildSvgString (cyclomatic 69) web/static/js/chat.js:8484 — chat._acBuildSvgString has cyclomatic complexity 69 (threshold 15). Most of this is not in the body itself: 4 of the 69 points are its own statements and the rest belongs to 12 function items inside it that branch (a function literal at line 8777, themeFor, a function literal at line 8747, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · worker.run (cyclomatic 68) · ×1
  • worker.run (cyclomatic 68) runtime/pi/src/worker.ts:181 — worker.run has cyclomatic complexity 68 (threshold 15). Of this number, 48 points are the body's own statements and 20 belong to 8 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentHandler.MultiAgentLoopStream (cyclomatic 66) · ×1
  • AgentHandler.MultiAgentLoopStream (cyclomatic 66) internal/handler/multi_agent.go:23 — AgentHandler.MultiAgentLoopStream has cyclomatic complexity 66 (threshold 15). Of this number, 44 points are the body's own statements and 22 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · initWebshellTerminal (cyclomatic 65) · ×1
  • initWebshellTerminal (cyclomatic 65) web/static/js/webshell.js:3985 — initWebshellTerminal has cyclomatic complexity 65 (threshold 15). Most of this is not in the body itself: 14 of the 65 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4047, writeWebshellOutput, a function literal at line 4119, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AgentHandler.SingleAgentLoopStream (cyclomatic 64) · ×1
  • AgentHandler.SingleAgentLoopStream (cyclomatic 64) internal/handler/single_agent.go:22 — AgentHandler.SingleAgentLoopStream has cyclomatic complexity 64 (threshold 15). Of this number, 42 points are the body's own statements and 22 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.startProcessDetailsLatestFollow (cyclomatic 64) · ×1
  • monitor.startProcessDetailsLatestFollow (cyclomatic 64) web/static/js/monitor.js:2149 — monitor.startProcessDetailsLatestFollow has cyclomatic complexity 64 (threshold 15). Of this number, 18 points are the body's own statements and 46 belong to 10 function items 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.
D1 · Cyclomatic Complexity · monitor.buildInlineHitlApprovalHtml (cyclomatic 60) · ×1
  • monitor.buildInlineHitlApprovalHtml (cyclomatic 60) web/static/js/monitor.js:4607 — monitor.buildInlineHitlApprovalHtml has cyclomatic complexity 60 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TCPReverseListener.handleTCPBeaconSession (cyclomatic 58) · ×1
  • TCPReverseListener.handleTCPBeaconSession (cyclomatic 58) internal/c2/tcp_beacon_server.go:73 — TCPReverseListener.handleTCPBeaconSession has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.New (cyclomatic 57) · ×1
  • app.New (cyclomatic 57) REDACTED:83 — app.New has cyclomatic complexity 57 (threshold 15). Of this number, 40 points are the body's own statements and 17 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.
D1 · Cyclomatic Complexity · workflows.validateWorkflowGraph (cyclomatic 57) · ×1
  • workflows.validateWorkflowGraph (cyclomatic 57) web/static/js/workflows.js:2095 — workflows.validateWorkflowGraph has cyclomatic complexity 57 (threshold 15). Most of this is not in the body itself: 9 of the 57 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 2130, visit, a function literal at line 2125, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · fact-graph.render (cyclomatic 56) · ×1
  • fact-graph.render (cyclomatic 56) web/static/js/fact-graph.js:550 — fact-graph.render has cyclomatic complexity 56 (threshold 15). Of this number, 34 points are the body's own statements and 22 belong to 7 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.
D1 · Cyclomatic Complexity · AgentHandler.prepareMultiAgentSession (cyclomatic 55) · ×1
  • AgentHandler.prepareMultiAgentSession (cyclomatic 55) internal/handler/multi_agent_prepare.go:36 — AgentHandler.prepareMultiAgentSession has cyclomatic complexity 55 (threshold 15). Of this number, 52 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.finishPendingBuild (cyclomatic 55) · ×1
  • update.finishPendingBuild (cyclomatic 55) internal/update/apply.go:399 — update.finishPendingBuild has cyclomatic complexity 55 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.permissionForRequest (cyclomatic 54) · ×1
  • security.permissionForRequest (cyclomatic 54) internal/security/rbac_middleware.go:91 — security.permissionForRequest has cyclomatic complexity 54 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · settings.renderExternalMCPList (cyclomatic 54) · ×1
  • settings.renderExternalMCPList (cyclomatic 54) web/static/js/settings.js:4502 — settings.renderExternalMCPList has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Pi.Run (cyclomatic 53) · ×1
  • Pi.Run (cyclomatic 53) internal/agentruntime/pi.go:89 — Pi.Run has cyclomatic complexity 53 (threshold 15). Of this number, 40 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.
D1 · Cyclomatic Complexity · 1.onEvent (cyclomatic 52) · ×1
  • 1.onEvent (cyclomatic 52) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/BurpExtender.java:79 — 1.onEvent 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.
D1 · Cyclomatic Complexity · app.registerProjectFactTools (cyclomatic 51) · ×1
  • app.registerProjectFactTools (cyclomatic 51) internal/app/project_fact_tools.go:40 — app.registerProjectFactTools has cyclomatic complexity 51 (threshold 15). Most of this is not in the body itself: 6 of the 51 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 119, 194, 370, …). 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.
D1 · Cyclomatic Complexity · assets.assetImportRecord (cyclomatic 51) · ×1
  • assets.assetImportRecord (cyclomatic 51) REDACTED:319 — assets.assetImportRecord has cyclomatic complexity 51 (threshold 15). Of this number, 49 points are the body's own statements and 2 belong to 2 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.
D1 · Cyclomatic Complexity · restoreHitlInlineForConversation (cyclomatic 51) · ×1
  • restoreHitlInlineForConversation (cyclomatic 51) web/static/js/monitor.js:5375 — restoreHitlInlineForConversation 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.
D1 · Cyclomatic Complexity · app.registerWebshellManagementTools (cyclomatic 50) · ×1
  • app.registerWebshellManagementTools (cyclomatic 50) REDACTED:1686 — app.registerWebshellManagementTools has cyclomatic complexity 50 (threshold 15). Most of this is not in the body itself: 2 of the 50 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 1941, 1735, 1826, …). 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.
D1 · Cyclomatic Complexity · chat.loadConversation · ×1
  • chat.loadConversation::renderOneMessage (cyclomatic 50) web/static/js/chat.js:6531 — chat.loadConversation::renderOneMessage has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.loadConversations (cyclomatic 49) · ×1
  • chat.loadConversations (cyclomatic 49) web/static/js/chat.js:10004 — chat.loadConversations has cyclomatic complexity 49 (threshold 15). Of this number, 38 points are the body's own statements and 11 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · vulnerability.syncVulnerabilityFiltersFromLocationHash (cyclomatic 49) · ×1
  • vulnerability.syncVulnerabilityFiltersFromLocationHash (cyclomatic 49) web/static/js/vulnerability.js:272 — vulnerability.syncVulnerabilityFiltersFromLocationHash has cyclomatic complexity 49 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · webshell.renderFileList (cyclomatic 48) · ×1
  • webshell.renderFileList (cyclomatic 48) web/static/js/webshell.js:4413 — webshell.renderFileList has cyclomatic complexity 48 (threshold 15). Of this number, 26 points are the body's own statements and 22 belong to 7 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentHandler.executeOneBatchSubTask (cyclomatic 47) · ×1
  • AgentHandler.executeOneBatchSubTask (cyclomatic 47) internal/handler/batch_queue_executor.go:113 — AgentHandler.executeOneBatchSubTask has cyclomatic complexity 47 (threshold 15). Of this number, 44 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConfigHandler.ApplyConfig (cyclomatic 47) · ×1
  • ConfigHandler.ApplyConfig (cyclomatic 47) internal/handler/config.go:1781 — ConfigHandler.ApplyConfig has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.GetProcessDetailsSummary (cyclomatic 46) · ×1
  • DB.GetProcessDetailsSummary (cyclomatic 46) REDACTED:1452 — DB.GetProcessDetailsSummary has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.renderMCPDetailModal (cyclomatic 45) · ×1
  • chat.renderMCPDetailModal (cyclomatic 45) web/static/js/chat.js:5600 — chat.renderMCPDetailModal 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.
D1 · Cyclomatic Complexity · monitor.buildMcpTimelineSvg (cyclomatic 45) · ×1
  • monitor.buildMcpTimelineSvg (cyclomatic 45) web/static/js/monitor.js:7812 — monitor.buildMcpTimelineSvg has cyclomatic complexity 45 (threshold 15). Most of this is not in the body itself: 13 of the 45 points are its own statements and the rest belongs to 12 function literals inside it that branch (lines 7890, 7879, 7853, …). 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.
D1 · Cyclomatic Complexity · monitor.renderMonitorExecutions (cyclomatic 45) · ×1
  • monitor.renderMonitorExecutions (cyclomatic 45) web/static/js/monitor.js:9045 — monitor.renderMonitorExecutions has cyclomatic complexity 45 (threshold 15). Of this number, 35 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.syncModelListFetchButtons (cyclomatic 45) · ×1
  • settings.syncModelListFetchButtons (cyclomatic 45) web/static/js/settings.js:3478 — settings.syncModelListFetchButtons has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · saveKnowledgeItem (cyclomatic 45) · ×1
  • saveKnowledgeItem (cyclomatic 45) REDACTED:994 — saveKnowledgeItem has cyclomatic complexity 45 (threshold 15). Of this number, 44 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.renderProcessDetails (cyclomatic 44) · ×1
  • chat.renderProcessDetails (cyclomatic 44) web/static/js/chat.js:4069 — chat.renderProcessDetails 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. This shape REPEATS in the file: 2 other methods here (chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage, chat.renderProcessDetails::renderOneProcessDetail) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · fetchChatSystemModelsForChannel (cyclomatic 44) · ×1
  • fetchChatSystemModelsForChannel (cyclomatic 44) web/static/js/chat.js:1547 — fetchChatSystemModelsForChannel has cyclomatic complexity 44 (threshold 15). Of this number, 40 points are the body's own statements and 4 belong to 5 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.
D1 · Cyclomatic Complexity · testWebshellConnection (cyclomatic 44) · ×1
  • testWebshellConnection (cyclomatic 44) web/static/js/webshell.js:5229 — testWebshellConnection has cyclomatic complexity 44 (threshold 15). Of this number, 27 points are the body's own statements and 17 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsToolsPanel (cyclomatic 43) · ×1
  • monitor.renderMcpStatsToolsPanel (cyclomatic 43) web/static/js/monitor.js:8822 — monitor.renderMcpStatsToolsPanel has cyclomatic complexity 43 (threshold 15). Most of this is not in the body itself: 7 of the 43 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 8848, 8831, 8824, …). 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.
D1 · Cyclomatic Complexity · settings.saveExternalMCP (cyclomatic 42) · ×1
  • settings.saveExternalMCP (cyclomatic 42) web/static/js/settings.js:4734 — settings.saveExternalMCP 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.
D1 · Cyclomatic Complexity · Client.ChatCompletionStreamWithToolCalls (cyclomatic 41) · ×1
  • Client.ChatCompletionStreamWithToolCalls (cyclomatic 41) internal/openai/openai.go:328 — Client.ChatCompletionStreamWithToolCalls has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.Rollback (cyclomatic 41) · ×1
  • update.Rollback (cyclomatic 41) internal/update/apply.go:907 — update.Rollback has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.formatConversationAsMarkdown (cyclomatic 41) · ×1
  • chat.formatConversationAsMarkdown (cyclomatic 41) web/static/js/chat.js:10683 — chat.formatConversationAsMarkdown has cyclomatic complexity 41 (threshold 15). Most of this is not in the body itself: 13 of the 41 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 10702, 10717). 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.
D1 · Cyclomatic Complexity · roles.saveRole (cyclomatic 41) · ×1
  • roles.saveRole (cyclomatic 41) web/static/js/roles.js:1645 — roles.saveRole has cyclomatic complexity 41 (threshold 15). Of this number, 34 points are the body's own statements and 7 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.
D1 · Cyclomatic Complexity · token-usage.renderTokenUsageAnalysis (cyclomatic 41) · ×1
  • token-usage.renderTokenUsageAnalysis (cyclomatic 41) web/static/js/token-usage.js:136 — token-usage.renderTokenUsageAnalysis has cyclomatic complexity 41 (threshold 15). Of this number, 16 points are the body's own statements and 25 belong to 9 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflows.readTypedConfig (cyclomatic 41) · ×1
  • workflows.readTypedConfig (cyclomatic 41) web/static/js/workflows.js:1175 — workflows.readTypedConfig has cyclomatic complexity 41 (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.
D1 · Cyclomatic Complexity · multiagent.runPiMulti (cyclomatic 40) · ×1
  • multiagent.runPiMulti (cyclomatic 40) internal/multiagent/pi_runner.go:67 — multiagent.runPiMulti has cyclomatic complexity 40 (threshold 15). Of this number, 24 points are the body's own statements and 16 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.coalesceProcessDetailsToolPairs (cyclomatic 40) · ×1
  • monitor.coalesceProcessDetailsToolPairs (cyclomatic 40) web/static/js/monitor.js:6314 — monitor.coalesceProcessDetailsToolPairs has cyclomatic complexity 40 (threshold 15). Of this number, 34 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · roles.editRole (cyclomatic 40) · ×1
  • roles.editRole (cyclomatic 40) web/static/js/roles.js:1373 — roles.editRole has cyclomatic complexity 40 (threshold 15). Of this number, 33 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.
D1 · Cyclomatic Complexity · webshell.renderWebshellList (cyclomatic 40) · ×1
  • webshell.renderWebshellList (cyclomatic 40) web/static/js/webshell.js:1142 — webshell.renderWebshellList has cyclomatic complexity 40 (threshold 15). Of this number, 24 points are the body's own statements and 16 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.
D1 · Cyclomatic Complexity · handler.robotCommandPermission (cyclomatic 39) · ×1
  • handler.robotCommandPermission (cyclomatic 39) REDACTED:1089 — handler.robotCommandPermission has cyclomatic complexity 39 (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.
D1 · Cyclomatic Complexity · update.Apply (cyclomatic 39) · ×1
  • update.Apply (cyclomatic 39) internal/update/apply.go:186 — update.Apply has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflowpackage.InspectArchive (cyclomatic 39) · ×1
  • workflowpackage.InspectArchive (cyclomatic 39) internal/workflow/package/inspector.go:57 — workflowpackage.InspectArchive has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · onEvent (cyclomatic 39) · ×1
  • onEvent (cyclomatic 39) web/static/js/c2.js:4388 — onEvent has cyclomatic complexity 39 (threshold 15). Of this number, 34 points are the body's own statements and 5 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.
D1 · Cyclomatic Complexity · watchdogProbe (cyclomatic 39) · ×1
  • watchdogProbe (cyclomatic 39) web/static/js/update.js:290 — watchdogProbe has cyclomatic complexity 39 (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.
D1 · Cyclomatic Complexity · saveWebshellConnection (cyclomatic 39) · ×1
  • saveWebshellConnection (cyclomatic 39) web/static/js/webshell.js:5296 — saveWebshellConnection has cyclomatic complexity 39 (threshold 15). Of this number, 33 points are the body's own statements and 6 belong to 5 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.
D1 · Cyclomatic Complexity · agent.ParseTraceMessages (cyclomatic 38) · ×1
  • agent.ParseTraceMessages (cyclomatic 38) internal/agent/agent_trace.go:36 — agent.ParseTraceMessages has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Builder.BuildChainFromConversation (cyclomatic 38) · ×1
  • Builder.BuildChainFromConversation (cyclomatic 38) internal/attackchain/builder.go:87 — Builder.BuildChainFromConversation has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.ApplyWorkflowPackageImport (cyclomatic 38) · ×1
  • DB.ApplyWorkflowPackageImport (cyclomatic 38) internal/database/workflow_package.go:100 — DB.ApplyWorkflowPackageImport has cyclomatic complexity 38 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · piRun.executePiPlan (cyclomatic 38) · ×1
  • piRun.executePiPlan (cyclomatic 38) internal/multiagent/pi_plan_tools.go:105 — piRun.executePiPlan has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.addMessage (cyclomatic 38) · ×1
  • chat.addMessage (cyclomatic 38) web/static/js/chat.js:3558 — chat.addMessage has cyclomatic complexity 38 (threshold 15). Of this number, 37 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · router.updateNavState (cyclomatic 38) · ×1
  • router.updateNavState (cyclomatic 38) web/static/js/router.js:183 — router.updateNavState has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · settings.renderToolsList (cyclomatic 38) · ×1
  • settings.renderToolsList (cyclomatic 38) web/static/js/settings.js:1389 — settings.renderToolsList has cyclomatic complexity 38 (threshold 15). Most of this is not in the body itself: 8 of the 38 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1420, 1471). 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.
D1 · Cyclomatic Complexity · webshell.runWebshellAiSend · ×1
  • webshell.runWebshellAiSend::appendTimelineItem (cyclomatic 38) web/static/js/webshell.js:3418 — webshell.runWebshellAiSend::appendTimelineItem has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.registerC2ListenerTool (cyclomatic 37) · ×1
  • app.registerC2ListenerTool (cyclomatic 37) internal/app/c2_tools.go:54 — app.registerC2ListenerTool has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 1 of the 37 points is its own statement and the rest belongs to one function literal inside it that branches (line 85). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · app.registerC2ProfileTool (cyclomatic 37) · ×1
  • app.registerC2ProfileTool (cyclomatic 37) internal/app/c2_tools.go:689 — app.registerC2ProfileTool has cyclomatic complexity 37 (threshold 15). Most of this is not in the body itself: 1 of the 37 points is its own statement and the rest belongs to one function literal inside it that branches (line 714). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · project.BuildProjectFactGraph (cyclomatic 37) · ×1
  • project.BuildProjectFactGraph (cyclomatic 37) internal/project/fact_edges.go:88 — project.BuildProjectFactGraph has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · c2.formatTaskCommand (cyclomatic 37) · ×1
  • c2.formatTaskCommand (cyclomatic 37) web/static/js/c2.js:365 — c2.formatTaskCommand has cyclomatic complexity 37 (threshold 15). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.resolveInlineHitlDecision (cyclomatic 37) · ×1
  • monitor.resolveInlineHitlDecision (cyclomatic 37) web/static/js/monitor.js:4529 — monitor.resolveInlineHitlDecision has cyclomatic complexity 37 (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.
D1 · Cyclomatic Complexity · refreshHitlPending (cyclomatic 37) · ×1
  • refreshHitlPending (cyclomatic 37) web/static/js/hitl.js:893 — refreshHitlPending has cyclomatic complexity 37 (threshold 15). Of this number, 23 points are the body's own statements and 14 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.
D1 · Cyclomatic Complexity · ChatUploadsHandler.collectFiles (cyclomatic 36) · ×1
  • ChatUploadsHandler.collectFiles (cyclomatic 36) REDACTED:323 — ChatUploadsHandler.collectFiles has cyclomatic complexity 36 (threshold 15). Of this number, 21 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.invokeGraph (cyclomatic 36) · ×1
  • workflow.invokeGraph (cyclomatic 36) internal/workflow/native_runtime.go:27 — workflow.invokeGraph has cyclomatic complexity 36 (threshold 15). Of this number, 35 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dashboard.renderSeverityInsights (cyclomatic 36) · ×1
  • dashboard.renderSeverityInsights (cyclomatic 36) web/static/js/dashboard.js:1587 — dashboard.renderSeverityInsights has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · hitl.openHitlLogModal (cyclomatic 36) · ×1
  • hitl.openHitlLogModal (cyclomatic 36) web/static/js/hitl.js:1874 — hitl.openHitlLogModal has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.mergeToolResultIntoCallItem (cyclomatic 36) · ×1
  • monitor.mergeToolResultIntoCallItem (cyclomatic 36) web/static/js/monitor.js:6197 — monitor.mergeToolResultIntoCallItem has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMonitorPagination (cyclomatic 36) · ×1
  • monitor.renderMonitorPagination (cyclomatic 36) web/static/js/monitor.js:9265 — monitor.renderMonitorPagination has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.writeAIChannelToMainForm (cyclomatic 36) · ×1
  • settings.writeAIChannelToMainForm (cyclomatic 36) web/static/js/settings.js:2679 — settings.writeAIChannelToMainForm has cyclomatic complexity 36 (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.
D1 · Cyclomatic Complexity · restoreWorkflowHitlInlineForConversation (cyclomatic 36) · ×1
  • restoreWorkflowHitlInlineForConversation (cyclomatic 36) web/static/js/monitor.js:5218 — restoreWorkflowHitlInlineForConversation has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.buildAndSwap (cyclomatic 35) · ×1
  • update.buildAndSwap (cyclomatic 35) internal/update/apply.go:579 — update.buildAndSwap 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.
D1 · Cyclomatic Complexity · dashboard.renderDashboardAlertBanner (cyclomatic 35) · ×1
  • dashboard.renderDashboardAlertBanner (cyclomatic 35) web/static/js/dashboard.js:772 — dashboard.renderDashboardAlertBanner has cyclomatic complexity 35 (threshold 15). Of this number, 31 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · i18n.applyTranslations (cyclomatic 35) · ×1
  • i18n.applyTranslations (cyclomatic 35) web/static/js/i18n.js:75 — i18n.applyTranslations has cyclomatic complexity 35 (threshold 15). Of this number, 17 points are the body's own statements and 18 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentHandler.ProcessMessageForRobot (cyclomatic 34) · ×1
  • AgentHandler.ProcessMessageForRobot (cyclomatic 34) internal/handler/agent.go:830 — AgentHandler.ProcessMessageForRobot has cyclomatic complexity 34 (threshold 15). 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat-files.renderChatFilesTable (cyclomatic 34) · ×1
  • chat-files.renderChatFilesTable (cyclomatic 34) web/static/js/chat-files.js:992 — chat-files.renderChatFilesTable 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. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable::rowHtml, chat-files.renderChatFilesTable::rowHtmlTreeFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · dashboard.renderRecentFacts (cyclomatic 34) · ×1
  • dashboard.renderRecentFacts (cyclomatic 34) web/static/js/dashboard.js:1397 — dashboard.renderRecentFacts has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 15 of the 34 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1451, 1428, 1432, …). 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.
D1 · Cyclomatic Complexity · knowledge.updateIndexProgress (cyclomatic 34) · ×1
  • knowledge.updateIndexProgress (cyclomatic 34) REDACTED:438 — knowledge.updateIndexProgress has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMonitorStats (cyclomatic 34) · ×1
  • monitor.renderMonitorStats (cyclomatic 34) web/static/js/monitor.js:8976 — monitor.renderMonitorStats has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · projects.showProjectFactGraphNode (cyclomatic 34) · ×1
  • projects.showProjectFactGraphNode (cyclomatic 34) web/static/js/projects.js:1360 — projects.showProjectFactGraphNode has cyclomatic complexity 34 (threshold 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.resolveModelListCredentials (cyclomatic 34) · ×1
  • settings.resolveModelListCredentials (cyclomatic 34) web/static/js/settings.js:3443 — settings.resolveModelListCredentials has cyclomatic complexity 34 (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.
D1 · Cyclomatic Complexity · settings.testHitlAuditModelConnection (cyclomatic 34) · ×1
  • settings.testHitlAuditModelConnection (cyclomatic 34) web/static/js/settings.js:3824 — settings.testHitlAuditModelConnection has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · bindChatScrollListeners (cyclomatic 34) · ×1
  • bindChatScrollListeners (cyclomatic 34) web/static/js/chat-scroll.js:683 — bindChatScrollListeners has cyclomatic complexity 34 (threshold 15). Most of this is not in the body itself: 7 of the 34 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 710, 721, 691, …). 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.
D1 · Cyclomatic Complexity · loadToolsList (cyclomatic 34) · ×1
  • loadToolsList (cyclomatic 34) web/static/js/settings.js:1224 — loadToolsList has cyclomatic complexity 34 (threshold 15). Of this number, 31 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.bindInlineHitlApproval · ×1
  • monitor.bindInlineHitlApproval::submit (cyclomatic 33) web/static/js/monitor.js:4751 — monitor.bindInlineHitlApproval::submit has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsInsightPanel (cyclomatic 33) · ×1
  • monitor.renderMcpStatsInsightPanel (cyclomatic 33) web/static/js/monitor.js:8487 — monitor.renderMcpStatsInsightPanel has cyclomatic complexity 33 (threshold 15). Most of this is not in the body itself: 15 of the 33 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8499, 8519, 8494). 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.
D1 · Cyclomatic Complexity · webshell.buildWebshellDbCommand (cyclomatic 33) · ×1
  • webshell.buildWebshellDbCommand (cyclomatic 33) web/static/js/webshell.js:1872 — webshell.buildWebshellDbCommand has cyclomatic complexity 33 (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.
D1 · Cyclomatic Complexity · workflows.workflowAiRenderResult (cyclomatic 33) · ×1
  • workflows.workflowAiRenderResult (cyclomatic 33) web/static/js/workflows.js:1722 — workflows.workflowAiRenderResult 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · main.main (cyclomatic 32) · ×1
  • main.main (cyclomatic 32) cmd/server/main.go:24 — main.main has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DB.migrateVulnerabilitiesConversationFK (cyclomatic 32) · ×1
  • DB.migrateVulnerabilitiesConversationFK (cyclomatic 32) internal/database/schema_legacy.go:15 — DB.migrateVulnerabilitiesConversationFK has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · panel.handleStreamEvent (cyclomatic 32) · ×1
  • panel.handleStreamEvent (cyclomatic 32) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:976 — panel.handleStreamEvent has cyclomatic complexity 32 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · dashboard.renderDashboardAccessOverview (cyclomatic 32) · ×1
  • dashboard.renderDashboardAccessOverview (cyclomatic 32) web/static/js/dashboard.js:471 — dashboard.renderDashboardAccessOverview 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · info-collect.refreshInfoCollectProviderUI (cyclomatic 32) · ×1
  • info-collect.refreshInfoCollectProviderUI (cyclomatic 32) web/static/js/info-collect.js:625 — info-collect.refreshInfoCollectProviderUI has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · skills.saveSkill (cyclomatic 32) · ×1
  • skills.saveSkill (cyclomatic 32) web/static/js/skills.js:766 — skills.saveSkill has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · database.vulnerabilityTargetsJSON (cyclomatic 31) · ×1
  • database.vulnerabilityTargetsJSON (cyclomatic 31) internal/database/vulnerability_workspace.go:35 — database.vulnerabilityTargetsJSON 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.
D1 · Cyclomatic Complexity · project.BuildWorkspaceInventoryBlock (cyclomatic 31) · ×1
  • project.BuildWorkspaceInventoryBlock (cyclomatic 31) internal/project/workspace_inventory.go:20 — project.BuildWorkspaceInventoryBlock has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 7 of the 31 points are its own statements and the rest belongs to one function literal inside it that branches (line 27). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · chat.updateMentionCandidates (cyclomatic 31) · ×1
  • chat.updateMentionCandidates (cyclomatic 31) web/static/js/chat.js:3043 — chat.updateMentionCandidates has cyclomatic complexity 31 (threshold 15). Most of this is not in the body itself: 15 of the 31 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3084, 3069). 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.
D1 · Cyclomatic Complexity · info-collect.initInfoCollectPage (cyclomatic 31) · ×1
  • info-collect.initInfoCollectPage (cyclomatic 31) web/static/js/info-collect.js:250 — info-collect.initInfoCollectPage has cyclomatic complexity 31 (threshold 15). Of this number, 23 points are the body's own statements and 8 belong to 3 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.
D1 · Cyclomatic Complexity · monitor.renderToolCallDetailContent (cyclomatic 31) · ×1
  • monitor.renderToolCallDetailContent (cyclomatic 31) web/static/js/monitor.js:6078 — monitor.renderToolCallDetailContent 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.
D1 · Cyclomatic Complexity · settings.testOpenAIConnection (cyclomatic 31) · ×1
  • settings.testOpenAIConnection (cyclomatic 31) web/static/js/settings.js:4072 — settings.testOpenAIConnection has cyclomatic complexity 31 (threshold 15). Of this number, 27 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · vulnerability.loadVulnerabilities (cyclomatic 31) · ×1
  • vulnerability.loadVulnerabilities (cyclomatic 31) web/static/js/vulnerability.js:1274 — vulnerability.loadVulnerabilities has cyclomatic complexity 31 (threshold 15). Of this number, 30 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · createBatchQueue (cyclomatic 31) · ×1
  • createBatchQueue (cyclomatic 31) web/static/js/tasks.js:1020 — createBatchQueue 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.
D1 · Cyclomatic Complexity · renderVulnerabilityBrowser (cyclomatic 31) · ×1
  • renderVulnerabilityBrowser (cyclomatic 31) web/static/js/vulnerability.js:1422 — renderVulnerabilityBrowser has cyclomatic complexity 31 (threshold 15). Of this number, 25 points are the body's own statements and 6 belong to 8 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.
D1 · Cyclomatic Complexity · app.registerAssetTools (cyclomatic 30) · ×1
  • app.registerAssetTools (cyclomatic 30) internal/app/asset_tools.go:21 — app.registerAssetTools has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 3 of the 30 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 83, 33, 61, …). 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.
D1 · Cyclomatic Complexity · ExternalMCPManager.CallTool (cyclomatic 30) · ×1
  • ExternalMCPManager.CallTool (cyclomatic 30) internal/mcp/external_manager.go:698 — ExternalMCPManager.CallTool has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 10 of the 30 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 723, 789, 777, …). 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.
D1 · Cyclomatic Complexity · update.Adopt (cyclomatic 30) · ×1
  • update.Adopt (cyclomatic 30) REDACTED:137 — update.Adopt has cyclomatic complexity 30 (threshold 15). Of this number, 29 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · api-docs.renderRequestBody (cyclomatic 30) · ×1
  • api-docs.renderRequestBody (cyclomatic 30) web/static/js/api-docs.js:353 — api-docs.renderRequestBody has cyclomatic complexity 30 (threshold 15). Of this number, 15 points are the body's own statements and 15 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat-files.loadChatFilesPage (cyclomatic 30) · ×1
  • chat-files.loadChatFilesPage (cyclomatic 30) web/static/js/chat-files.js:364 — chat-files.loadChatFilesPage has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.initChatAgentModeFromConfig (cyclomatic 30) · ×1
  • chat.initChatAgentModeFromConfig (cyclomatic 30) web/static/js/chat.js:2059 — chat.initChatAgentModeFromConfig has cyclomatic complexity 30 (threshold 15). Of this number, 23 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · tasks.renderBatchQueues (cyclomatic 30) · ×1
  • tasks.renderBatchQueues (cyclomatic 30) web/static/js/tasks.js:1572 — tasks.renderBatchQueues has cyclomatic complexity 30 (threshold 15). Most of this is not in the body itself: 12 of the 30 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1594, 1607). 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.
D1 · Cyclomatic Complexity · terminal.removeTerminalTab (cyclomatic 30) · ×1
  • terminal.removeTerminalTab (cyclomatic 30) web/static/js/terminal.js:386 — terminal.removeTerminalTab 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.
D1 · Cyclomatic Complexity · tool-guard.updateControls (cyclomatic 30) · ×1
  • tool-guard.updateControls (cyclomatic 30) web/static/js/tool-guard.js:29 — tool-guard.updateControls has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflows.renderTypedConfig (cyclomatic 30) · ×1
  • workflows.renderTypedConfig (cyclomatic 30) web/static/js/workflows.js:1043 — workflows.renderTypedConfig has cyclomatic complexity 30 (threshold 15). Of this number, 26 points are the body's own statements and 4 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · workflows.workflowAiBuildDraft (cyclomatic 30) · ×1
  • workflows.workflowAiBuildDraft (cyclomatic 30) web/static/js/workflows.js:1525 — workflows.workflowAiBuildDraft has cyclomatic complexity 30 (threshold 15). Of this number, 25 points are the body's own statements and 5 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.
D1 · Cyclomatic Complexity · WebShellHandler.buildFileCommand (cyclomatic 29) · ×1
  • WebShellHandler.buildFileCommand (cyclomatic 29) REDACTED:201 — WebShellHandler.buildFileCommand has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Retriever.vectorSearch (cyclomatic 29) · ×1
  • Retriever.vectorSearch (cyclomatic 29) internal/knowledge/retriever.go:188 — Retriever.vectorSearch has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecutionService.finishEntry (cyclomatic 29) · ×1
  • ExecutionService.finishEntry (cyclomatic 29) internal/mcp/execution_service.go:266 — ExecutionService.finishEntry 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.
D1 · Cyclomatic Complexity · update.validateBuildEvidence (cyclomatic 29) · ×1
  • update.validateBuildEvidence (cyclomatic 29) internal/update/recovery_evidence.go:143 — update.validateBuildEvidence 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.
D1 · Cyclomatic Complexity · chat.refreshChatPanelI18n (cyclomatic 29) · ×1
  • chat.refreshChatPanelI18n (cyclomatic 29) web/static/js/chat.js:11158 — chat.refreshChatPanelI18n has cyclomatic complexity 29 (threshold 15). Of this number, 16 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.
D1 · Cyclomatic Complexity · dashboard.renderRecentEvents (cyclomatic 29) · ×1
  • dashboard.renderRecentEvents (cyclomatic 29) web/static/js/dashboard.js:950 — dashboard.renderRecentEvents has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 12 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 966, 983, 958). 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.
D1 · Cyclomatic Complexity · monitor.pruneLiveTimelineIfNeeded (cyclomatic 29) · ×1
  • monitor.pruneLiveTimelineIfNeeded (cyclomatic 29) web/static/js/monitor.js:6583 — monitor.pruneLiveTimelineIfNeeded has cyclomatic complexity 29 (threshold 15). Of this number, 24 points are the body's own statements and 5 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsToolTable (cyclomatic 29) · ×1
  • monitor.renderMcpStatsToolTable (cyclomatic 29) web/static/js/monitor.js:8755 — monitor.renderMcpStatsToolTable has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to one function literal inside it that branches (line 8763). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · tasks.renderTaskItem (cyclomatic 29) · ×1
  • tasks.renderTaskItem (cyclomatic 29) web/static/js/tasks.js:521 — tasks.renderTaskItem 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.
D1 · Cyclomatic Complexity · hydrateConversationTokenUsage (cyclomatic 29) · ×1
  • hydrateConversationTokenUsage (cyclomatic 29) web/static/js/chat.js:6344 — hydrateConversationTokenUsage has cyclomatic complexity 29 (threshold 15). Of this number, 19 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · syncVisibleConversationTaskReplay (cyclomatic 29) · ×1
  • syncVisibleConversationTaskReplay (cyclomatic 29) web/static/js/monitor.js:6979 — syncVisibleConversationTaskReplay has cyclomatic complexity 29 (threshold 15). Of this number, 15 points are the body's own statements and 14 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadWebshellAiHistory (cyclomatic 29) · ×1
  • loadWebshellAiHistory (cyclomatic 29) web/static/js/webshell.js:3325 — loadWebshellAiHistory has cyclomatic complexity 29 (threshold 15). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 3341, 3330, 3335, …). 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.
D1 · Cyclomatic Complexity · BatchTaskManager.LoadFromDB (cyclomatic 28) · ×1
  • BatchTaskManager.LoadFromDB (cyclomatic 28) internal/handler/batch_task_manager.go:539 — BatchTaskManager.LoadFromDB 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.
D1 · Cyclomatic Complexity · ProjectHandler.UpdateFact (cyclomatic 28) · ×1
  • ProjectHandler.UpdateFact (cyclomatic 28) internal/handler/project.go:465 — ProjectHandler.UpdateFact 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.
D1 · Cyclomatic Complexity · VulnerabilityHandler.CreateRetest (cyclomatic 28) · ×1
  • VulnerabilityHandler.CreateRetest (cyclomatic 28) internal/handler/vulnerability_retest.go:14 — VulnerabilityHandler.CreateRetest has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Server.handleCallTool (cyclomatic 28) · ×1
  • Server.handleCallTool (cyclomatic 28) internal/mcp/server.go:521 — Server.handleCallTool 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.
D1 · Cyclomatic Complexity · assets.openAssetEditor (cyclomatic 28) · ×1
  • assets.openAssetEditor (cyclomatic 28) REDACTED:1295 — assets.openAssetEditor has cyclomatic complexity 28 (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.
D1 · Cyclomatic Complexity · monitor.formatPiRunRetryMessage (cyclomatic 28) · ×1
  • monitor.formatPiRunRetryMessage (cyclomatic 28) web/static/js/monitor.js:2729 — monitor.formatPiRunRetryMessage 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.
D1 · Cyclomatic Complexity · monitor.getToolResultDisplayState (cyclomatic 28) · ×1
  • monitor.getToolResultDisplayState (cyclomatic 28) web/static/js/monitor.js:5930 — monitor.getToolResultDisplayState has cyclomatic complexity 28 (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.
D1 · Cyclomatic Complexity · submitLogin (cyclomatic 28) · ×1
  • submitLogin (cyclomatic 28) web/static/js/auth.js:278 — submitLogin has cyclomatic complexity 28 (threshold 15). Of this number, 27 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · prefetchProcessDetailsSummaryHint (cyclomatic 28) · ×1
  • prefetchProcessDetailsSummaryHint (cyclomatic 28) web/static/js/chat.js:4580 — prefetchProcessDetailsSummaryHint has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 9 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 4588, 4589, 4610, …). 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.
D1 · Cyclomatic Complexity · renderRetrievalLogs (cyclomatic 28) · ×1
  • renderRetrievalLogs (cyclomatic 28) REDACTED:1362 — renderRetrievalLogs has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 3 of the 28 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1378, 1386, 1403, …). 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.
D1 · Cyclomatic Complexity · detectAIContext (cyclomatic 28) · ×1
  • detectAIContext (cyclomatic 28) web/static/js/settings.js:4007 — detectAIContext has cyclomatic complexity 28 (threshold 15). Of this number, 26 points are the body's own statements and 2 belong to 2 function items 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.
D1 · Cyclomatic Complexity · openVulnerabilityInspector (cyclomatic 28) · ×1
  • openVulnerabilityInspector (cyclomatic 28) web/static/js/vulnerability-workspace.js:104 — openVulnerabilityInspector has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · database.normalizeAsset (cyclomatic 27) · ×1
  • database.normalizeAsset (cyclomatic 27) internal/database/asset.go:98 — database.normalizeAsset 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.
D1 · Cyclomatic Complexity · database.grantSystemRolePermissions (cyclomatic 27) · ×1
  • database.grantSystemRolePermissions (cyclomatic 27) REDACTED:210 — database.grantSystemRolePermissions has cyclomatic complexity 27 (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.
D1 · Cyclomatic Complexity · DB.GetAssetStats (cyclomatic 27) · ×1
  • DB.GetAssetStats (cyclomatic 27) internal/database/asset.go:1241 — DB.GetAssetStats 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.
D1 · Cyclomatic Complexity · BatchTaskManager.loadQueueFromDB (cyclomatic 27) · ×1
  • BatchTaskManager.loadQueueFromDB (cyclomatic 27) internal/handler/batch_task_manager.go:302 — BatchTaskManager.loadQueueFromDB has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · KnowledgeHandler.GetItems (cyclomatic 27) · ×1
  • KnowledgeHandler.GetItems (cyclomatic 27) internal/handler/knowledge.go:63 — KnowledgeHandler.GetItems 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.
D1 · Cyclomatic Complexity · report.Render (cyclomatic 27) · ×1
  • report.Render (cyclomatic 27) internal/report/docx.go:68 — report.Render has cyclomatic complexity 27 (threshold 15). Of this number, 25 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · audit.auditResourceLink (cyclomatic 27) · ×1
  • audit.auditResourceLink (cyclomatic 27) web/static/js/audit.js:543 — audit.auditResourceLink has cyclomatic complexity 27 (threshold 15). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.renderActiveTasks (cyclomatic 27) · ×1
  • monitor.renderActiveTasks (cyclomatic 27) web/static/js/monitor.js:7091 — monitor.renderActiveTasks has cyclomatic complexity 27 (threshold 15). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 7146, openActiveTaskConversation, a function literal at line 7162). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · projects.loadProjectAssets (cyclomatic 27) · ×1
  • projects.loadProjectAssets (cyclomatic 27) web/static/js/projects.js:1056 — projects.loadProjectAssets has cyclomatic complexity 27 (threshold 15). Of this number, 22 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, 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.
D1 · Cyclomatic Complexity · webshell.parseWebshellListItems (cyclomatic 27) · ×1
  • webshell.parseWebshellListItems (cyclomatic 27) web/static/js/webshell.js:4325 — webshell.parseWebshellListItems 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.
D1 · Cyclomatic Complexity · batchScanSelectedFofaRows (cyclomatic 27) · ×1
  • batchScanSelectedFofaRows (cyclomatic 27) web/static/js/info-collect.js:1576 — batchScanSelectedFofaRows has cyclomatic complexity 27 (threshold 15). Of this number, 23 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PayloadBuilder.BuildBeacon (cyclomatic 26) · ×1
  • PayloadBuilder.BuildBeacon (cyclomatic 26) internal/c2/payload_builder.go:66 — PayloadBuilder.BuildBeacon has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · database.assetWhere (cyclomatic 26) · ×1
  • database.assetWhere (cyclomatic 26) internal/database/asset.go:400 — database.assetWhere has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · handler.transformSecretTree (cyclomatic 26) · ×1
  • handler.transformSecretTree (cyclomatic 26) internal/handler/config_secrets.go:42 — handler.transformSecretTree has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.Export (cyclomatic 26) · ×1
  • ChatUploadsHandler.Export (cyclomatic 26) REDACTED:866 — ChatUploadsHandler.Export has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MarkdownAgentsHandler.CreateMarkdownAgent (cyclomatic 26) · ×1
  • MarkdownAgentsHandler.CreateMarkdownAgent (cyclomatic 26) internal/handler/markdown_agents.go:156 — MarkdownAgentsHandler.CreateMarkdownAgent has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RobotHandler.cmdVulnerabilityAlerts (cyclomatic 26) · ×1
  • RobotHandler.cmdVulnerabilityAlerts (cyclomatic 26) internal/handler/vulnerability_alert.go:168 — RobotHandler.cmdVulnerabilityAlerts has cyclomatic complexity 26 (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.
D1 · Cyclomatic Complexity · Client.ChatCompletionStream (cyclomatic 26) · ×1
  • Client.ChatCompletionStream (cyclomatic 26) internal/openai/openai.go:181 — Client.ChatCompletionStream has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.streamCommandOutput (cyclomatic 26) · ×1
  • security.streamCommandOutput (cyclomatic 26) internal/security/executor.go:1127 — security.streamCommandOutput has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 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.
D1 · Cyclomatic Complexity · security.findStandaloneAmpersandPositions (cyclomatic 26) · ×1
  • security.findStandaloneAmpersandPositions (cyclomatic 26) internal/security/shell_background_io.go:8 — security.findStandaloneAmpersandPositions has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.validateRollbackEvidence (cyclomatic 26) · ×1
  • update.validateRollbackEvidence (cyclomatic 26) internal/update/recovery_evidence.go:217 — update.validateRollbackEvidence has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · assets.openAssetDetailRecord (cyclomatic 26) · ×1
  • assets.openAssetDetailRecord (cyclomatic 26) REDACTED:1744 — assets.openAssetDetailRecord 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.
D1 · Cyclomatic Complexity · c2.C2.renderSessions (cyclomatic 26) · ×1
  • c2.C2.renderSessions (cyclomatic 26) web/static/js/c2.js:1523 — c2.C2.renderSessions has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · chat.ensureProjectSidebarStructure (cyclomatic 26) · ×1
  • chat.ensureProjectSidebarStructure (cyclomatic 26) web/static/js/chat.js:6089 — chat.ensureProjectSidebarStructure has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.showNodeDetails (cyclomatic 26) · ×1
  • chat.showNodeDetails (cyclomatic 26) web/static/js/chat.js:7961 — chat.showNodeDetails has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · mobile-ui.filterNav (cyclomatic 26) · ×1
  • mobile-ui.filterNav (cyclomatic 26) web/static/js/mobile-ui.js:535 — mobile-ui.filterNav has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 5 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 541, 550, 583, …). 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.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsTimelineBody (cyclomatic 26) · ×1
  • monitor.renderMcpStatsTimelineBody (cyclomatic 26) web/static/js/monitor.js:8126 — monitor.renderMcpStatsTimelineBody has cyclomatic complexity 26 (threshold 15). Of this number, 24 points are the body's own statements and 2 belong to 2 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.
D1 · Cyclomatic Complexity · rbac.renderRbacRoles (cyclomatic 26) · ×1
  • rbac.renderRbacRoles (cyclomatic 26) web/static/js/rbac.js:659 — rbac.renderRbacRoles has cyclomatic complexity 26 (threshold 15). Of this number, 21 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · rbac.renderRbacAssignments (cyclomatic 26) · ×1
  • rbac.renderRbacAssignments (cyclomatic 26) web/static/js/rbac.js:850 — rbac.renderRbacAssignments has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 11 of the 26 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 870, 888, 854). 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.
D1 · Cyclomatic Complexity · settings.enhanceSettingsSelect (cyclomatic 26) · ×1
  • settings.enhanceSettingsSelect (cyclomatic 26) web/static/js/settings.js:186 — settings.enhanceSettingsSelect has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 8 of the 26 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 242, 271, 234). 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.
D1 · Cyclomatic Complexity · settings.fetchModelList (cyclomatic 26) · ×1
  • settings.fetchModelList (cyclomatic 26) web/static/js/settings.js:3618 — settings.fetchModelList has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.saveToolsConfig (cyclomatic 26) · ×1
  • settings.saveToolsConfig (cyclomatic 26) web/static/js/settings.js:4159 — settings.saveToolsConfig has cyclomatic complexity 26 (threshold 15). Of this number, 20 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · skills.renderSkillsPagination (cyclomatic 26) · ×1
  • skills.renderSkillsPagination (cyclomatic 26) web/static/js/skills.js:222 — skills.renderSkillsPagination has cyclomatic complexity 26 (threshold 15). Of this number, 22 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · cancelMCPToolExecutionSubmit (cyclomatic 26) · ×1
  • cancelMCPToolExecutionSubmit (cyclomatic 26) web/static/js/chat.js:5781 — cancelMCPToolExecutionSubmit has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · syncHitlConfigFromServer (cyclomatic 26) · ×1
  • syncHitlConfigFromServer (cyclomatic 26) web/static/js/hitl.js:586 — syncHitlConfigFromServer has cyclomatic complexity 26 (threshold 15). Of this number, 25 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · followAgentRunAfterHitlDecision (cyclomatic 26) · ×1
  • followAgentRunAfterHitlDecision (cyclomatic 26) web/static/js/hitl.js:714 — followAgentRunAfterHitlDecision has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to 8 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.
D1 · Cyclomatic Complexity · reconcileConversationAfterTaskReplay (cyclomatic 26) · ×1
  • reconcileConversationAfterTaskReplay (cyclomatic 26) web/static/js/monitor.js:5544 — reconcileConversationAfterTaskReplay has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · toggleToolDetail (cyclomatic 26) · ×1
  • toggleToolDetail (cyclomatic 26) web/static/js/settings.js:1488 — toggleToolDetail has cyclomatic complexity 26 (threshold 15). Of this number, 16 points are the body's own statements and 10 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.
D1 · Cyclomatic Complexity · webshellAiConvListSelect (cyclomatic 26) · ×1
  • webshellAiConvListSelect (cyclomatic 26) web/static/js/webshell.js:2392 — webshellAiConvListSelect has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 2405, 2401, 2395, …). 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.
D1 · Cyclomatic Complexity · App.RunWithContext (cyclomatic 25) · ×1
  • App.RunWithContext (cyclomatic 25) REDACTED:715 — App.RunWithContext has cyclomatic complexity 25 (threshold 15). Of this number, 18 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.
D1 · Cyclomatic Complexity · app.authorizeC2Action (cyclomatic 25) · ×1
  • app.authorizeC2Action (cyclomatic 25) internal/app/mcp_authorization.go:251 — app.authorizeC2Action has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Manager.EnqueueTask (cyclomatic 25) · ×1
  • Manager.EnqueueTask (cyclomatic 25) internal/c2/manager.go:492 — Manager.EnqueueTask has cyclomatic complexity 25 (threshold 15). Of this number, 24 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · database.validateAsset (cyclomatic 25) · ×1
  • database.validateAsset (cyclomatic 25) internal/database/asset.go:194 — database.validateAsset has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentTaskManager.CancelTask (cyclomatic 25) · ×1
  • AgentTaskManager.CancelTask (cyclomatic 25) internal/handler/task_manager.go:475 — AgentTaskManager.CancelTask has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SQLiteIndexer.Store (cyclomatic 25) · ×1
  • SQLiteIndexer.Store (cyclomatic 25) internal/knowledge/sqlite_indexer.go:34 — SQLiteIndexer.Store has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · api-docs.testAPI (cyclomatic 25) · ×1
  • api-docs.testAPI (cyclomatic 25) web/static/js/api-docs.js:629 — api-docs.testAPI has cyclomatic complexity 25 (threshold 15). Of this number, 18 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · assets.assetExportRows (cyclomatic 25) · ×1
  • assets.assetExportRows (cyclomatic 25) REDACTED:1021 — assets.assetExportRows has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 1 of the 25 points is its own statement and the rest belongs to one function literal inside it that branches (line 1022). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · chat-files.exportChatFiles (cyclomatic 25) · ×1
  • chat-files.exportChatFiles (cyclomatic 25) web/static/js/chat-files.js:435 — chat-files.exportChatFiles has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.renderMentionSuggestions (cyclomatic 25) · ×1
  • chat.renderMentionSuggestions (cyclomatic 25) web/static/js/chat.js:3125 — chat.renderMentionSuggestions has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3152, 3198). 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.
D1 · Cyclomatic Complexity · chat.syncAssistantTurnSummary (cyclomatic 25) · ×1
  • chat.syncAssistantTurnSummary (cyclomatic 25) web/static/js/chat.js:5150 — chat.syncAssistantTurnSummary has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat._acCollectExportData (cyclomatic 25) · ×1
  • chat._acCollectExportData (cyclomatic 25) web/static/js/chat.js:8403 — chat._acCollectExportData has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 2 of the 25 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 8406, 8436). 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.
D1 · Cyclomatic Complexity · webshell.webshellDbRenderTable (cyclomatic 25) · ×1
  • webshell.webshellDbRenderTable (cyclomatic 25) web/static/js/webshell.js:1800 — webshell.webshellDbRenderTable has cyclomatic complexity 25 (threshold 15). Of this number, 17 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · webshell.parseWebshellDbSchema (cyclomatic 25) · ×1
  • webshell.parseWebshellDbSchema (cyclomatic 25) web/static/js/webshell.js:1979 — webshell.parseWebshellDbSchema has cyclomatic complexity 25 (threshold 15). Of this number, 20 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflows.renderWorkflowPackageResolution (cyclomatic 25) · ×1
  • workflows.renderWorkflowPackageResolution (cyclomatic 25) web/static/js/workflows.js:2690 — workflows.renderWorkflowPackageResolution has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · copyCurlCommand (cyclomatic 25) · ×1
  • copyCurlCommand (cyclomatic 25) web/static/js/api-docs.js:737 — copyCurlCommand has cyclomatic complexity 25 (threshold 15). Of this number, 16 points are the body's own statements and 9 belong to 7 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · deleteKnowledgeItem (cyclomatic 25) · ×1
  • deleteKnowledgeItem (cyclomatic 25) REDACTED:1154 — deleteKnowledgeItem has cyclomatic complexity 25 (threshold 15). Of this number, 20 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · persistAIChannelsToServer (cyclomatic 25) · ×1
  • persistAIChannelsToServer (cyclomatic 25) web/static/js/settings.js:3025 — persistAIChannelsToServer has cyclomatic complexity 25 (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.
D1 · Cyclomatic Complexity · app.registerWebshellTools (cyclomatic 24) · ×1
  • app.registerWebshellTools (cyclomatic 24) REDACTED:1534 — app.registerWebshellTools has cyclomatic complexity 24 (threshold 15). Most of this is not in the body itself: 3 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1560, 1660, 1627, …). 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.
D1 · Cyclomatic Complexity · app.assetFilterFromToolArgs (cyclomatic 24) · ×1
  • app.assetFilterFromToolArgs (cyclomatic 24) internal/app/asset_tools.go:287 — app.assetFilterFromToolArgs has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · config.Load (cyclomatic 24) · ×1
  • config.Load (cyclomatic 24) internal/config/config.go:1546 — config.Load has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · config.WriteVersion (cyclomatic 24) · ×1
  • config.WriteVersion (cyclomatic 24) internal/config/config.go:1754 — config.WriteVersion has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · database.tokenizeSchema (cyclomatic 24) · ×1
  • database.tokenizeSchema (cyclomatic 24) internal/database/schema_reconcile.go:153 — database.tokenizeSchema has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.UpdateAssetsBulk (cyclomatic 24) · ×1
  • DB.UpdateAssetsBulk (cyclomatic 24) internal/database/asset.go:961 — DB.UpdateAssetsBulk has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.BootstrapRBAC (cyclomatic 24) · ×1
  • DB.BootstrapRBAC (cyclomatic 24) REDACTED:114 — DB.BootstrapRBAC has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.enrichSpecWithI18nKeys (cyclomatic 24) · ×1
  • handler.enrichSpecWithI18nKeys (cyclomatic 24) internal/handler/openapi_i18n.go:115 — handler.enrichSpecWithI18nKeys has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.ResolvePath (cyclomatic 24) · ×1
  • ChatUploadsHandler.ResolvePath (cyclomatic 24) REDACTED:1062 — ChatUploadsHandler.ResolvePath has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.Upload (cyclomatic 24) · ×1
  • ChatUploadsHandler.Upload (cyclomatic 24) REDACTED:1402 — ChatUploadsHandler.Upload has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConfigHandler.resolveProbeHeaders (cyclomatic 24) · ×1
  • ConfigHandler.resolveProbeHeaders (cyclomatic 24) internal/handler/config_probe_headers.go:12 — ConfigHandler.resolveProbeHeaders has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SkillsHandler.GetSkills (cyclomatic 24) · ×1
  • SkillsHandler.GetSkills (cyclomatic 24) internal/handler/skills.go:62 — SkillsHandler.GetSkills has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VulnerabilityHandler.UpdateVulnerability (cyclomatic 24) · ×1
  • VulnerabilityHandler.UpdateVulnerability (cyclomatic 24) REDACTED:278 — VulnerabilityHandler.UpdateVulnerability has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · robot.handleDingMessage (cyclomatic 24) · ×1
  • robot.handleDingMessage (cyclomatic 24) internal/robot/ding.go:70 — robot.handleDingMessage has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.RunRoleBoundWorkflow (cyclomatic 24) · ×1
  • workflow.RunRoleBoundWorkflow (cyclomatic 24) internal/workflow/runner.go:28 — workflow.RunRoleBoundWorkflow has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SimpleJson.extractStringField (cyclomatic 24) · ×1
  • SimpleJson.extractStringField (cyclomatic 24) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SimpleJson.java:26 — SimpleJson.extractStringField has cyclomatic complexity 24 (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.
D1 · Cyclomatic Complexity · assets.parseAssetEditorTarget (cyclomatic 24) · ×1
  • assets.parseAssetEditorTarget (cyclomatic 24) REDACTED:1391 — assets.parseAssetEditorTarget has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.enhanceSessionSettingsSelect (cyclomatic 24) · ×1
  • chat.enhanceSessionSettingsSelect (cyclomatic 24) web/static/js/chat.js:218 — chat.enhanceSessionSettingsSelect 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 3 function literals inside it that branch (lines 266, 297, 257). 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.
D1 · Cyclomatic Complexity · chat.chatSystemModelConfigState (cyclomatic 24) · ×1
  • chat.chatSystemModelConfigState (cyclomatic 24) web/static/js/chat.js:1098 — chat.chatSystemModelConfigState has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · chat.fetchMentionTools (cyclomatic 24) · ×1
  • chat.fetchMentionTools (cyclomatic 24) web/static/js/chat.js:2850 — chat.fetchMentionTools 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.
D1 · Cyclomatic Complexity · dashboard.renderSeverityDonut (cyclomatic 24) · ×1
  • dashboard.renderSeverityDonut (cyclomatic 24) web/static/js/dashboard.js:2034 — dashboard.renderSeverityDonut has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · info-collect.renderFofaResults (cyclomatic 24) · ×1
  • info-collect.renderFofaResults (cyclomatic 24) web/static/js/info-collect.js:1038 — info-collect.renderFofaResults has cyclomatic complexity 24 (threshold 15). Of this number, 17 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.toggleProcessDetails (cyclomatic 24) · ×1
  • monitor.toggleProcessDetails (cyclomatic 24) web/static/js/monitor.js:2575 — monitor.toggleProcessDetails has cyclomatic complexity 24 (threshold 15). Of this number, 22 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · update.pollUpdateJob (cyclomatic 24) · ×1
  • update.pollUpdateJob (cyclomatic 24) web/static/js/update.js:358 — update.pollUpdateJob has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · vulnerability.saveVulnerability (cyclomatic 24) · ×1
  • vulnerability.saveVulnerability (cyclomatic 24) web/static/js/vulnerability.js:1828 — vulnerability.saveVulnerability has cyclomatic complexity 24 (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.
D1 · Cyclomatic Complexity · webshell.parseWebshellDbColumns (cyclomatic 24) · ×1
  • webshell.parseWebshellDbColumns (cyclomatic 24) web/static/js/webshell.js:2010 — webshell.parseWebshellDbColumns has cyclomatic complexity 24 (threshold 15). Of this number, 19 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agentruntime.preparePiRuntime (cyclomatic 23) · ×1
  • agentruntime.preparePiRuntime (cyclomatic 23) internal/agentruntime/build.go:65 — agentruntime.preparePiRuntime has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.initializeKnowledge (cyclomatic 23) · ×1
  • app.initializeKnowledge (cyclomatic 23) REDACTED:2130 — app.initializeKnowledge has cyclomatic complexity 23 (threshold 15). Of this number, 13 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · attackchain.PromoteToProject (cyclomatic 23) · ×1
  • attackchain.PromoteToProject (cyclomatic 23) internal/attackchain/promote_project.go:26 — attackchain.PromoteToProject has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.reconcileSchema (cyclomatic 23) · ×1
  • DB.reconcileSchema (cyclomatic 23) internal/database/schema_reconcile.go:66 — DB.reconcileSchema has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.updateExternalMCPConfig (cyclomatic 23) · ×1
  • handler.updateExternalMCPConfig (cyclomatic 23) internal/handler/external_mcp.go:408 — handler.updateExternalMCPConfig has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchTaskManager.PrepareSingleTaskRun (cyclomatic 23) · ×1
  • BatchTaskManager.PrepareSingleTaskRun (cyclomatic 23) internal/handler/batch_task_manager.go:993 — BatchTaskManager.PrepareSingleTaskRun has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RoleHandler.UpdateRole (cyclomatic 23) · ×1
  • RoleHandler.UpdateRole (cyclomatic 23) REDACTED:96 — RoleHandler.UpdateRole has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowHandler.save (cyclomatic 23) · ×1
  • WorkflowHandler.save (cyclomatic 23) REDACTED:211 — WorkflowHandler.save 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.
D1 · Cyclomatic Complexity · nativeSplitter.Transform (cyclomatic 23) · ×1
  • nativeSplitter.Transform (cyclomatic 23) internal/knowledge/splitter.go:60 — nativeSplitter.Transform has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VectorRetriever.Retrieve (cyclomatic 23) · ×1
  • VectorRetriever.Retrieve (cyclomatic 23) internal/knowledge/vector_retriever.go:31 — VectorRetriever.Retrieve has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.checkRecoveryValue (cyclomatic 23) · ×1
  • update.checkRecoveryValue (cyclomatic 23) internal/update/recovery_evidence.go:28 — update.checkRecoveryValue has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · api-docs.renderTestSection (cyclomatic 23) · ×1
  • api-docs.renderTestSection (cyclomatic 23) web/static/js/api-docs.js:520 — api-docs.renderTestSection has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · c2.c2ProjectDisplayName (cyclomatic 23) · ×1
  • c2.c2ProjectDisplayName (cyclomatic 23) web/static/js/c2.js:79 — c2.c2ProjectDisplayName 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.
D1 · Cyclomatic Complexity · c2.C2.renderSessionDetail (cyclomatic 23) · ×1
  • c2.C2.renderSessionDetail (cyclomatic 23) web/static/js/c2.js:1599 — c2.C2.renderSessionDetail has cyclomatic complexity 23 (threshold 15). Of this number, 17 points are the body's own statements and 6 belong to 4 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.applyHitlSidebarConfig (cyclomatic 23) · ×1
  • chat.applyHitlSidebarConfig (cyclomatic 23) web/static/js/chat.js:740 — chat.applyHitlSidebarConfig has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · hitl.hitlAuditEngineFromItem (cyclomatic 23) · ×1
  • hitl.hitlAuditEngineFromItem (cyclomatic 23) web/static/js/hitl.js:1272 — hitl.hitlAuditEngineFromItem 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.
D1 · Cyclomatic Complexity · monitor.renderInlineHitlApproval (cyclomatic 23) · ×1
  • monitor.renderInlineHitlApproval (cyclomatic 23) web/static/js/monitor.js:4467 — monitor.renderInlineHitlApproval 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.
D1 · Cyclomatic Complexity · roles.initSelectionDetailTooltip (cyclomatic 23) · ×1
  • roles.initSelectionDetailTooltip (cyclomatic 23) web/static/js/roles.js:177 — roles.initSelectionDetailTooltip has cyclomatic complexity 23 (threshold 15). Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 217, a function literal at line 222, positionTooltip, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · roles.renderRolesList (cyclomatic 23) · ×1
  • roles.renderRolesList (cyclomatic 23) web/static/js/roles.js:581 — roles.renderRolesList has cyclomatic complexity 23 (threshold 15). Of this number, 12 points are the body's own statements and 11 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · vulnerability.refreshVulnerabilityProjectFilter (cyclomatic 23) · ×1
  • vulnerability.refreshVulnerabilityProjectFilter (cyclomatic 23) web/static/js/vulnerability.js:2580 — vulnerability.refreshVulnerabilityProjectFilter has cyclomatic complexity 23 (threshold 15). Of this number, 17 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.
D1 · Cyclomatic Complexity · webshell.selectWebshell · ×1
  • webshell.selectWebshell::applyActiveDbProfileToForm (cyclomatic 23) web/static/js/webshell.js:2876 — webshell.selectWebshell::applyActiveDbProfileToForm 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. This shape REPEATS in the file: one other method here (webshell.selectWebshell) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · openNotificationTarget (cyclomatic 23) · ×1
  • openNotificationTarget (cyclomatic 23) web/static/js/notifications.js:136 — openNotificationTarget has cyclomatic complexity 23 (threshold 15). Of this number, 15 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Agent.repairOrphanToolMessages (cyclomatic 22) · ×1
  • Agent.repairOrphanToolMessages (cyclomatic 22) internal/agent/agent.go:668 — Agent.repairOrphanToolMessages 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.
D1 · Cyclomatic Complexity · Builder.formatProcessDetailsForAttackChain (cyclomatic 22) · ×1
  • Builder.formatProcessDetailsForAttackChain (cyclomatic 22) internal/attackchain/builder.go:312 — Builder.formatProcessDetailsForAttackChain 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.
D1 · Cyclomatic Complexity · c2.ValidateBeaconDialHost (cyclomatic 22) · ×1
  • c2.ValidateBeaconDialHost (cyclomatic 22) internal/c2/beacon_host.go:44 — c2.ValidateBeaconDialHost has cyclomatic complexity 22 (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.
D1 · Cyclomatic Complexity · DB.UpsertAssets (cyclomatic 22) · ×1
  • DB.UpsertAssets (cyclomatic 22) internal/database/asset.go:306 — DB.UpsertAssets 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.
D1 · Cyclomatic Complexity · AgentHandler.CreateBatchQueue (cyclomatic 22) · ×1
  • AgentHandler.CreateBatchQueue (cyclomatic 22) internal/handler/agent.go:1900 — AgentHandler.CreateBatchQueue 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.
D1 · Cyclomatic Complexity · AgentHandler.submitAgentRunWithExecutor (cyclomatic 22) · ×1
  • AgentHandler.submitAgentRunWithExecutor (cyclomatic 22) internal/handler/async_agent_runs.go:29 — AgentHandler.submitAgentRunWithExecutor 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.
D1 · Cyclomatic Complexity · AgentHandler.handleBatchSubTaskRunError (cyclomatic 22) · ×1
  • AgentHandler.handleBatchSubTaskRunError (cyclomatic 22) internal/handler/batch_queue_executor.go:366 — AgentHandler.handleBatchSubTaskRunError 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.
D1 · Cyclomatic Complexity · AssetHandler.Merge (cyclomatic 22) · ×1
  • AssetHandler.Merge (cyclomatic 22) internal/handler/asset.go:437 — AssetHandler.Merge has cyclomatic complexity 22 (threshold 15). Of this number, 20 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.Download (cyclomatic 22) · ×1
  • ChatUploadsHandler.Download (cyclomatic 22) REDACTED:980 — ChatUploadsHandler.Download 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.
D1 · Cyclomatic Complexity · FofaHandler.Search (cyclomatic 22) · ×1
  • FofaHandler.Search (cyclomatic 22) REDACTED:578 — FofaHandler.Search 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.
D1 · Cyclomatic Complexity · RobotHandler.HandleWecomPOST (cyclomatic 22) · ×1
  • RobotHandler.HandleWecomPOST (cyclomatic 22) REDACTED:1550 — RobotHandler.HandleWecomPOST has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentTaskManager.FinishTaskRun (cyclomatic 22) · ×1
  • AgentTaskManager.FinishTaskRun (cyclomatic 22) internal/handler/task_manager.go:615 — AgentTaskManager.FinishTaskRun 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.
D1 · Cyclomatic Complexity · project.SyncBodyLinksSection (cyclomatic 22) · ×1
  • project.SyncBodyLinksSection (cyclomatic 22) internal/project/fact_body_links.go:109 — project.SyncBodyLinksSection 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.
D1 · Cyclomatic Complexity · reasoning.ProviderExtraFields (cyclomatic 22) · ×1
  • reasoning.ProviderExtraFields (cyclomatic 22) internal/reasoning/provider.go:46 — reasoning.ProviderExtraFields 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.
D1 · Cyclomatic Complexity · robot.SendProactive (cyclomatic 22) · ×1
  • robot.SendProactive (cyclomatic 22) internal/robot/proactive.go:25 — robot.SendProactive 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.
D1 · Cyclomatic Complexity · update.finishRollback (cyclomatic 22) · ×1
  • update.finishRollback (cyclomatic 22) internal/update/rollback_pending.go:60 — update.finishRollback 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.
D1 · Cyclomatic Complexity · workflow.normalizeLLMDraft (cyclomatic 22) · ×1
  • workflow.normalizeLLMDraft (cyclomatic 22) internal/workflow/draft_generator.go:419 — workflow.normalizeLLMDraft 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.
D1 · Cyclomatic Complexity · CyberStrikeAITab.wireActions (cyclomatic 22) · ×1
  • CyberStrikeAITab.wireActions (cyclomatic 22) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:426 — CyberStrikeAITab.wireActions 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.
D1 · Cyclomatic Complexity · assets.ensureAssetEditorInteractions (cyclomatic 22) · ×1
  • assets.ensureAssetEditorInteractions (cyclomatic 22) REDACTED:1499 — assets.ensureAssetEditorInteractions has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 2 of the 22 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 1516, 1511, 1505, …). 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.
D1 · Cyclomatic Complexity · assets.saveAsset (cyclomatic 22) · ×1
  • assets.saveAsset (cyclomatic 22) REDACTED:1593 — assets.saveAsset 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.
D1 · Cyclomatic Complexity · c2.C2.renderTasks (cyclomatic 22) · ×1
  • c2.C2.renderTasks (cyclomatic 22) web/static/js/c2.js:3520 — c2.C2.renderTasks has cyclomatic complexity 22 (threshold 15). Of this number, 16 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat-plan-progress.handlePlanToolEvent (cyclomatic 22) · ×1
  • chat-plan-progress.handlePlanToolEvent (cyclomatic 22) web/static/js/chat-plan-progress.js:299 — chat-plan-progress.handlePlanToolEvent 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.
D1 · Cyclomatic Complexity · modal.prepareSurface (cyclomatic 22) · ×1
  • modal.prepareSurface (cyclomatic 22) web/static/js/modal.js:42 — modal.prepareSurface has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.integrateProgressToMCPSection (cyclomatic 22) · ×1
  • monitor.integrateProgressToMCPSection (cyclomatic 22) web/static/js/monitor.js:1726 — monitor.integrateProgressToMCPSection 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.
D1 · Cyclomatic Complexity · monitor.updateProcessDetailsPaginationButtons (cyclomatic 22) · ×1
  • monitor.updateProcessDetailsPaginationButtons (cyclomatic 22) web/static/js/monitor.js:2039 — monitor.updateProcessDetailsPaginationButtons has cyclomatic complexity 22 (threshold 15). Of this number, 18 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsCombinedSection (cyclomatic 22) · ×1
  • monitor.renderMcpStatsCombinedSection (cyclomatic 22) web/static/js/monitor.js:8174 — monitor.renderMcpStatsCombinedSection 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.
D1 · Cyclomatic Complexity · settings.switchSettingsSection (cyclomatic 22) · ×1
  • settings.switchSettingsSection (cyclomatic 22) web/static/js/settings.js:688 — settings.switchSettingsSection 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.
D1 · Cyclomatic Complexity · settings.resolveSavedAIChannelId (cyclomatic 22) · ×1
  • settings.resolveSavedAIChannelId (cyclomatic 22) web/static/js/settings.js:2990 — settings.resolveSavedAIChannelId has cyclomatic complexity 22 (threshold 15). Of this number, 14 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
D1 · Cyclomatic Complexity · skills.selectSkillPackageFile (cyclomatic 22) · ×1
  • skills.selectSkillPackageFile (cyclomatic 22) web/static/js/skills.js:550 — skills.selectSkillPackageFile 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.
D1 · Cyclomatic Complexity · skills.viewSkill (cyclomatic 22) · ×1
  • skills.viewSkill (cyclomatic 22) web/static/js/skills.js:658 — skills.viewSkill has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to 2 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.
D1 · Cyclomatic Complexity · storage.renderRows (cyclomatic 22) · ×1
  • storage.renderRows (cyclomatic 22) web/static/js/storage.js:137 — storage.renderRows has cyclomatic complexity 22 (threshold 15). Of this number, 11 points are the body's own statements and 11 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · storage.renderResult (cyclomatic 22) · ×1
  • storage.renderResult (cyclomatic 22) web/static/js/storage.js:218 — storage.renderResult has cyclomatic complexity 22 (threshold 15). Of this number, 12 points are the body's own statements and 10 belong to 2 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.
D1 · Cyclomatic Complexity · webshell.parseWebshellDbTableColumns (cyclomatic 22) · ×1
  • webshell.parseWebshellDbTableColumns (cyclomatic 22) web/static/js/webshell.js:2042 — webshell.parseWebshellDbTableColumns has cyclomatic complexity 22 (threshold 15). Of this number, 17 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · webshell.renderDirectoryTree · ×1
  • webshell.renderDirectoryTree::renderNode (cyclomatic 22) web/static/js/webshell.js:4614 — webshell.renderDirectoryTree::renderNode 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. This shape REPEATS in the file: one other method here (webshell.renderDirectoryTree) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · uploadFileToImplant (cyclomatic 22) · ×1
  • uploadFileToImplant (cyclomatic 22) web/static/js/c2.js:2987 — uploadFileToImplant has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 3031, a function literal at line 3022, a function literal at line 3045, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · applyWebshellDetectedOS (cyclomatic 22) · ×1
  • applyWebshellDetectedOS (cyclomatic 22) web/static/js/webshell.js:121 — applyWebshellDetectedOS 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.
D1 · Cyclomatic Complexity · probeWebshellConnection (cyclomatic 22) · ×1
  • probeWebshellConnection (cyclomatic 22) web/static/js/webshell.js:1230 — probeWebshellConnection has cyclomatic complexity 22 (threshold 15). Most of this is not in the body itself: 5 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1254, 1236, 1261, …). 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.
D1 · Cyclomatic Complexity · DB.ListConversationPlanTasksSince (cyclomatic 21) · ×1
  • DB.ListConversationPlanTasksSince (cyclomatic 21) internal/database/plantask.go:41 — DB.ListConversationPlanTasksSince has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ConversationHandler.GetMessageProcessDetails (cyclomatic 21) · ×1
  • ConversationHandler.GetMessageProcessDetails (cyclomatic 21) REDACTED:325 — ConversationHandler.GetMessageProcessDetails has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MonitorHandler.loadExecutionsWithPagination (cyclomatic 21) · ×1
  • MonitorHandler.loadExecutionsWithPagination (cyclomatic 21) internal/handler/monitor.go:357 — MonitorHandler.loadExecutionsWithPagination has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WechatRobotHandler.HandleWechatQRCodeStatus (cyclomatic 21) · ×1
  • WechatRobotHandler.HandleWechatQRCodeStatus (cyclomatic 21) internal/handler/wechat_robot.go:141 — WechatRobotHandler.HandleWechatQRCodeStatus has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · knowledge.RegisterKnowledgeTool (cyclomatic 21) · ×1
  • knowledge.RegisterKnowledgeTool (cyclomatic 21) internal/knowledge/tool.go:17 — knowledge.RegisterKnowledgeTool 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 2 function literals inside it that branch (lines 102, 35). 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.
D1 · Cyclomatic Complexity · SimpleJson.extractObjectArray (cyclomatic 21) · ×1
  • SimpleJson.extractObjectArray (cyclomatic 21) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SimpleJson.java:98 — SimpleJson.extractObjectArray has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · c2.C2.renderEvents (cyclomatic 21) · ×1
  • c2.C2.renderEvents (cyclomatic 21) web/static/js/c2.js:4291 — c2.C2.renderEvents has cyclomatic complexity 21 (threshold 15). Of this number, 17 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.renderConversationsPagination (cyclomatic 21) · ×1
  • chat.renderConversationsPagination (cyclomatic 21) web/static/js/chat.js:9917 — chat.renderConversationsPagination 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.
D1 · Cyclomatic Complexity · fact-graph.resolveGraphNodeType (cyclomatic 21) · ×1
  • fact-graph.resolveGraphNodeType (cyclomatic 21) web/static/js/fact-graph.js:781 — fact-graph.resolveGraphNodeType 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.
D1 · Cyclomatic Complexity · info-collect.showFofaParseModal (cyclomatic 21) · ×1
  • info-collect.showFofaParseModal (cyclomatic 21) web/static/js/info-collect.js:891 — info-collect.showFofaParseModal has cyclomatic complexity 21 (threshold 15). Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 968, 910, 962). 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.
D1 · Cyclomatic Complexity · mobile-ui.enableSelectionPanelSwipe (cyclomatic 21) · ×1
  • mobile-ui.enableSelectionPanelSwipe (cyclomatic 21) web/static/js/mobile-ui.js:291 — mobile-ui.enableSelectionPanelSwipe 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 4 function literals inside it that branch (lines 302, 316, 327, …). 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.
D1 · Cyclomatic Complexity · projects.createVulnerabilityFromCurrentFact (cyclomatic 21) · ×1
  • projects.createVulnerabilityFromCurrentFact (cyclomatic 21) web/static/js/projects.js:1745 — projects.createVulnerabilityFromCurrentFact has cyclomatic complexity 21 (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.
D1 · Cyclomatic Complexity · projects.loadChatProjectFolderContext (cyclomatic 21) · ×1
  • projects.loadChatProjectFolderContext (cyclomatic 21) web/static/js/projects.js:3413 — projects.loadChatProjectFolderContext has cyclomatic complexity 21 (threshold 15). Of this number, 15 points are the body's own statements and 6 belong to 2 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.
D1 · Cyclomatic Complexity · roles.loadRoleTools (cyclomatic 21) · ×1
  • roles.loadRoleTools (cyclomatic 21) web/static/js/roles.js:827 — roles.loadRoleTools has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · roles.renderRoleToolsPagination (cyclomatic 21) · ×1
  • roles.renderRoleToolsPagination (cyclomatic 21) web/static/js/roles.js:992 — roles.renderRoleToolsPagination 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.
D1 · Cyclomatic Complexity · tasks.getBatchQueueStatusPresentation (cyclomatic 21) · ×1
  • tasks.getBatchQueueStatusPresentation (cyclomatic 21) web/static/js/tasks.js:35 — tasks.getBatchQueueStatusPresentation has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tasks.renderBatchQueuesPagination (cyclomatic 21) · ×1
  • tasks.renderBatchQueuesPagination (cyclomatic 21) web/static/js/tasks.js:1681 — tasks.renderBatchQueuesPagination 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.
D1 · Cyclomatic Complexity · wechat-robot.pollWechatBindStatus (cyclomatic 21) · ×1
  • wechat-robot.pollWechatBindStatus (cyclomatic 21) web/static/js/wechat-robot.js:315 — wechat-robot.pollWechatBindStatus has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · saveMarkdownAgent (cyclomatic 21) · ×1
  • saveMarkdownAgent (cyclomatic 21) web/static/js/agents.js:160 — saveMarkdownAgent 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.
D1 · Cyclomatic Complexity · renderExternalMcpHealth (cyclomatic 21) · ×1
  • renderExternalMcpHealth (cyclomatic 21) web/static/js/dashboard.js:891 — renderExternalMcpHealth 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.
D1 · Cyclomatic Complexity · Builder.formatAgentTraceFromChatMessages (cyclomatic 20) · ×1
  • Builder.formatAgentTraceFromChatMessages (cyclomatic 20) internal/attackchain/builder.go:435 — Builder.formatAgentTraceFromChatMessages has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Service.Record (cyclomatic 20) · ×1
  • Service.Record (cyclomatic 20) internal/audit/service.go:45 — Service.Record 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.
D1 · Cyclomatic Complexity · DB.AssignResourcesToUser (cyclomatic 20) · ×1
  • DB.AssignResourcesToUser (cyclomatic 20) REDACTED:823 — DB.AssignResourcesToUser has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.AssignResourcesToUserAuto (cyclomatic 20) · ×1
  • DB.AssignResourcesToUserAuto (cyclomatic 20) REDACTED:898 — DB.AssignResourcesToUserAuto has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentHandler.startBatchQueueExecution (cyclomatic 20) · ×1
  • AgentHandler.startBatchQueueExecution (cyclomatic 20) internal/handler/agent.go:2409 — AgentHandler.startBatchQueueExecution has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AgentHandler.waitHITLApproval (cyclomatic 20) · ×1
  • AgentHandler.waitHITLApproval (cyclomatic 20) internal/handler/hitl.go:624 — AgentHandler.waitHITLApproval 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.
D1 · Cyclomatic Complexity · AgentHandler.runRoleWorkflowStreamIfBound (cyclomatic 20) · ×1
  • AgentHandler.runRoleWorkflowStreamIfBound (cyclomatic 20) internal/handler/workflow_integration.go:58 — AgentHandler.runRoleWorkflowStreamIfBound has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BatchTaskManager.ListQueuesForAccess (cyclomatic 20) · ×1
  • BatchTaskManager.ListQueuesForAccess (cyclomatic 20) internal/handler/batch_task_manager.go:444 — BatchTaskManager.ListQueuesForAccess has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.collectReductionFiles (cyclomatic 20) · ×1
  • ChatUploadsHandler.collectReductionFiles (cyclomatic 20) REDACTED:459 — ChatUploadsHandler.collectReductionFiles has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 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.
D1 · Cyclomatic Complexity · HITLManager.reconcileRestartInterruptedMessages (cyclomatic 20) · ×1
  • HITLManager.reconcileRestartInterruptedMessages (cyclomatic 20) internal/handler/hitl.go:93 — HITLManager.reconcileRestartInterruptedMessages has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VulnerabilityHandler.ListVulnerabilities (cyclomatic 20) · ×1
  • VulnerabilityHandler.ListVulnerabilities (cyclomatic 20) REDACTED:184 — VulnerabilityHandler.ListVulnerabilities 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.
D1 · Cyclomatic Complexity · Manager.GetItemsWithOptions (cyclomatic 20) · ×1
  • Manager.GetItemsWithOptions (cyclomatic 20) internal/knowledge/manager.go:253 — Manager.GetItemsWithOptions has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · multiagent.piModelConfig (cyclomatic 20) · ×1
  • multiagent.piModelConfig (cyclomatic 20) internal/multiagent/pi_model.go:10 — multiagent.piModelConfig 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.
D1 · Cyclomatic Complexity · security.finalizeJoinedBoundedOutputs (cyclomatic 20) · ×1
  • security.finalizeJoinedBoundedOutputs (cyclomatic 20) internal/security/executor.go:1022 — security.finalizeJoinedBoundedOutputs has cyclomatic complexity 20 (threshold 15). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Executor.parseAdditionalArgs (cyclomatic 20) · ×1
  • Executor.parseAdditionalArgs (cyclomatic 20) internal/security/executor.go:627 — Executor.parseAdditionalArgs has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Executor.executeSystemCommand (cyclomatic 20) · ×1
  • Executor.executeSystemCommand (cyclomatic 20) internal/security/executor.go:773 — Executor.executeSystemCommand has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.validateNodeConfigs (cyclomatic 20) · ×1
  • workflow.validateNodeConfigs (cyclomatic 20) internal/workflow/validation.go:133 — workflow.validateNodeConfigs has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · api.streamTest (cyclomatic 20) · ×1
  • api.streamTest (cyclomatic 20) plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:113 — api.streamTest has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · audit-datetime-picker.ensurePopover (cyclomatic 20) · ×1
  • audit-datetime-picker.ensurePopover (cyclomatic 20) web/static/js/audit-datetime-picker.js:116 — audit-datetime-picker.ensurePopover has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 150, 208). 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.
D1 · Cyclomatic Complexity · audit.showAuditLogDetail (cyclomatic 20) · ×1
  • audit.showAuditLogDetail (cyclomatic 20) web/static/js/audit.js:678 — audit.showAuditLogDetail has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · c2.C2.setSessionSleep (cyclomatic 20) · ×1
  • c2.C2.setSessionSleep (cyclomatic 20) web/static/js/c2.js:1753 — c2.C2.setSessionSleep has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat-plan-progress.fetchPlanTasks (cyclomatic 20) · ×1
  • chat-plan-progress.fetchPlanTasks (cyclomatic 20) web/static/js/chat-plan-progress.js:250 — chat-plan-progress.fetchPlanTasks has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.isAnonymousTaskFragmentToolCallDetail (cyclomatic 20) · ×1
  • chat.isAnonymousTaskFragmentToolCallDetail (cyclomatic 20) web/static/js/chat.js:3922 — chat.isAnonymousTaskFragmentToolCallDetail 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.
D1 · Cyclomatic Complexity · chat.showConversationContextMenu (cyclomatic 20) · ×1
  • chat.showConversationContextMenu (cyclomatic 20) web/static/js/chat.js:10343 — chat.showConversationContextMenu has cyclomatic complexity 20 (threshold 15). Of this number, 17 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · i18n.initI18n (cyclomatic 20) · ×1
  • i18n.initI18n (cyclomatic 20) web/static/js/i18n.js:204 — i18n.initI18n has cyclomatic complexity 20 (threshold 15). Of this number, 13 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · info-collect.initInfoCollectProviderSelect (cyclomatic 20) · ×1
  • info-collect.initInfoCollectProviderSelect (cyclomatic 20) web/static/js/info-collect.js:445 — info-collect.initInfoCollectProviderSelect has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 494, 523, 486, …). 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.
D1 · Cyclomatic Complexity · info-collect.bindFofaTableEvents (cyclomatic 20) · ×1
  • info-collect.bindFofaTableEvents (cyclomatic 20) web/static/js/info-collect.js:1356 — info-collect.bindFofaTableEvents has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1364, 1390). 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.
D1 · Cyclomatic Complexity · monitor.setHitlApprovalInterruptedVisualState (cyclomatic 20) · ×1
  • monitor.setHitlApprovalInterruptedVisualState (cyclomatic 20) web/static/js/monitor.js:1195 — monitor.setHitlApprovalInterruptedVisualState has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.findToolCallItemForHitl (cyclomatic 20) · ×1
  • monitor.findToolCallItemForHitl (cyclomatic 20) web/static/js/monitor.js:4585 — monitor.findToolCallItemForHitl has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.applyMonitorPayload (cyclomatic 20) · ×1
  • monitor.applyMonitorPayload (cyclomatic 20) web/static/js/monitor.js:7654 — monitor.applyMonitorPayload 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.
D1 · Cyclomatic Complexity · monitor.renderMcpTimelineActiveMoments (cyclomatic 20) · ×1
  • monitor.renderMcpTimelineActiveMoments (cyclomatic 20) web/static/js/monitor.js:8051 — monitor.renderMcpTimelineActiveMoments has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8063, 8057, 8056). 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.
D1 · Cyclomatic Complexity · notifications.renderNotificationList (cyclomatic 20) · ×1
  • notifications.renderNotificationList (cyclomatic 20) web/static/js/notifications.js:199 — notifications.renderNotificationList 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 4 function literals inside it that branch (lines 207, 227, 243, …). 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.
D1 · Cyclomatic Complexity · projects.parseProjectDate (cyclomatic 20) · ×1
  • projects.parseProjectDate (cyclomatic 20) web/static/js/projects.js:2455 — projects.parseProjectDate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · projects.getProjectApprovalTiming (cyclomatic 20) · ×1
  • projects.getProjectApprovalTiming (cyclomatic 20) web/static/js/projects.js:2659 — projects.getProjectApprovalTiming has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · projects.showProjectConversationPreview (cyclomatic 20) · ×1
  • projects.showProjectConversationPreview (cyclomatic 20) web/static/js/projects.js:3133 — projects.showProjectConversationPreview has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · projects.appendChatProjectConversationItem (cyclomatic 20) · ×1
  • projects.appendChatProjectConversationItem (cyclomatic 20) web/static/js/projects.js:3319 — projects.appendChatProjectConversationItem has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · projects.syncProjectConversationApprovalStatuses (cyclomatic 20) · ×1
  • projects.syncProjectConversationApprovalStatuses (cyclomatic 20) web/static/js/projects.js:3697 — projects.syncProjectConversationApprovalStatuses has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3708, 3699). 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.
D1 · Cyclomatic Complexity · settings.ensureAIConfigShape (cyclomatic 20) · ×1
  • settings.ensureAIConfigShape (cyclomatic 20) web/static/js/settings.js:2604 — settings.ensureAIConfigShape has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · settings.renderAIChannelList (cyclomatic 20) · ×1
  • settings.renderAIChannelList (cyclomatic 20) web/static/js/settings.js:2869 — settings.renderAIChannelList has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 4 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2873, 2884, 2895). 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.
D1 · Cyclomatic Complexity · settings.testVisionConnection (cyclomatic 20) · ×1
  • settings.testVisionConnection (cyclomatic 20) web/static/js/settings.js:3716 — settings.testVisionConnection 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.
D1 · Cyclomatic Complexity · settings.collectHitlAuditModelEffectiveConfig (cyclomatic 20) · ×1
  • settings.collectHitlAuditModelEffectiveConfig (cyclomatic 20) web/static/js/settings.js:3801 — settings.collectHitlAuditModelEffectiveConfig has cyclomatic complexity 20 (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.
D1 · Cyclomatic Complexity · settings.toggleExternalMCP (cyclomatic 20) · ×1
  • settings.toggleExternalMCP (cyclomatic 20) web/static/js/settings.js:4918 — settings.toggleExternalMCP has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · skills.renderSkillsList (cyclomatic 20) · ×1
  • skills.renderSkillsList (cyclomatic 20) web/static/js/skills.js:143 — skills.renderSkillsList has cyclomatic complexity 20 (threshold 15). Of this number, 10 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · tasks.showBatchImportModal (cyclomatic 20) · ×1
  • tasks.showBatchImportModal (cyclomatic 20) web/static/js/tasks.js:898 — tasks.showBatchImportModal has cyclomatic complexity 20 (threshold 15). Of this number, 14 points are the body's own statements and 6 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · terminal.createTerminalInContainer (cyclomatic 20) · ×1
  • terminal.createTerminalInContainer (cyclomatic 20) web/static/js/terminal.js:185 — terminal.createTerminalInContainer has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to 5 function items inside it that branch (sendResize, sendToWS, a function literal at line 233, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · tool-guard.addRule (cyclomatic 20) · ×1
  • tool-guard.addRule (cyclomatic 20) web/static/js/tool-guard.js:402 — tool-guard.addRule has cyclomatic complexity 20 (threshold 15). Of this number, 11 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · vulnerability.renderVulnerabilityPagination (cyclomatic 20) · ×1
  • vulnerability.renderVulnerabilityPagination (cyclomatic 20) web/static/js/vulnerability.js:1644 — vulnerability.renderVulnerabilityPagination 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.
D1 · Cyclomatic Complexity · webshell.renderWebshellTerminalSessions (cyclomatic 20) · ×1
  • webshell.renderWebshellTerminalSessions (cyclomatic 20) web/static/js/webshell.js:1587 — webshell.renderWebshellTerminalSessions has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1604, 1594). 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.
D1 · Cyclomatic Complexity · workflows.graphToElements (cyclomatic 20) · ×1
  • workflows.graphToElements (cyclomatic 20) web/static/js/workflows.js:185 — workflows.graphToElements has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 186, 200, 209). 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.
D1 · Cyclomatic Complexity · deleteRetrievalLog (cyclomatic 20) · ×1
  • deleteRetrievalLog (cyclomatic 20) REDACTED:1637 — deleteRetrievalLog has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · refreshMonitorPanel (cyclomatic 20) · ×1
  • refreshMonitorPanel (cyclomatic 20) web/static/js/monitor.js:7365 — refreshMonitorPanel has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · changePassword (cyclomatic 20) · ×1
  • changePassword (cyclomatic 20) web/static/js/settings.js:4322 — changePassword has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · loadTasks (cyclomatic 20) · ×1
  • loadTasks (cyclomatic 20) web/static/js/tasks.js:227 — loadTasks has cyclomatic complexity 20 (threshold 15). Of this number, 15 points are the body's own statements and 5 belong to 5 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.
D1 · Cyclomatic Complexity · wsInitAgentMode (cyclomatic 20) · ×1
  • wsInitAgentMode (cyclomatic 20) web/static/js/webshell.js:284 — wsInitAgentMode has cyclomatic complexity 20 (threshold 15). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 286, 294, 286, …). 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.
D1 · Cyclomatic Complexity · App.startRobotConnections (cyclomatic 19) · ×1
  • App.startRobotConnections (cyclomatic 19) REDACTED:869 — App.startRobotConnections 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.
D1 · Cyclomatic Complexity · DB.ListVulnerabilitiesByGroupForAccess (cyclomatic 19) · ×1
  • DB.ListVulnerabilitiesByGroupForAccess (cyclomatic 19) REDACTED:366 — DB.ListVulnerabilitiesByGroupForAccess has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.collectWorkspaceFiles (cyclomatic 19) · ×1
  • ChatUploadsHandler.collectWorkspaceFiles (cyclomatic 19) REDACTED:535 — ChatUploadsHandler.collectWorkspaceFiles has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 549). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · MarkdownAgentsHandler.UpdateMarkdownAgent (cyclomatic 19) · ×1
  • MarkdownAgentsHandler.UpdateMarkdownAgent (cyclomatic 19) internal/handler/markdown_agents.go:264 — MarkdownAgentsHandler.UpdateMarkdownAgent 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.
D1 · Cyclomatic Complexity · RobotHandler.HandleMessage (cyclomatic 19) · ×1
  • RobotHandler.HandleMessage (cyclomatic 19) REDACTED:383 — RobotHandler.HandleMessage 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.
D1 · Cyclomatic Complexity · TerminalHandler.RunCommand (cyclomatic 19) · ×1
  • TerminalHandler.RunCommand (cyclomatic 19) internal/handler/terminal.go:64 — TerminalHandler.RunCommand 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.
D1 · Cyclomatic Complexity · WebShellHandler.FileOp (cyclomatic 19) · ×1
  • WebShellHandler.FileOp (cyclomatic 19) REDACTED:854 — WebShellHandler.FileOp 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.
D1 · Cyclomatic Complexity · multiagent.resolveMainOrchestratorInstruction (cyclomatic 19) · ×1
  • multiagent.resolveMainOrchestratorInstruction (cyclomatic 19) internal/multiagent/orchestrator_instruction.go:26 — multiagent.resolveMainOrchestratorInstruction has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · project.BuildFactIndexBlock (cyclomatic 19) · ×1
  • project.BuildFactIndexBlock (cyclomatic 19) internal/project/blackboard.go:31 — project.BuildFactIndexBlock 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.
D1 · Cyclomatic Complexity · workflow.resolveBinding (cyclomatic 19) · ×1
  • workflow.resolveBinding (cyclomatic 19) internal/workflow/bindings.go:48 — workflow.resolveBinding has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.GenerateDraftFromNaturalLanguage (cyclomatic 19) · ×1
  • workflow.GenerateDraftFromNaturalLanguage (cyclomatic 19) internal/workflow/draft_generator.go:95 — workflow.GenerateDraftFromNaturalLanguage has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · service-worker.chrome.runtime.onMessage.addListener() (cyclomatic 19) · ×1
  • service-worker.chrome.runtime.onMessage.addListener() (cyclomatic 19) plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:74 — service-worker.chrome.runtime.onMessage.addListener() has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · agents.loadMarkdownAgents (cyclomatic 19) · ×1
  • agents.loadMarkdownAgents (cyclomatic 19) web/static/js/agents.js:34 — agents.loadMarkdownAgents has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · agents.editMarkdownAgent (cyclomatic 19) · ×1
  • agents.editMarkdownAgent (cyclomatic 19) web/static/js/agents.js:112 — agents.editMarkdownAgent has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 128). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · api-docs.formatDescription (cyclomatic 19) · ×1
  • api-docs.formatDescription (cyclomatic 19) web/static/js/api-docs.js:862 — api-docs.formatDescription has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · assets.renderAssetImportPreview (cyclomatic 19) · ×1
  • assets.renderAssetImportPreview (cyclomatic 19) REDACTED:369 — assets.renderAssetImportPreview has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, 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.
D1 · Cyclomatic Complexity · assets.fofaResultToAsset (cyclomatic 19) · ×1
  • assets.fofaResultToAsset (cyclomatic 19) REDACTED:1637 — assets.fofaResultToAsset has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 2 function items inside it that branch (value, firstValue). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · audit.renderAuditLogs (cyclomatic 19) · ×1
  • audit.renderAuditLogs (cyclomatic 19) web/static/js/audit.js:315 — audit.renderAuditLogs has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 337, 318). 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.
D1 · Cyclomatic Complexity · chat.finishProcessDetailsRender (cyclomatic 19) · ×1
  • chat.finishProcessDetailsRender (cyclomatic 19) web/static/js/chat.js:4542 — chat.finishProcessDetailsRender has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · chat.loadProjectFilterLocalOptions (cyclomatic 19) · ×1
  • chat.loadProjectFilterLocalOptions (cyclomatic 19) web/static/js/chat.js:9249 — chat.loadProjectFilterLocalOptions has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.finalizeMainResponseStreamItem (cyclomatic 19) · ×1
  • monitor.finalizeMainResponseStreamItem (cyclomatic 19) web/static/js/monitor.js:310 — monitor.finalizeMainResponseStreamItem 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.
D1 · Cyclomatic Complexity · monitor.setHitlApprovalTaskAvailability (cyclomatic 19) · ×1
  • monitor.setHitlApprovalTaskAvailability (cyclomatic 19) web/static/js/monitor.js:1246 — monitor.setHitlApprovalTaskAvailability has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.submitUserInterruptContinue (cyclomatic 19) · ×1
  • monitor.submitUserInterruptContinue (cyclomatic 19) web/static/js/monitor.js:1408 — monitor.submitUserInterruptContinue 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.
D1 · Cyclomatic Complexity · monitor.workflowHitlDataFromRun (cyclomatic 19) · ×1
  • monitor.workflowHitlDataFromRun (cyclomatic 19) web/static/js/monitor.js:5185 — monitor.workflowHitlDataFromRun 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.
D1 · Cyclomatic Complexity · monitor.isToolGuardBlockedResult (cyclomatic 19) · ×1
  • monitor.isToolGuardBlockedResult (cyclomatic 19) web/static/js/monitor.js:5904 — monitor.isToolGuardBlockedResult 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.
D1 · Cyclomatic Complexity · monitor.buildTimelineSparseHint (cyclomatic 19) · ×1
  • monitor.buildTimelineSparseHint (cyclomatic 19) web/static/js/monitor.js:8027 — monitor.buildTimelineSparseHint has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, 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.
D1 · Cyclomatic Complexity · monitor.bindMonitorStatsPanelEvents (cyclomatic 19) · ×1
  • monitor.bindMonitorStatsPanelEvents (cyclomatic 19) web/static/js/monitor.js:8640 — monitor.bindMonitorStatsPanelEvents has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 8664, 8644, 8686, …). 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.
D1 · Cyclomatic Complexity · projects.selectProject (cyclomatic 19) · ×1
  • projects.selectProject (cyclomatic 19) web/static/js/projects.js:994 — projects.selectProject 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.
D1 · Cyclomatic Complexity · projects.saveProjectModal (cyclomatic 19) · ×1
  • projects.saveProjectModal (cyclomatic 19) web/static/js/projects.js:2009 — projects.saveProjectModal 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.
D1 · Cyclomatic Complexity · roles.updateRoleSelectorDisplay (cyclomatic 19) · ×1
  • roles.updateRoleSelectorDisplay (cyclomatic 19) web/static/js/roles.js:346 — roles.updateRoleSelectorDisplay has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · roles.renderRoleToolsList (cyclomatic 19) · ×1
  • roles.renderRoleToolsList (cyclomatic 19) web/static/js/roles.js:908 — roles.renderRoleToolsList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 941). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · settings.getRobotStatus (cyclomatic 19) · ×1
  • settings.getRobotStatus (cyclomatic 19) web/static/js/settings.js:328 — settings.getRobotStatus has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.renderToolsPagination (cyclomatic 19) · ×1
  • settings.renderToolsPagination (cyclomatic 19) web/static/js/settings.js:1674 — settings.renderToolsPagination has cyclomatic complexity 19 (threshold 15). Of this number, 14 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.fillVisionConfigFromCurrent (cyclomatic 19) · ×1
  • settings.fillVisionConfigFromCurrent (cyclomatic 19) web/static/js/settings.js:2318 — settings.fillVisionConfigFromCurrent has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to one function item inside it that branches. 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.
D1 · Cyclomatic Complexity · skills.renderSkillsMonitor (cyclomatic 19) · ×1
  • skills.renderSkillsMonitor (cyclomatic 19) web/static/js/skills.js:968 — skills.renderSkillsMonitor has cyclomatic complexity 19 (threshold 15). Of this number, 12 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, 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.
D1 · Cyclomatic Complexity · update.renderUpdateApplyBody (cyclomatic 19) · ×1
  • update.renderUpdateApplyBody (cyclomatic 19) web/static/js/update.js:823 — update.renderUpdateApplyBody has cyclomatic complexity 19 (threshold 15). Of this number, 15 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · vulnerability.editVulnerability (cyclomatic 19) · ×1
  • vulnerability.editVulnerability (cyclomatic 19) web/static/js/vulnerability.js:1793 — vulnerability.editVulnerability has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 1801). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · webshell.renderDirectoryTree (cyclomatic 19) · ×1
  • webshell.renderDirectoryTree (cyclomatic 19) web/static/js/webshell.js:4552 — webshell.renderDirectoryTree 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. This shape REPEATS in the file: one other method here (webshell.renderDirectoryTree::renderNode) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · copyDetailBlock (cyclomatic 19) · ×1
  • copyDetailBlock (cyclomatic 19) web/static/js/chat.js:5846 — copyDetailBlock has cyclomatic complexity 19 (threshold 15). Of this number, 11 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · prefetchLastAssistantProcessDetails (cyclomatic 19) · ×1
  • prefetchLastAssistantProcessDetails (cyclomatic 19) web/static/js/chat.js:6319 — prefetchLastAssistantProcessDetails 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.
D1 · Cyclomatic Complexity · exportAttackChain (cyclomatic 19) · ×1
  • exportAttackChain (cyclomatic 19) web/static/js/chat.js:9074 — exportAttackChain has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 9081, 9093, 9100, …). 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.
D1 · Cyclomatic Complexity · probeSelectedAIChannels · ×1
  • probeSelectedAIChannels::probeNextAIChannel (cyclomatic 19) web/static/js/settings.js:3275 — probeSelectedAIChannels::probeNextAIChannel 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.
D1 · Cyclomatic Complexity · startInlineEditHITLPolicy (cyclomatic 19) · ×1
  • startInlineEditHITLPolicy (cyclomatic 19) web/static/js/tasks.js:2982 — startInlineEditHITLPolicy has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2998, 2992, 2995, …). 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.
D1 · Cyclomatic Complexity · fetchAndRenderWebshellAiConvList (cyclomatic 19) · ×1
  • fetchAndRenderWebshellAiConvList (cyclomatic 19) web/static/js/webshell.js:2342 — fetchAndRenderWebshellAiConvList has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 2349, 2370, 2365, …). 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.
D1 · Cyclomatic Complexity · toggleWorkflowEnabled (cyclomatic 19) · ×1
  • toggleWorkflowEnabled (cyclomatic 19) web/static/js/workflows.js:2042 — toggleWorkflowEnabled has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · (anonymous) (cyclomatic 19) · ×1
  • (anonymous) (cyclomatic 19) plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:74 — (anonymous) has cyclomatic complexity 19 (threshold 15). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HTTPBeaconListener.handleCheckIn (cyclomatic 18) · ×1
  • HTTPBeaconListener.handleCheckIn (cyclomatic 18) internal/c2/listener_http.go:161 — HTTPBeaconListener.handleCheckIn has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · database.vulnerabilityTargetHost (cyclomatic 18) · ×1
  • database.vulnerabilityTargetHost (cyclomatic 18) REDACTED:274 — database.vulnerabilityTargetHost has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DB.MergeAssets (cyclomatic 18) · ×1
  • DB.MergeAssets (cyclomatic 18) internal/database/asset.go:1113 — DB.MergeAssets has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · DB.CreateVulnerabilityRetest (cyclomatic 18) · ×1
  • DB.CreateVulnerabilityRetest (cyclomatic 18) internal/database/vulnerability_retest.go:61 — DB.CreateVulnerabilityRetest has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · handler.addModelContextToResponse (cyclomatic 18) · ×1
  • handler.addModelContextToResponse (cyclomatic 18) internal/handler/config.go:1300 — handler.addModelContextToResponse has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AgentHandler.auditAgentReview (cyclomatic 18) · ×1
  • AgentHandler.auditAgentReview (cyclomatic 18) internal/handler/hitl_audit_agent.go:23 — AgentHandler.auditAgentReview has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AssetHandler.RecordScans (cyclomatic 18) · ×1
  • AssetHandler.RecordScans (cyclomatic 18) internal/handler/asset.go:271 — AssetHandler.RecordScans has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatUploadsHandler.Mkdir (cyclomatic 18) · ×1
  • ChatUploadsHandler.Mkdir (cyclomatic 18) REDACTED:1205 — ChatUploadsHandler.Mkdir has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ConfigHandler.resolveProbeSecret (cyclomatic 18) · ×1
  • ConfigHandler.resolveProbeSecret (cyclomatic 18) internal/handler/config_secrets.go:143 — ConfigHandler.resolveProbeSecret has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WorkflowHandler.ResumeRun (cyclomatic 18) · ×1
  • WorkflowHandler.ResumeRun (cyclomatic 18) internal/handler/workflow_run.go:100 — WorkflowHandler.ResumeRun has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Manager.GetItemsSummary (cyclomatic 18) · ×1
  • Manager.GetItemsSummary (cyclomatic 18) internal/knowledge/manager.go:454 — Manager.GetItemsSummary has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · knowledgePipelineRetriever.Retrieve (cyclomatic 18) · ×1
  • knowledgePipelineRetriever.Retrieve (cyclomatic 18) internal/knowledge/retrieval_pipeline.go:30 — knowledgePipelineRetriever.Retrieve has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Client.claudeRequest (cyclomatic 18) · ×1
  • Client.claudeRequest (cyclomatic 18) internal/openai/claude_native.go:108 — Client.claudeRequest has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · skillpackage.ValidateAgentSkillManifest (cyclomatic 18) · ×1
  • skillpackage.ValidateAgentSkillManifest (cyclomatic 18) internal/skillpackage/validate.go:17 — skillpackage.ValidateAgentSkillManifest has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · update.stashProtected (cyclomatic 18) · ×1
  • update.stashProtected (cyclomatic 18) internal/update/apply.go:680 — update.stashProtected has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.restoreInterruptedProtected (cyclomatic 18) · ×1
  • update.restoreInterruptedProtected (cyclomatic 18) internal/update/apply.go:837 — update.restoreInterruptedProtected has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.normalizeLLMNodeConfig (cyclomatic 18) · ×1
  • workflow.normalizeLLMNodeConfig (cyclomatic 18) internal/workflow/draft_generator.go:513 — workflow.normalizeLLMNodeConfig has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CyberStrikeAIClient.streamTest (cyclomatic 18) · ×1
  • CyberStrikeAIClient.streamTest (cyclomatic 18) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:301 — CyberStrikeAIClient.streamTest has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · http-normalize.normalizeRequestBlock (cyclomatic 18) · ×1
  • http-normalize.normalizeRequestBlock (cyclomatic 18) plugins/browser-extension/cyberstrikeai-browser-extension/lib/http-normalize.js:31 — http-normalize.normalizeRequestBlock has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · panel.onSendConfirmed (cyclomatic 18) · ×1
  • panel.onSendConfirmed (cyclomatic 18) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:904 — panel.onSendConfirmed 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.
D1 · Cyclomatic Complexity · audit.auditMessageLabel (cyclomatic 18) · ×1
  • audit.auditMessageLabel (cyclomatic 18) web/static/js/audit.js:65 — audit.auditMessageLabel 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.
D1 · Cyclomatic Complexity · c2.C2.renderTasksPagination (cyclomatic 18) · ×1
  • c2.C2.renderTasksPagination (cyclomatic 18) web/static/js/c2.js:3250 — c2.C2.renderTasksPagination 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. This shape REPEATS in the file: one other method here (c2.C2.renderEventsPagination) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: c2.runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · c2.C2.viewTask · ×1
  • c2.C2.viewTask::renderTaskModal (cyclomatic 18) web/static/js/c2.js:3617 — c2.C2.viewTask::renderTaskModal 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. This is NOT this file's highest cyclomatic complexity: c2.runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · c2.C2.renderEventsPagination (cyclomatic 18) · ×1
  • c2.C2.renderEventsPagination (cyclomatic 18) web/static/js/c2.js:4188 — c2.C2.renderEventsPagination 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. This shape REPEATS in the file: one other method here (c2.C2.renderTasksPagination) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: c2.runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · chat-files.submitChatFilesMkdir (cyclomatic 18) · ×1
  • chat-files.submitChatFilesMkdir (cyclomatic 18) web/static/js/chat-files.js:1720 — chat-files.submitChatFilesMkdir has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.openChatSessionSettings (cyclomatic 18) · ×1
  • chat.openChatSessionSettings (cyclomatic 18) web/static/js/chat.js:1736 — chat.openChatSessionSettings has cyclomatic complexity 18 (threshold 15). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · dashboard.renderDashboardWebshellRecent (cyclomatic 18) · ×1
  • dashboard.renderDashboardWebshellRecent (cyclomatic 18) web/static/js/dashboard.js:605 — dashboard.renderDashboardWebshellRecent has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 619, 613, 634, …). 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.
D1 · Cyclomatic Complexity · hitl.applyHitlDefaultConfigFromServer (cyclomatic 18) · ×1
  • hitl.applyHitlDefaultConfigFromServer (cyclomatic 18) web/static/js/hitl.js:266 — hitl.applyHitlDefaultConfigFromServer has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · info-collect.exportFofaResults (cyclomatic 18) · ×1
  • info-collect.exportFofaResults (cyclomatic 18) web/static/js/info-collect.js:1502 — info-collect.exportFofaResults has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 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.
D1 · Cyclomatic Complexity · monitor.formatTimelineStreamBody (cyclomatic 18) · ×1
  • monitor.formatTimelineStreamBody (cyclomatic 18) web/static/js/monitor.js:147 — monitor.formatTimelineStreamBody has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.renderToolCallApprovalSummary (cyclomatic 18) · ×1
  • monitor.renderToolCallApprovalSummary (cyclomatic 18) web/static/js/monitor.js:4432 — monitor.renderToolCallApprovalSummary 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.
D1 · Cyclomatic Complexity · monitor.setMcpStatsDistHover (cyclomatic 18) · ×1
  • monitor.setMcpStatsDistHover (cyclomatic 18) web/static/js/monitor.js:8441 — monitor.setMcpStatsDistHover has cyclomatic complexity 18 (threshold 15). Of this number, 10 points are the body's own statements and 8 belong to 2 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.
D1 · Cyclomatic Complexity · projects.loadProjectFacts (cyclomatic 18) · ×1
  • projects.loadProjectFacts (cyclomatic 18) web/static/js/projects.js:1495 — projects.loadProjectFacts has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, 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.
D1 · Cyclomatic Complexity · projects.renderChatProjectFolders (cyclomatic 18) · ×1
  • projects.renderChatProjectFolders (cyclomatic 18) web/static/js/projects.js:3555 — projects.renderChatProjectFolders has cyclomatic complexity 18 (threshold 15). Of this number, 13 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · roles.updateRoleToolsStats (cyclomatic 18) · ×1
  • roles.updateRoleToolsStats (cyclomatic 18) web/static/js/roles.js:1184 — roles.updateRoleToolsStats has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1215, 1210). 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.
D1 · Cyclomatic Complexity · settings.readAIChannelFromMainForm (cyclomatic 18) · ×1
  • settings.readAIChannelFromMainForm (cyclomatic 18) web/static/js/settings.js:2651 — settings.readAIChannelFromMainForm 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.
D1 · Cyclomatic Complexity · settings.pollExternalMCPStatus (cyclomatic 18) · ×1
  • settings.pollExternalMCPStatus (cyclomatic 18) web/static/js/settings.js:5000 — settings.pollExternalMCPStatus has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tasks.startInlineEditRole (cyclomatic 18) · ×1
  • tasks.startInlineEditRole (cyclomatic 18) web/static/js/tasks.js:2580 — tasks.startInlineEditRole has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2586, 2589, 2589, …). 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.
D1 · Cyclomatic Complexity · webshell.normalizeWebshellDbSchema (cyclomatic 18) · ×1
  • webshell.normalizeWebshellDbSchema (cyclomatic 18) web/static/js/webshell.js:2069 — webshell.normalizeWebshellDbSchema has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 3 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2072, 2084, 2077, …). 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.
D1 · Cyclomatic Complexity · workflows.workflowAiAnimateGraph (cyclomatic 18) · ×1
  • workflows.workflowAiAnimateGraph (cyclomatic 18) web/static/js/workflows.js:1800 — workflows.workflowAiAnimateGraph has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · parseAssetImportMatrix (cyclomatic 18) · ×1
  • parseAssetImportMatrix (cyclomatic 18) REDACTED:285 — parseAssetImportMatrix has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 299, 301, 293, …). 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.
D1 · Cyclomatic Complexity · loadAuditLogs (cyclomatic 18) · ×1
  • loadAuditLogs (cyclomatic 18) web/static/js/audit.js:275 — loadAuditLogs has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · applyElkLayout (cyclomatic 18) · ×1
  • applyElkLayout (cyclomatic 18) web/static/js/fact-graph.js:484 — applyElkLayout has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 509, 532, 531, …). 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.
D1 · Cyclomatic Complexity · parseFofaNaturalLanguage (cyclomatic 18) · ×1
  • parseFofaNaturalLanguage (cyclomatic 18) web/static/js/info-collect.js:789 — parseFofaNaturalLanguage has cyclomatic complexity 18 (threshold 15). Of this number, 17 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Agent.getAvailableTools (cyclomatic 17) · ×1
  • Agent.getAvailableTools (cyclomatic 17) internal/agent/agent.go:313 — Agent.getAvailableTools has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.setupRoutes (cyclomatic 17) · ×1
  • app.setupRoutes (cyclomatic 17) REDACTED:948 — app.setupRoutes 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 16 function literals inside it that branch (lines 1011, 1209, 1220, …). 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.
D1 · Cyclomatic Complexity · app.registerC2TaskManageTool (cyclomatic 17) · ×1
  • app.registerC2TaskManageTool (cyclomatic 17) internal/app/c2_tools.go:444 — app.registerC2TaskManageTool 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 464). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · c2.GenerateOneliner (cyclomatic 17) · ×1
  • c2.GenerateOneliner (cyclomatic 17) internal/c2/payload_oneliner.go:107 — c2.GenerateOneliner has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Manager.IngestTaskResult (cyclomatic 17) · ×1
  • Manager.IngestTaskResult (cyclomatic 17) internal/c2/manager.go:713 — Manager.IngestTaskResult 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.
D1 · Cyclomatic Complexity · DB.GetConversation (cyclomatic 17) · ×1
  • DB.GetConversation (cyclomatic 17) REDACTED:240 — DB.GetConversation has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.LoadToolExecutionsWithPagination (cyclomatic 17) · ×1
  • DB.LoadToolExecutionsWithPagination (cyclomatic 17) REDACTED:164 — DB.LoadToolExecutionsWithPagination has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.UpsertProjectFact (cyclomatic 17) · ×1
  • DB.UpsertProjectFact (cyclomatic 17) internal/database/project.go:505 — DB.UpsertProjectFact 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.
D1 · Cyclomatic Complexity · DB.lookupRBACResourceOptionsByIDs (cyclomatic 17) · ×1
  • DB.lookupRBACResourceOptionsByIDs (cyclomatic 17) REDACTED:727 — DB.lookupRBACResourceOptionsByIDs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.relocateManualOrNewUploadToConversation (cyclomatic 17) · ×1
  • handler.relocateManualOrNewUploadToConversation (cyclomatic 17) internal/handler/agent.go:505 — handler.relocateManualOrNewUploadToConversation 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.
D1 · Cyclomatic Complexity · handler.saveAttachmentsToDateAndConversationDir (cyclomatic 17) · ×1
  • handler.saveAttachmentsToDateAndConversationDir (cyclomatic 17) internal/handler/agent.go:562 — handler.saveAttachmentsToDateAndConversationDir has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.assetListFilterFromQuery (cyclomatic 17) · ×1
  • handler.assetListFilterFromQuery (cyclomatic 17) internal/handler/asset.go:161 — handler.assetListFilterFromQuery 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.
D1 · Cyclomatic Complexity · handler.updateAIConfig (cyclomatic 17) · ×1
  • handler.updateAIConfig (cyclomatic 17) internal/handler/config.go:2309 — handler.updateAIConfig has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · C2Handler.ListTasks (cyclomatic 17) · ×1
  • C2Handler.ListTasks (cyclomatic 17) internal/handler/c2.go:476 — C2Handler.ListTasks 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 shape REPEATS in the file: one other method here (C2Handler.ListEvents) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · C2Handler.ListEvents (cyclomatic 17) · ×1
  • C2Handler.ListEvents (cyclomatic 17) internal/handler/c2.go:872 — C2Handler.ListEvents 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 shape REPEATS in the file: one other method here (C2Handler.ListTasks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · ProjectHandler.ListFacts (cyclomatic 17) · ×1
  • ProjectHandler.ListFacts (cyclomatic 17) internal/handler/project.go:337 — ProjectHandler.ListFacts has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RobotHandler.cmdHelp (cyclomatic 17) · ×1
  • RobotHandler.cmdHelp (cyclomatic 17) REDACTED:465 — RobotHandler.cmdHelp 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ExecutionService.Submit (cyclomatic 17) · ×1
  • ExecutionService.Submit (cyclomatic 17) internal/mcp/execution_service.go:125 — ExecutionService.Submit 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.
D1 · Cyclomatic Complexity · Server.CallTool (cyclomatic 17) · ×1
  • Server.CallTool (cyclomatic 17) internal/mcp/server.go:923 — Server.CallTool has cyclomatic complexity 17 (threshold 15). Of this number, 11 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.
D1 · Cyclomatic Complexity · Server.FinishToolExecution (cyclomatic 17) · ×1
  • Server.FinishToolExecution (cyclomatic 17) internal/mcp/server.go:1065 — Server.FinishToolExecution 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.
D1 · Cyclomatic Complexity · openai.patchNativeOpenAIReasoning (cyclomatic 17) · ×1
  • openai.patchNativeOpenAIReasoning (cyclomatic 17) internal/openai/native_reasoning_compat.go:17 — openai.patchNativeOpenAIReasoning 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.
D1 · Cyclomatic Complexity · Client.ChatCompletion (cyclomatic 17) · ×1
  • Client.ChatCompletion (cyclomatic 17) internal/openai/openai.go:85 — Client.ChatCompletion 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.
D1 · Cyclomatic Complexity · robot.runTelegramPoll (cyclomatic 17) · ×1
  • robot.runTelegramPoll (cyclomatic 17) internal/robot/telegram.go:96 — robot.runTelegramPoll has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.streamShellForeground (cyclomatic 17) · ×1
  • security.streamShellForeground (cyclomatic 17) internal/security/shell_execute_stream.go:92 — security.streamShellForeground has cyclomatic complexity 17 (threshold 15). Of this number, 10 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.
D1 · Cyclomatic Complexity · Executor.ExecuteTool (cyclomatic 17) · ×1
  • Executor.ExecuteTool (cyclomatic 17) internal/security/executor.go:122 — Executor.ExecuteTool has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.scanAdoption (cyclomatic 17) · ×1
  • update.scanAdoption (cyclomatic 17) REDACTED:342 — update.scanAdoption has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.runToolNode (cyclomatic 17) · ×1
  • workflow.runToolNode (cyclomatic 17) internal/workflow/nodes.go:57 — workflow.runToolNode 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.
D1 · Cyclomatic Complexity · MarkdownRenderer.toHtml (cyclomatic 17) · ×1
  • MarkdownRenderer.toHtml (cyclomatic 17) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/MarkdownRenderer.java:16 — MarkdownRenderer.toHtml has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · markdown.markdownToHtml (cyclomatic 17) · ×1
  • markdown.markdownToHtml (cyclomatic 17) plugins/browser-extension/cyberstrikeai-browser-extension/lib/markdown.js:68 — markdown.markdownToHtml has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · storage.saveConfig (cyclomatic 17) · ×1
  • storage.saveConfig (cyclomatic 17) plugins/browser-extension/cyberstrikeai-browser-extension/lib/storage.js:156 — storage.saveConfig 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.
D1 · Cyclomatic Complexity · panel.fillSelect (cyclomatic 17) · ×1
  • panel.fillSelect (cyclomatic 17) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:784 — panel.fillSelect has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · assets.loadAssets (cyclomatic 17) · ×1
  • assets.loadAssets (cyclomatic 17) REDACTED:707 — assets.loadAssets 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.
D1 · Cyclomatic Complexity · audit.renderAuditLogsPagination (cyclomatic 17) · ×1
  • audit.renderAuditLogsPagination (cyclomatic 17) web/static/js/audit.js:367 — audit.renderAuditLogsPagination has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · c2.sessionInfoRow (cyclomatic 17) · ×1
  • c2.sessionInfoRow (cyclomatic 17) web/static/js/c2.js:471 — c2.sessionInfoRow 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: c2.runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · chat.setAssistantTurnTiming (cyclomatic 17) · ×1
  • chat.setAssistantTurnTiming (cyclomatic 17) web/static/js/chat.js:5119 — chat.setAssistantTurnTiming 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.
D1 · Cyclomatic Complexity · chat.ensureMcpCallSectionChrome (cyclomatic 17) · ×1
  • chat.ensureMcpCallSectionChrome (cyclomatic 17) web/static/js/chat.js:5212 — chat.ensureMcpCallSectionChrome 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.
D1 · Cyclomatic Complexity · chat.loadAttackChain (cyclomatic 17) · ×1
  • chat.loadAttackChain (cyclomatic 17) web/static/js/chat.js:7029 — chat.loadAttackChain 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · dashboard.renderRecommendedActions (cyclomatic 17) · ×1
  • dashboard.renderRecommendedActions (cyclomatic 17) web/static/js/dashboard.js:1005 — dashboard.renderRecommendedActions has cyclomatic complexity 17 (threshold 15). Of this number, 14 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · dashboard.renderRecentVulns (cyclomatic 17) · ×1
  • dashboard.renderRecentVulns (cyclomatic 17) web/static/js/dashboard.js:1241 — dashboard.renderRecentVulns has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1270, 1261, 1277, …). 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.
D1 · Cyclomatic Complexity · hitl.renderHitlPagination (cyclomatic 17) · ×1
  • hitl.renderHitlPagination (cyclomatic 17) web/static/js/hitl.js:139 — hitl.renderHitlPagination has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · knowledge.getTimeAgo (cyclomatic 17) · ×1
  • knowledge.getTimeAgo (cyclomatic 17) REDACTED:1546 — knowledge.getTimeAgo 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: knowledge.renderRetrievalLogs (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · knowledge.showRetrievalLogDetailsModal (cyclomatic 17) · ×1
  • knowledge.showRetrievalLogDetailsModal (cyclomatic 17) REDACTED:1822 — knowledge.showRetrievalLogDetailsModal has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1852, 1858). 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. This is NOT this file's highest cyclomatic complexity: knowledge.renderRetrievalLogs (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · mobile-ui.enableDrawerSwipe (cyclomatic 17) · ×1
  • mobile-ui.enableDrawerSwipe (cyclomatic 17) web/static/js/mobile-ui.js:975 — mobile-ui.enableDrawerSwipe has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 990, 1008, 982). 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.
D1 · Cyclomatic Complexity · monitor.piMainStreamPlanningTitle (cyclomatic 17) · ×1
  • monitor.piMainStreamPlanningTitle (cyclomatic 17) web/static/js/monitor.js:180 — monitor.piMainStreamPlanningTitle has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.hitlPendingItemToData (cyclomatic 17) · ×1
  • monitor.hitlPendingItemToData (cyclomatic 17) web/static/js/monitor.js:5342 — monitor.hitlPendingItemToData 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.
D1 · Cyclomatic Complexity · monitor.bindMcpStatsTimelineEvents (cyclomatic 17) · ×1
  • monitor.bindMcpStatsTimelineEvents (cyclomatic 17) web/static/js/monitor.js:7942 — monitor.bindMcpStatsTimelineEvents has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 7961, 7985, 7947). 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.
D1 · Cyclomatic Complexity · monitor.renderMcpStatsChartAside (cyclomatic 17) · ×1
  • monitor.renderMcpStatsChartAside (cyclomatic 17) web/static/js/monitor.js:8913 — monitor.renderMcpStatsChartAside has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 5 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 8922, 8917). 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.
D1 · Cyclomatic Complexity · projects.appendChatProjectFolderItem (cyclomatic 17) · ×1
  • projects.appendChatProjectFolderItem (cyclomatic 17) web/static/js/projects.js:3202 — projects.appendChatProjectFolderItem has cyclomatic complexity 17 (threshold 15). Of this number, 12 points are the body's own statements and 5 belong to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · settings.updateAIChannelEditorChrome (cyclomatic 17) · ×1
  • settings.updateAIChannelEditorChrome (cyclomatic 17) web/static/js/settings.js:2942 — settings.updateAIChannelEditorChrome 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, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · tasks.filterAndSortTasks (cyclomatic 17) · ×1
  • tasks.filterAndSortTasks (cyclomatic 17) web/static/js/tasks.js:359 — tasks.filterAndSortTasks has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 389). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · tasks.startInlineEditSchedule (cyclomatic 17) · ×1
  • tasks.startInlineEditSchedule (cyclomatic 17) web/static/js/tasks.js:2812 — tasks.startInlineEditSchedule 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 5 function literals inside it that branch (lines 2817, 2838, 2844, …). 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.
D1 · Cyclomatic Complexity · update.renderUpdateRemoteBody (cyclomatic 17) · ×1
  • update.renderUpdateRemoteBody (cyclomatic 17) web/static/js/update.js:761 — update.renderUpdateRemoteBody 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.
D1 · Cyclomatic Complexity · vulnerability.renderVulnerabilities (cyclomatic 17) · ×1
  • vulnerability.renderVulnerabilities (cyclomatic 17) web/static/js/vulnerability.js:1370 — vulnerability.renderVulnerabilities 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.
D1 · Cyclomatic Complexity · vulnerability.loadVulnerabilityAlertSubscription (cyclomatic 17) · ×1
  • vulnerability.loadVulnerabilityAlertSubscription (cyclomatic 17) web/static/js/vulnerability.js:2014 — vulnerability.loadVulnerabilityAlertSubscription 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.
D1 · Cyclomatic Complexity · saveSessionNote (cyclomatic 17) · ×1
  • saveSessionNote (cyclomatic 17) web/static/js/c2.js:2006 — saveSessionNote has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2017, 2036, 2024). 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. This is NOT this file's highest cyclomatic complexity: runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · syncAssistantReasoningContentFromServer (cyclomatic 17) · ×1
  • syncAssistantReasoningContentFromServer (cyclomatic 17) web/static/js/chat.js:3857 — syncAssistantReasoningContentFromServer has cyclomatic complexity 17 (threshold 15). Of this number, 16 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · refreshLastAssistantProcessDetails (cyclomatic 17) · ×1
  • refreshLastAssistantProcessDetails (cyclomatic 17) web/static/js/monitor.js:5487 — refreshLastAssistantProcessDetails 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.
D1 · Cyclomatic Complexity · loadActiveTasks (cyclomatic 17) · ×1
  • loadActiveTasks (cyclomatic 17) web/static/js/monitor.js:6936 — loadActiveTasks has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 6939, 6943, 6945, …). 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.
D1 · Cyclomatic Complexity · saveInlineConcurrency (cyclomatic 17) · ×1
  • saveInlineConcurrency (cyclomatic 17) web/static/js/tasks.js:2747 — saveInlineConcurrency 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.
D1 · Cyclomatic Complexity · confirmVulnerabilityRetest (cyclomatic 17) · ×1
  • confirmVulnerabilityRetest (cyclomatic 17) web/static/js/vulnerability.js:2676 — confirmVulnerabilityRetest 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.
D1 · Cyclomatic Complexity · resolveWebshellAiStreamRequest (cyclomatic 17) · ×1
  • resolveWebshellAiStreamRequest (cyclomatic 17) web/static/js/webshell.js:158 — resolveWebshellAiStreamRequest 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 3 function literals inside it that branch (lines 165, 162, 178). 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.
D1 · Cyclomatic Complexity · saveWorkflowDraft (cyclomatic 17) · ×1
  • saveWorkflowDraft (cyclomatic 17) web/static/js/workflows.js:2232 — saveWorkflowDraft 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.
D1 · Cyclomatic Complexity · Agent.executeToolViaMCP (cyclomatic 16) · ×1
  • Agent.executeToolViaMCP (cyclomatic 16) internal/agent/agent.go:533 — Agent.executeToolViaMCP has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · app.registerC2SessionTool (cyclomatic 16) · ×1
  • app.registerC2SessionTool (cyclomatic 16) internal/app/c2_tools.go:237 — app.registerC2SessionTool has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to one function literal inside it that branches (line 264). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · HTTPBeaconListener.handleFileServe (cyclomatic 16) · ×1
  • HTTPBeaconListener.handleFileServe (cyclomatic 16) internal/c2/listener_http.go:374 — HTTPBeaconListener.handleFileServe has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WebSocketListener.handleConn (cyclomatic 16) · ×1
  • WebSocketListener.handleConn (cyclomatic 16) REDACTED:151 — WebSocketListener.handleConn has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · OpenAIConfig.EffectiveMaxTotalTokens (cyclomatic 16) · ×1
  • OpenAIConfig.EffectiveMaxTotalTokens (cyclomatic 16) internal/config/context_profile.go:74 — OpenAIConfig.EffectiveMaxTotalTokens has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · database.columnDefinitions (cyclomatic 16) · ×1
  • database.columnDefinitions (cyclomatic 16) internal/database/schema_reconcile.go:214 — database.columnDefinitions has cyclomatic complexity 16 (threshold 15). Of this number, 10 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DB.ListAssignableRBACResourcesPage (cyclomatic 16) · ×1
  • DB.ListAssignableRBACResourcesPage (cyclomatic 16) REDACTED:582 — DB.ListAssignableRBACResourcesPage 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.
D1 · Cyclomatic Complexity · DB.MergeVulnerabilities (cyclomatic 16) · ×1
  • DB.MergeVulnerabilities (cyclomatic 16) internal/database/vulnerability_workspace.go:171 — DB.MergeVulnerabilities has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · handler.appendVulnerabilityMarkdown (cyclomatic 16) · ×1
  • handler.appendVulnerabilityMarkdown (cyclomatic 16) REDACTED:555 — handler.appendVulnerabilityMarkdown has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatUploadsHandler.collectConversationArtifactFiles (cyclomatic 16) · ×1
  • ChatUploadsHandler.collectConversationArtifactFiles (cyclomatic 16) REDACTED:607 — ChatUploadsHandler.collectConversationArtifactFiles has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 619). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · ConversationHandler.GetConversationPlanTasks (cyclomatic 16) · ×1
  • ConversationHandler.GetConversationPlanTasks (cyclomatic 16) REDACTED:252 — ConversationHandler.GetConversationPlanTasks has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RobotHandler.getOrCreateConversation (cyclomatic 16) · ×1
  • RobotHandler.getOrCreateConversation (cyclomatic 16) REDACTED:234 — RobotHandler.getOrCreateConversation has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UpdateHandler.startJob (cyclomatic 16) · ×1
  • UpdateHandler.startJob (cyclomatic 16) internal/handler/update.go:393 — UpdateHandler.startJob has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 423). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · VulnerabilityHandler.ExportVulnerabilities (cyclomatic 16) · ×1
  • VulnerabilityHandler.ExportVulnerabilities (cyclomatic 16) REDACTED:455 — VulnerabilityHandler.ExportVulnerabilities has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WebShellHandler.Exec (cyclomatic 16) · ×1
  • WebShellHandler.Exec (cyclomatic 16) REDACTED:741 — WebShellHandler.Exec has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · WorkflowHandler.CreatePackageInspection (cyclomatic 16) · ×1
  • WorkflowHandler.CreatePackageInspection (cyclomatic 16) internal/handler/workflow_package.go:58 — WorkflowHandler.CreatePackageInspection has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Manager.SearchItemsByKeyword (cyclomatic 16) · ×1
  • Manager.SearchItemsByKeyword (cyclomatic 16) internal/knowledge/manager.go:369 — Manager.SearchItemsByKeyword has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · nativeMultiQuery.Retrieve (cyclomatic 16) · ×1
  • nativeMultiQuery.Retrieve (cyclomatic 16) internal/knowledge/wire_retriever.go:59 — nativeMultiQuery.Retrieve has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · modelmeta.detectOpenAICompatible (cyclomatic 16) · ×1
  • modelmeta.detectOpenAICompatible (cyclomatic 16) internal/modelmeta/context.go:356 — modelmeta.detectOpenAICompatible has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · project.extractBodySyncLinksBlock (cyclomatic 16) · ×1
  • project.extractBodySyncLinksBlock (cyclomatic 16) internal/project/fact_body_links.go:75 — project.extractBodySyncLinksBlock has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · security.startShellSessionContext (cyclomatic 16) · ×1
  • security.startShellSessionContext (cyclomatic 16) internal/security/process_scope.go:59 — security.startShellSessionContext has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.recoverAdoption (cyclomatic 16) · ×1
  • update.recoverAdoption (cyclomatic 16) REDACTED:21 — update.recoverAdoption has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · update.validateBuildFiles (cyclomatic 16) · ×1
  • update.validateBuildFiles (cyclomatic 16) internal/update/recovery_evidence.go:184 — update.validateBuildFiles has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.DryRunGraphJSON (cyclomatic 16) · ×1
  • workflow.DryRunGraphJSON (cyclomatic 16) internal/workflow/dry_run.go:21 — workflow.DryRunGraphJSON has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · workflow.ResumeWorkflowRun (cyclomatic 16) · ×1
  • workflow.ResumeWorkflowRun (cyclomatic 16) internal/workflow/resume.go:11 — workflow.ResumeWorkflowRun has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · mcp_pent_claude_agent._run_claude_agent (cyclomatic 16) · ×1
  • mcp_pent_claude_agent._run_claude_agent (cyclomatic 16) mcp-servers/pent_claude_agent/mcp_pent_claude_agent.py:114 — mcp_pent_claude_agent._run_claude_agent has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · formatter.toPrompt (cyclomatic 16) · ×1
  • formatter.toPrompt (cyclomatic 16) plugins/browser-extension/cyberstrikeai-browser-extension/lib/formatter.js:7 — formatter.toPrompt 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.
D1 · Cyclomatic Complexity · assets.renderAssetCoverage (cyclomatic 16) · ×1
  • assets.renderAssetCoverage (cyclomatic 16) REDACTED:523 — assets.renderAssetCoverage has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · c2.C2.loadSessionTasks (cyclomatic 16) · ×1
  • c2.C2.loadSessionTasks (cyclomatic 16) web/static/js/c2.js:3447 — c2.C2.loadSessionTasks 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 3448, 3488). 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. This is NOT this file's highest cyclomatic complexity: c2.runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · chat-files.deleteChatFolderFromBrowse (cyclomatic 16) · ×1
  • chat-files.deleteChatFolderFromBrowse (cyclomatic 16) web/static/js/chat-files.js:1377 — chat-files.deleteChatFolderFromBrowse has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · chat.populateChatAIChannelSelect (cyclomatic 16) · ×1
  • chat.populateChatAIChannelSelect (cyclomatic 16) web/static/js/chat.js:1014 — chat.populateChatAIChannelSelect has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to 2 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.
D1 · Cyclomatic Complexity · chat.regenerateAttackChain (cyclomatic 16) · ×1
  • chat.regenerateAttackChain (cyclomatic 16) web/static/js/chat.js:8208 — chat.regenerateAttackChain has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · info-collect.inferTargetFromRow (cyclomatic 16) · ×1
  • info-collect.inferTargetFromRow (cyclomatic 16) web/static/js/info-collect.js:1155 — info-collect.inferTargetFromRow has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · info-collect.formatFofaRowSummary (cyclomatic 16) · ×1
  • info-collect.formatFofaRowSummary (cyclomatic 16) web/static/js/info-collect.js:1251 — info-collect.formatFofaRowSummary 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 3 function literals inside it that branch (lines 1272, 1257, 1264). 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.
D1 · Cyclomatic Complexity · knowledge.searchKnowledgeItems (cyclomatic 16) · ×1
  • knowledge.searchKnowledgeItems (cyclomatic 16) REDACTED:732 — knowledge.searchKnowledgeItems has cyclomatic complexity 16 (threshold 15). Of this number, 15 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: knowledge.renderRetrievalLogs (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · knowledge.formatTime (cyclomatic 16) · ×1
  • knowledge.formatTime (cyclomatic 16) REDACTED:2031 — knowledge.formatTime 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: knowledge.renderRetrievalLogs (cyclomatic 28) 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 method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · mobile-ui.enableSheetSwipe (cyclomatic 16) · ×1
  • mobile-ui.enableSheetSwipe (cyclomatic 16) web/static/js/mobile-ui.js:1023 — mobile-ui.enableSheetSwipe 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 3 function literals inside it that branch (lines 1040, 1051, 1029). 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.
D1 · Cyclomatic Complexity · modal.document.addEventListener("keydown") (cyclomatic 16) · ×1
  • modal.document.addEventListener("keydown") (cyclomatic 16) web/static/js/modal.js:187 — modal.document.addEventListener("keydown") has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor._normalizeEmphasisMarkersForMarkdown · ×1
  • monitor._normalizeEmphasisMarkersForMarkdown::normalizeLine (cyclomatic 16) web/static/js/monitor.js:766 — monitor._normalizeEmphasisMarkersForMarkdown::normalizeLine has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.performHardCancelProgressTask (cyclomatic 16) · ×1
  • monitor.performHardCancelProgressTask (cyclomatic 16) web/static/js/monitor.js:1467 — monitor.performHardCancelProgressTask has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · monitor.ensureProcessDetailsReturnLatestControl (cyclomatic 16) · ×1
  • monitor.ensureProcessDetailsReturnLatestControl (cyclomatic 16) web/static/js/monitor.js:1902 — monitor.ensureProcessDetailsReturnLatestControl has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.renderDirectHitlSidebarApproval (cyclomatic 16) · ×1
  • monitor.renderDirectHitlSidebarApproval (cyclomatic 16) web/static/js/monitor.js:4923 — monitor.renderDirectHitlSidebarApproval has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · monitor.renderInlineWorkflowHitlApproval · ×1
  • monitor.renderInlineWorkflowHitlApproval::submit (cyclomatic 16) web/static/js/monitor.js:5140 — monitor.renderInlineWorkflowHitlApproval::submit has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · projects.linkFactToExistingVulnerability (cyclomatic 16) · ×1
  • projects.linkFactToExistingVulnerability (cyclomatic 16) web/static/js/projects.js:1707 — projects.linkFactToExistingVulnerability 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.
D1 · Cyclomatic Complexity · rbac.renderRbacResourcePicker (cyclomatic 16) · ×1
  • rbac.renderRbacResourcePicker (cyclomatic 16) web/static/js/rbac.js:1005 — rbac.renderRbacResourcePicker has cyclomatic complexity 16 (threshold 15). Of this number, 8 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, 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.
D1 · Cyclomatic Complexity · sanitize-markdown.installDomPurifyHooks (cyclomatic 16) · ×1
  • sanitize-markdown.installDomPurifyHooks (cyclomatic 16) web/static/js/sanitize-markdown.js:42 — sanitize-markdown.installDomPurifyHooks has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 46). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D1 · Cyclomatic Complexity · settings.syncHitlAuditBackendUI (cyclomatic 16) · ×1
  • settings.syncHitlAuditBackendUI (cyclomatic 16) web/static/js/settings.js:3764 — settings.syncHitlAuditBackendUI has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · tool-guard.testLocalRule (cyclomatic 16) · ×1
  • tool-guard.testLocalRule (cyclomatic 16) web/static/js/tool-guard.js:651 — tool-guard.testLocalRule 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.
D1 · Cyclomatic Complexity · generateRobotBindingCode (cyclomatic 16) · ×1
  • generateRobotBindingCode (cyclomatic 16) web/static/js/auth.js:803 — generateRobotBindingCode has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · editListener (cyclomatic 16) · ×1
  • editListener (cyclomatic 16) web/static/js/c2.js:1240 — editListener has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 6 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1267, 1241, 1265, …). 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. This is NOT this file's highest cyclomatic complexity: runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · submitSessionSleep (cyclomatic 16) · ×1
  • submitSessionSleep (cyclomatic 16) web/static/js/c2.js:1917 — submitSessionSleep has cyclomatic complexity 16 (threshold 15). Of this number, 9 points are the body's own statements and 7 belong to 3 function items 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. This is NOT this file's highest cyclomatic complexity: runC2SafeAction (cyclomatic 20) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · chatFilesUploadFile (cyclomatic 16) · ×1
  • chatFilesUploadFile (cyclomatic 16) web/static/js/chat-files.js:1843 — chatFilesUploadFile has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · submitFofaSearch (cyclomatic 16) · ×1
  • submitFofaSearch (cyclomatic 16) web/static/js/info-collect.js:742 — submitFofaSearch 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.
D1 · Cyclomatic Complexity · refreshHitlBadge (cyclomatic 16) · ×1
  • refreshHitlBadge (cyclomatic 16) web/static/js/mobile-ui.js:919 — refreshHitlBadge has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 927, 937, 943, …). 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.
D1 · Cyclomatic Complexity · (anonymous) (cyclomatic 16) · ×1
  • (anonymous) (cyclomatic 16) web/static/js/modal.js:187 — (anonymous) has cyclomatic complexity 16 (threshold 15). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · refreshMonitorPanelWithFilter (cyclomatic 16) · ×1
  • refreshMonitorPanelWithFilter (cyclomatic 16) web/static/js/monitor.js:7604 — refreshMonitorPanelWithFilter has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · initChatProjectSelector (cyclomatic 16) · ×1
  • initChatProjectSelector (cyclomatic 16) web/static/js/projects.js:4040 — initChatProjectSelector has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 4 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 4045, 4064, 4056, …). 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.
D1 · Cyclomatic Complexity · renderRbacUsers (cyclomatic 16) · ×1
  • renderRbacUsers (cyclomatic 16) web/static/js/rbac.js:552 — renderRbacUsers has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 565, 559, 567, …). 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.
D1 · Cyclomatic Complexity · startBatchQueue (cyclomatic 16) · ×1
  • startBatchQueue (cyclomatic 16) web/static/js/tasks.js:1980 — startBatchQueue has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · runWebshellAiSend (cyclomatic 16) · ×1
  • runWebshellAiSend (cyclomatic 16) web/static/js/webshell.js:3383 — runWebshellAiSend has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · webshellFileRead (cyclomatic 16) · ×1
  • webshellFileRead (cyclomatic 16) web/static/js/webshell.js:4839 — webshellFileRead has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 4847, 4863, 4857, …). 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.
D12 · Dependency Hygiene · Dependency pinned to a stale untagged commit · ×1
  • Dependency pinned to a stale untagged commit: github.com/skip2/go-qrcode — Direct dependency `github.com/skip2/go-qrcode` is required at `v0.0.0-20200617195104-da1b6568686e` in REDACTED — a pseudo-version, which pins an UNTAGGED commit from 2020-06-17, 6.4 years ago. The pin itself is exact, so this is not a reproducibility defect, and it is not a claim that the module is unmaintained. What it says is that this repository tracks no RELEASE of `github.com/skip2/go-qrcode` and has not moved this requirement in 6.4 years: every fix the module has published since that commit — including any security fix — is absent from this build, whether the module went quiet or moved on without you. Check whether `github.com/skip2/go-qrcode` now publishes tagged releases and move the requirement to one; if it publishes none, re-pin to a current commit.
D2 · Cognitive Complexity · handleStreamEvent (cognitive 777) · ×1
  • handleStreamEvent (cognitive 777) web/static/js/monitor.js:2918 — handleStreamEvent has cognitive complexity 777 (threshold 15). Drivers by points: if/else 141 (320 pts), ternaries 110 (264 pts), boolean chains 179, error handling 4 (10 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 340). Of this number, 756 points are the body's own statements and 21 belong to 10 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AgentHandler.createProgressCallback (cognitive 464) · ×1
  • AgentHandler.createProgressCallback (cognitive 464) internal/handler/agent.go:1025 — AgentHandler.createProgressCallback has cognitive complexity 464 (threshold 15). Drivers by points: if/else 131 (390 pts), loops 13 (41 pts), boolean chains 30, match/switch 1 (3 pts) (nesting depth added 289). Most of this is not in the body itself: 4 of the 464 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 1163, 1036, 1128, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · runWebshellAiSend · ×1
  • runWebshellAiSend::(anonymous)::processChunk (cognitive 403) web/static/js/webshell.js:3544 — runWebshellAiSend::(anonymous)::processChunk has cognitive complexity 403 (threshold 15). Drivers by points: if/else 82 (187 pts), ternaries 35 (128 pts), boolean chains 76, error handling 3 (11 pts), loops 1 (nesting depth added 206). 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.
D2 · Cognitive Complexity · refreshWebshellUIOnLanguageChange (cognitive 276) · ×1
  • refreshWebshellUIOnLanguageChange (cognitive 276) web/static/js/webshell.js:5031 — refreshWebshellUIOnLanguageChange has cognitive complexity 276 (threshold 15). Drivers by points: if/else 62 (176 pts), boolean chains 68, ternaries 11 (32 pts) (nesting depth added 135). Of this number, 274 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · loadConfig (cognitive 274) · ×1
  • loadConfig (cognitive 274) web/static/js/settings.js:790 — loadConfig has cognitive complexity 274 (threshold 15). Drivers by points: if/else 98 (132 pts), boolean chains 87, ternaries 19 (43 pts), other 11, error handling 1 (nesting depth added 58). Of this number, 263 points are the body's own statements and 11 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.
D2 · Cognitive Complexity · renderProcessDetails · ×1
  • renderProcessDetails::renderOneProcessDetail (cognitive 269) web/static/js/chat.js:4299 — renderProcessDetails::renderOneProcessDetail has cognitive complexity 269 (threshold 15). Drivers by points: ternaries 67 (157 pts), if/else 50 (60 pts), boolean chains 52 (nesting depth added 100). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · addTimelineItem (cognitive 259) · ×1
  • addTimelineItem (cognitive 259) web/static/js/monitor.js:6638 — addTimelineItem has cognitive complexity 259 (threshold 15). Drivers by points: ternaries 39 (92 pts), boolean chains 86, if/else 58 (80 pts), error handling 1 (nesting depth added 75). Of this number, 257 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigHandler.UpdateConfig (cognitive 205) · ×1
  • ConfigHandler.UpdateConfig (cognitive 205) internal/handler/config.go:799 — ConfigHandler.UpdateConfig has cognitive complexity 205 (threshold 15). Drivers by points: if/else 80 (178 pts), loops 8 (23 pts), boolean chains 4 (nesting depth added 113). Of this number, 198 points are the body's own statements and 7 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.
D2 · Cognitive Complexity · Executor.buildCommandArgs (cognitive 177) · ×1
  • Executor.buildCommandArgs (cognitive 177) internal/security/executor.go:354 — Executor.buildCommandArgs has cognitive complexity 177 (threshold 15). Drivers by points: if/else 47 (145 pts), loops 8 (18 pts), boolean chains 11, match/switch 1 (3 pts) (nesting depth added 110). 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.
D2 · Cognitive Complexity · refreshDashboard (cognitive 172) · ×1
  • refreshDashboard (cognitive 172) web/static/js/dashboard.js:42 — refreshDashboard has cognitive complexity 172 (threshold 15). Drivers by points: if/else 64 (92 pts), boolean chains 39, ternaries 21 (35 pts), error handling 3 (4 pts), other 2 (nesting depth added 43). Of this number, 151 points are the body's own statements and 21 belong to 11 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.
D2 · Cognitive Complexity · renderAttackChain (cognitive 164) · ×1
  • renderAttackChain (cognitive 164) web/static/js/chat.js:7135 — renderAttackChain has cognitive complexity 164 (threshold 15). Drivers by points: if/else 59 (71 pts), ternaries 30 (50 pts), boolean chains 36, error handling 4 (7 pts) (nesting depth added 35). Of this number, 29 points are the body's own statements and 135 belong to 36 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.
D2 · Cognitive Complexity · applySettings (cognitive 161) · ×1
  • applySettings (cognitive 161) web/static/js/settings.js:1908 — applySettings has cognitive complexity 161 (threshold 15). Drivers by points: boolean chains 98, ternaries 25 (33 pts), if/else 16 (19 pts), other 6, error handling 4, loops 1 (nesting depth added 11). Of this number, 129 points are the body's own statements and 32 belong to 14 function items 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.
D2 · Cognitive Complexity · piRun.executePiLocal (cognitive 143) · ×1
  • piRun.executePiLocal (cognitive 143) internal/multiagent/pi_local_tools.go:121 — piRun.executePiLocal has cognitive complexity 143 (threshold 15). Drivers by points: if/else 55 (122 pts), loops 4 (9 pts), boolean chains 7, match/switch 2 (5 pts) (nesting depth added 75). Of this number, 95 points are the body's own statements and 48 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigHandler.GetTools (cognitive 138) · ×1
  • ConfigHandler.GetTools (cognitive 138) internal/handler/config.go:413 — ConfigHandler.GetTools has cognitive complexity 138 (threshold 15). Drivers by points: if/else 51 (108 pts), boolean chains 17, loops 6 (12 pts), match/switch 1 (nesting depth added 63). Of this number, 136 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · buildWebshellTimelineItemFromDetail (cognitive 135) · ×1
  • buildWebshellTimelineItemFromDetail (cognitive 135) web/static/js/webshell.js:2220 — buildWebshellTimelineItemFromDetail has cognitive complexity 135 (threshold 15). Drivers by points: ternaries 41 (83 pts), boolean chains 28, if/else 17 (19 pts), error handling 2 (5 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · initTerminal (cognitive 134) · ×1
  • initTerminal (cognitive 134) web/static/js/c2.js:2190 — initTerminal has cognitive complexity 134 (threshold 15). Drivers by points: if/else 64 (79 pts), boolean chains 38, error handling 3 (7 pts), loops 6, ternaries 2 (4 pts) (nesting depth added 21). Most of this is not in the body itself: 14 of the 134 points are its own statements and the rest belongs to 20 function items inside it that branch (a function literal at line 2355, a function literal at line 2488, handlePasteText, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · loadConversation (cognitive 124) · ×1
  • loadConversation (cognitive 124) web/static/js/chat.js:6381 — loadConversation has cognitive complexity 124 (threshold 15). Drivers by points: if/else 62 (106 pts), boolean chains 58, ternaries 16 (46 pts), error handling 10 (17 pts) (nesting depth added 81). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · sendMessage (cognitive 123) · ×1
  • sendMessage (cognitive 123) web/static/js/chat.js:2248 — sendMessage has cognitive complexity 123 (threshold 15). Drivers by points: if/else 47 (63 pts), boolean chains 29, ternaries 12 (20 pts), error handling 5 (9 pts), loops 2 (nesting depth added 28). Of this number, 97 points are the body's own statements and 26 belong to 13 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.
D2 · Cognitive Complexity · AgentHandler.MultiAgentLoopStream (cognitive 122) · ×1
  • AgentHandler.MultiAgentLoopStream (cognitive 122) internal/handler/multi_agent.go:23 — AgentHandler.MultiAgentLoopStream has cognitive complexity 122 (threshold 15). Drivers by points: if/else 52 (105 pts), match/switch 3 (9 pts), boolean chains 7, loops 1 (nesting depth added 59). Of this number, 83 points are the body's own statements and 39 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · TCPReverseListener.handleTCPBeaconSession (cognitive 121) · ×1
  • TCPReverseListener.handleTCPBeaconSession (cognitive 121) internal/c2/tcp_beacon_server.go:73 — TCPReverseListener.handleTCPBeaconSession has cognitive complexity 121 (threshold 15). Drivers by points: if/else 40 (110 pts), boolean chains 8, match/switch 1 (2 pts), loops 1 (nesting depth added 71). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.SingleAgentLoopStream (cognitive 120) · ×1
  • AgentHandler.SingleAgentLoopStream (cognitive 120) internal/handler/single_agent.go:22 — AgentHandler.SingleAgentLoopStream has cognitive complexity 120 (threshold 15). Drivers by points: if/else 51 (104 pts), match/switch 3 (9 pts), boolean chains 6, loops 1 (nesting depth added 59). Of this number, 81 points are the body's own statements and 39 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · piRun.run (cognitive 117) · ×1
  • piRun.run (cognitive 117) internal/multiagent/pi_runner.go:226 — piRun.run has cognitive complexity 117 (threshold 15). Drivers by points: if/else 62 (98 pts), boolean chains 10, loops 6, match/switch 2 (3 pts) (nesting depth added 37). Of this number, 47 points are the body's own statements and 70 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.
D2 · Cognitive Complexity · agent.ParseTraceMessages (cognitive 111) · ×1
  • agent.ParseTraceMessages (cognitive 111) internal/agent/agent_trace.go:36 — agent.ParseTraceMessages has cognitive complexity 111 (threshold 15). Drivers by points: if/else 28 (97 pts), loops 3 (9 pts), boolean chains 5 (nesting depth added 75). 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.
D2 · Cognitive Complexity · attachRunningTaskEventStream (cognitive 108) · ×1
  • attachRunningTaskEventStream (cognitive 108) web/static/js/monitor.js:5611 — attachRunningTaskEventStream has cognitive complexity 108 (threshold 15). Drivers by points: if/else 41 (59 pts), boolean chains 36, ternaries 4 (7 pts), error handling 3 (5 pts), loops 1 (nesting depth added 23). Most of this is not in the body itself: 5 of the 108 points are its own statements and the rest belongs to 11 function items inside it that branch (a function literal at line 5625, (anonymous)::dispatchTaskEvent, a function literal at line 5630, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · refreshProgressAndTimelineI18n (cognitive 108) · ×1
  • refreshProgressAndTimelineI18n (cognitive 108) web/static/js/monitor.js:9533 — refreshProgressAndTimelineI18n has cognitive complexity 108 (threshold 15). Drivers by points: if/else 37 (45 pts), boolean chains 33, ternaries 15 (27 pts), error handling 1 (3 pts) (nesting depth added 22). None of this is in the body itself: all 108 points belong to 9 function items inside it that branch (a function literal at line 9573, a function literal at line 9555, a function literal at line 9680, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · showBatchQueueDetail (cognitive 107) · ×1
  • showBatchQueueDetail (cognitive 107) web/static/js/tasks.js:1761 — showBatchQueueDetail has cognitive complexity 107 (threshold 15). Drivers by points: ternaries 41 (48 pts), if/else 22 (30 pts), boolean chains 21, error handling 3 (8 pts) (nesting depth added 20). Of this number, 65 points are the body's own statements and 42 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · update.finishPendingBuild (cognitive 100) · ×1
  • update.finishPendingBuild (cognitive 100) internal/update/apply.go:399 — update.finishPendingBuild has cognitive complexity 100 (threshold 15). Drivers by points: if/else 41 (90 pts), boolean chains 10 (nesting depth added 49). 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.
D2 · Cognitive Complexity · initPage (cognitive 100) · ×1
  • initPage (cognitive 100) web/static/js/router.js:410 — initPage has cognitive complexity 100 (threshold 15). Drivers by points: if/else 43 (81 pts), boolean chains 9, error handling 3 (9 pts), match/switch 1 (nesting depth added 44). Of this number, 81 points are the body's own statements and 19 belong to 7 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.
D2 · Cognitive Complexity · app.mcpToolAuthorizer (cognitive 97) · ×1
  • app.mcpToolAuthorizer (cognitive 97) internal/app/mcp_authorization.go:15 — app.mcpToolAuthorizer has cognitive complexity 97 (threshold 15). Drivers by points: if/else 40 (77 pts), boolean chains 19, match/switch 1 (nesting depth added 37). None of this is in the body itself: all 97 points belong to one function literal inside it that branches (line 16). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · initWebshellTerminal (cognitive 97) · ×1
  • initWebshellTerminal (cognitive 97) web/static/js/webshell.js:3985 — initWebshellTerminal has cognitive complexity 97 (threshold 15). Drivers by points: if/else 31 (49 pts), boolean chains 22, ternaries 7 (15 pts), error handling 5 (10 pts), loops 1 (nesting depth added 31). Most of this is not in the body itself: 14 of the 97 points are its own statements and the rest belongs to 9 function items inside it that branch (a function literal at line 4047, writeWebshellOutput, a function literal at line 4119, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · app.New (cognitive 96) · ×1
  • app.New (cognitive 96) REDACTED:83 — app.New has cognitive complexity 96 (threshold 15). Drivers by points: if/else 50 (86 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 39). Of this number, 50 points are the body's own statements and 46 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.
D2 · Cognitive Complexity · handler.enrichSpecWithI18nKeys (cognitive 91) · ×1
  • handler.enrichSpecWithI18nKeys (cognitive 91) internal/handler/openapi_i18n.go:115 — handler.enrichSpecWithI18nKeys has cognitive complexity 91 (threshold 15). Drivers by points: if/else 18 (71 pts), loops 5 (17 pts), match/switch 1 (3 pts) (nesting depth added 67). 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.
D2 · Cognitive Complexity · restoreHitlInlineForConversation (cognitive 91) · ×1
  • restoreHitlInlineForConversation (cognitive 91) web/static/js/monitor.js:5375 — restoreHitlInlineForConversation has cognitive complexity 91 (threshold 15). Drivers by points: if/else 23 (45 pts), ternaries 7 (20 pts), boolean chains 13, error handling 4 (9 pts), loops 2 (4 pts) (nesting depth added 42). 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.
D2 · Cognitive Complexity · Pi.Run (cognitive 90) · ×1
  • Pi.Run (cognitive 90) internal/agentruntime/pi.go:89 — Pi.Run has cognitive complexity 90 (threshold 15). Drivers by points: if/else 30 (69 pts), match/switch 6 (16 pts), boolean chains 3, loops 2 (nesting depth added 49). Of this number, 58 points are the body's own statements and 32 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.
D2 · Cognitive Complexity · webshell.selectWebshell (cognitive 90) · ×1
  • webshell.selectWebshell (cognitive 90) web/static/js/webshell.js:2446 — webshell.selectWebshell has cognitive complexity 90 (threshold 15). Drivers by points: boolean chains 172, if/else 123 (144 pts), ternaries 12, error handling 3 (6 pts) (nesting depth added 24). 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 shape REPEATS in the file: one other method here (webshell.selectWebshell::applyActiveDbProfileToForm) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · loadProcessDetailsPaginated (cognitive 90) · ×1
  • loadProcessDetailsPaginated (cognitive 90) web/static/js/monitor.js:2369 — loadProcessDetailsPaginated has cognitive complexity 90 (threshold 15). Drivers by points: ternaries 16 (31 pts), boolean chains 28, if/else 16 (26 pts), error handling 2 (4 pts), loops 1 (nesting depth added 27). Of this number, 88 points are the body's own statements and 2 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · webshell.renderDirectoryTree (cognitive 88) · ×1
  • webshell.renderDirectoryTree (cognitive 88) web/static/js/webshell.js:4552 — webshell.renderDirectoryTree has cognitive complexity 88 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 28, ternaries 13 (22 pts), loops 2 (4 pts) (nesting depth added 23). Of this number, 27 points are the body's own statements and 61 belong to 13 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.
D2 · Cognitive Complexity · app.registerC2ProfileTool (cognitive 87) · ×1
  • app.registerC2ProfileTool (cognitive 87) internal/app/c2_tools.go:689 — app.registerC2ProfileTool has cognitive complexity 87 (threshold 15). Drivers by points: if/else 25 (62 pts), loops 6 (24 pts), match/switch 1 (nesting depth added 55). None of this is in the body itself: all 87 points belong to one function literal inside it that branches (line 714). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderExternalMCPList (cognitive 85) · ×1
  • renderExternalMCPList (cognitive 85) web/static/js/settings.js:4502 — renderExternalMCPList has cognitive complexity 85 (threshold 15). Drivers by points: ternaries 34 (68 pts), boolean chains 11, if/else 4 (5 pts), loops 1 (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.
D2 · Cognitive Complexity · Client.ChatCompletionStreamWithToolCalls (cognitive 83) · ×1
  • Client.ChatCompletionStreamWithToolCalls (cognitive 83) internal/openai/openai.go:328 — Client.ChatCompletionStreamWithToolCalls has cognitive complexity 83 (threshold 15). Drivers by points: if/else 32 (72 pts), loops 6 (9 pts), boolean chains 2 (nesting depth added 43). 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.
D2 · Cognitive Complexity · handler.RegisterBatchTaskMCPTools (cognitive 80) · ×1
  • handler.RegisterBatchTaskMCPTools (cognitive 80) internal/handler/batch_task_mcp.go:22 — handler.RegisterBatchTaskMCPTools has cognitive complexity 80 (threshold 15). Drivers by points: if/else 59 (68 pts), boolean chains 9, match/switch 1 (2 pts), loops 1 (nesting depth added 10). Most of this is not in the body itself: 2 of the 80 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 200, 58, 488, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · coalesceProcessDetailsToolPairs (cognitive 79) · ×1
  • coalesceProcessDetailsToolPairs (cognitive 79) web/static/js/monitor.js:6314 — coalesceProcessDetailsToolPairs has cognitive complexity 79 (threshold 15). Drivers by points: if/else 19 (54 pts), boolean chains 14, loops 3 (9 pts), ternaries 1 (2 pts) (nesting depth added 42). Of this number, 72 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetProcessDetailsSummary (cognitive 78) · ×1
  • DB.GetProcessDetailsSummary (cognitive 78) REDACTED:1452 — DB.GetProcessDetailsSummary has cognitive complexity 78 (threshold 15). Drivers by points: if/else 36 (67 pts), boolean chains 7, loops 2, match/switch 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · piRun.executePiPlan (cognitive 77) · ×1
  • piRun.executePiPlan (cognitive 77) internal/multiagent/pi_plan_tools.go:105 — piRun.executePiPlan has cognitive complexity 77 (threshold 15). Drivers by points: if/else 24 (59 pts), loops 7 (15 pts), boolean chains 3 (nesting depth added 43). 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.
D2 · Cognitive Complexity · handler.transformSecretTree (cognitive 73) · ×1
  • handler.transformSecretTree (cognitive 73) internal/handler/config_secrets.go:42 — handler.transformSecretTree has cognitive complexity 73 (threshold 15). Drivers by points: if/else 13 (52 pts), loops 4 (14 pts), boolean chains 6, match/switch 1 (nesting depth added 49). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · workflow.invokeGraph (cognitive 72) · ×1
  • workflow.invokeGraph (cognitive 72) internal/workflow/native_runtime.go:27 — workflow.invokeGraph has cognitive complexity 72 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 5 (8 pts), boolean chains 4 (nesting depth added 38). 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.
D2 · Cognitive Complexity · editRole (cognitive 72) · ×1
  • editRole (cognitive 72) web/static/js/roles.js:1373 — editRole has cognitive complexity 72 (threshold 15). Drivers by points: if/else 27 (51 pts), boolean chains 11, ternaries 3 (8 pts), error handling 1 (2 pts) (nesting depth added 30). Of this number, 48 points are the body's own statements and 24 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.
D2 · Cognitive Complexity · project.BuildProjectFactGraph (cognitive 70) · ×1
  • project.BuildProjectFactGraph (cognitive 70) internal/project/fact_edges.go:88 — project.BuildProjectFactGraph has cognitive complexity 70 (threshold 15). Drivers by points: if/else 31 (57 pts), loops 8 (11 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · renderMCPDetailModal (cognitive 70) · ×1
  • renderMCPDetailModal (cognitive 70) web/static/js/chat.js:5600 — renderMCPDetailModal has cognitive complexity 70 (threshold 15). Drivers by points: if/else 18 (29 pts), ternaries 13 (25 pts), boolean chains 13, error handling 2 (3 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.prepareMultiAgentSession (cognitive 68) · ×1
  • AgentHandler.prepareMultiAgentSession (cognitive 68) internal/handler/multi_agent_prepare.go:36 — AgentHandler.prepareMultiAgentSession has cognitive complexity 68 (threshold 15). Drivers by points: if/else 40 (55 pts), boolean chains 13 (nesting depth added 15). Of this number, 66 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat.loadConversation · ×1
  • chat.loadConversation::renderOneMessage (cognitive 68) web/static/js/chat.js:6531 — chat.loadConversation::renderOneMessage has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 14 (32 pts), boolean chains 23, if/else 8 (13 pts) (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.
D2 · Cognitive Complexity · buildInlineHitlApprovalHtml (cognitive 68) · ×1
  • buildInlineHitlApprovalHtml (cognitive 68) web/static/js/monitor.js:4607 — buildInlineHitlApprovalHtml has cognitive complexity 68 (threshold 15). Drivers by points: ternaries 23 (38 pts), boolean chains 22, if/else 6 (8 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · roles.saveRole (cognitive 67) · ×1
  • roles.saveRole (cognitive 67) web/static/js/roles.js:1645 — roles.saveRole has cognitive complexity 67 (threshold 15). Drivers by points: if/else 21 (45 pts), boolean chains 11, ternaries 8 (10 pts), error handling 1 (nesting depth added 26). Of this number, 48 points are the body's own statements and 19 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.
D2 · Cognitive Complexity · workflows.validateWorkflowGraph (cognitive 66) · ×1
  • workflows.validateWorkflowGraph (cognitive 66) web/static/js/workflows.js:2095 — workflows.validateWorkflowGraph has cognitive complexity 66 (threshold 15). Drivers by points: if/else 25 (34 pts), boolean chains 28, loops 2 (4 pts) (nesting depth added 11). Most of this is not in the body itself: 11 of the 66 points are its own statements and the rest belongs to 16 function items inside it that branch (a function literal at line 2130, visit, a function literal at line 2125, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · ConfigHandler.ApplyConfig (cognitive 65) · ×1
  • ConfigHandler.ApplyConfig (cognitive 65) internal/handler/config.go:1781 — ConfigHandler.ApplyConfig has cognitive complexity 65 (threshold 15). Drivers by points: if/else 42 (59 pts), boolean chains 6 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Builder.BuildChainFromConversation (cognitive 64) · ×1
  • Builder.BuildChainFromConversation (cognitive 64) internal/attackchain/builder.go:87 — Builder.BuildChainFromConversation has cognitive complexity 64 (threshold 15). Drivers by points: if/else 30 (53 pts), loops 5 (7 pts), boolean chains 4 (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.
D2 · Cognitive Complexity · app.registerWebshellManagementTools (cognitive 62) · ×1
  • app.registerWebshellManagementTools (cognitive 62) REDACTED:1686 — app.registerWebshellManagementTools has cognitive complexity 62 (threshold 15). Drivers by points: if/else 44 (54 pts), boolean chains 7, loops 1 (nesting depth added 10). Most of this is not in the body itself: 1 of the 62 points is its own statement and the rest belongs to 7 function literals inside it that branch (lines 1941, 1735, 2071, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadConversations (cognitive 62) · ×1
  • loadConversations (cognitive 62) web/static/js/chat.js:10004 — loadConversations has cognitive complexity 62 (threshold 15). Drivers by points: if/else 29 (40 pts), ternaries 12 (15 pts), boolean chains 6, error handling 1 (nesting depth added 14). Of this number, 47 points are the body's own statements and 15 belong to 9 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.
D2 · Cognitive Complexity · update.Rollback (cognitive 60) · ×1
  • update.Rollback (cognitive 60) internal/update/apply.go:907 — update.Rollback has cognitive complexity 60 (threshold 15). Drivers by points: if/else 35 (54 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · syncModelListFetchButtons (cognitive 60) · ×1
  • syncModelListFetchButtons (cognitive 60) web/static/js/settings.js:3478 — syncModelListFetchButtons has cognitive complexity 60 (threshold 15). Drivers by points: if/else 28 (36 pts), boolean chains 15, ternaries 5 (9 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.
D2 · Cognitive Complexity · parseWebshellListItems (cognitive 60) · ×1
  • parseWebshellListItems (cognitive 60) web/static/js/webshell.js:4325 — parseWebshellListItems has cognitive complexity 60 (threshold 15). Drivers by points: if/else 18 (45 pts), boolean chains 9, ternaries 1 (5 pts), loops 1 (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · project.SyncBodyLinksSection (cognitive 59) · ×1
  • project.SyncBodyLinksSection (cognitive 59) internal/project/fact_body_links.go:109 — project.SyncBodyLinksSection has cognitive complexity 59 (threshold 15). Drivers by points: if/else 13 (47 pts), loops 3 (9 pts), boolean chains 3 (nesting depth added 40). 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.
D2 · Cognitive Complexity · webshell.runWebshellAiSend · ×1
  • webshell.runWebshellAiSend::appendTimelineItem (cognitive 59) web/static/js/webshell.js:3418 — webshell.runWebshellAiSend::appendTimelineItem has cognitive complexity 59 (threshold 15). Drivers by points: ternaries 14 (35 pts), boolean chains 10, if/else 7 (9 pts), error handling 2 (5 pts) (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.
D2 · Cognitive Complexity · app.registerC2ListenerTool (cognitive 58) · ×1
  • app.registerC2ListenerTool (cognitive 58) internal/app/c2_tools.go:54 — app.registerC2ListenerTool has cognitive complexity 58 (threshold 15). Drivers by points: if/else 23 (50 pts), boolean chains 5, loops 1 (2 pts), match/switch 1 (nesting depth added 28). None of this is in the body itself: all 58 points belong to one function literal inside it that branches (line 85). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · app.registerProjectFactTools (cognitive 58) · ×1
  • app.registerProjectFactTools (cognitive 58) internal/app/project_fact_tools.go:40 — app.registerProjectFactTools has cognitive complexity 58 (threshold 15). Drivers by points: if/else 41 (48 pts), loops 4 (6 pts), boolean chains 4 (nesting depth added 9). Most of this is not in the body itself: 5 of the 58 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 119, 194, 370, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · render (cognitive 58) · ×1
  • render (cognitive 58) web/static/js/fact-graph.js:550 — render has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 35, if/else 10 (12 pts), ternaries 8 (11 pts) (nesting depth added 5). Of this number, 31 points are the body's own statements and 27 belong to 15 function items 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.
D2 · Cognitive Complexity · AgentHandler.executeOneBatchSubTask (cognitive 57) · ×1
  • AgentHandler.executeOneBatchSubTask (cognitive 57) internal/handler/batch_queue_executor.go:113 — AgentHandler.executeOneBatchSubTask has cognitive complexity 57 (threshold 15). Drivers by points: if/else 38 (50 pts), boolean chains 6, match/switch 1 (nesting depth added 12). Of this number, 54 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · project.BuildWorkspaceInventoryBlock (cognitive 57) · ×1
  • project.BuildWorkspaceInventoryBlock (cognitive 57) internal/project/workspace_inventory.go:20 — project.BuildWorkspaceInventoryBlock has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (40 pts), boolean chains 7, match/switch 2 (7 pts), loops 2 (3 pts) (nesting depth added 28). Most of this is not in the body itself: 7 of the 57 points are its own statements and the rest belongs to one function literal inside it that branches (line 27). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · worker.run (cognitive 57) · ×1
  • worker.run (cognitive 57) runtime/pi/src/worker.ts:181 — worker.run has cognitive complexity 57 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 22, ternaries 4 (7 pts), loops 2, error handling 1 (nesting depth added 9). Of this number, 44 points are the body's own statements and 13 belong to 8 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.renderMonitorExecutions (cognitive 57) · ×1
  • monitor.renderMonitorExecutions (cognitive 57) web/static/js/monitor.js:9045 — monitor.renderMonitorExecutions has cognitive complexity 57 (threshold 15). Drivers by points: ternaries 22 (28 pts), if/else 13 (17 pts), boolean chains 12 (nesting depth added 10). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · saveExternalMCP (cognitive 57) · ×1
  • saveExternalMCP (cognitive 57) web/static/js/settings.js:4734 — saveExternalMCP has cognitive complexity 57 (threshold 15). Drivers by points: if/else 16 (26 pts), ternaries 8 (15 pts), boolean chains 11, loops 2 (3 pts), error handling 2 (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.
D2 · Cognitive Complexity · renderFileList (cognitive 57) · ×1
  • renderFileList (cognitive 57) web/static/js/webshell.js:4413 — renderFileList has cognitive complexity 57 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 18, ternaries 8 (16 pts) (nesting depth added 14). Of this number, 23 points are the body's own statements and 34 belong to 20 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · testWebshellConnection (cognitive 56) · ×1
  • testWebshellConnection (cognitive 56) web/static/js/webshell.js:5229 — testWebshellConnection has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 23, if/else 17 (21 pts), ternaries 6 (11 pts), error handling 1 (nesting depth added 9). Of this number, 31 points are the body's own statements and 25 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RobotHandler.handleRobotCommand (cognitive 55) · ×1
  • RobotHandler.handleRobotCommand (cognitive 55) REDACTED:1247 — RobotHandler.handleRobotCommand has cognitive complexity 55 (threshold 15). Drivers by points: boolean chains 29, if/else 13 (19 pts), match/switch 4 (7 pts) (nesting depth added 9). 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.
D2 · Cognitive Complexity · renderRecentFacts (cognitive 55) · ×1
  • renderRecentFacts (cognitive 55) web/static/js/dashboard.js:1397 — renderRecentFacts has cognitive complexity 55 (threshold 15). Drivers by points: if/else 10 (20 pts), ternaries 8 (14 pts), boolean chains 11, error handling 2 (10 pts) (nesting depth added 24). Of this number, 23 points are the body's own statements and 32 belong to 5 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.
D2 · Cognitive Complexity · nativeSplitter.Transform (cognitive 54) · ×1
  • nativeSplitter.Transform (cognitive 54) internal/knowledge/splitter.go:60 — nativeSplitter.Transform has cognitive complexity 54 (threshold 15). Drivers by points: if/else 12 (35 pts), loops 6 (16 pts), boolean chains 3 (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderProcessDetails (cognitive 54) · ×1
  • renderProcessDetails (cognitive 54) web/static/js/chat.js:4069 — renderProcessDetails has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 86 (186 pts), if/else 99 (122 pts), boolean chains 87, other 2, loops 1 (nesting depth added 123). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderToolCallDetailContent (cognitive 54) · ×1
  • renderToolCallDetailContent (cognitive 54) web/static/js/monitor.js:6078 — renderToolCallDetailContent has cognitive complexity 54 (threshold 15). Drivers by points: ternaries 11 (28 pts), if/else 10 (17 pts), boolean chains 7, error handling 1 (2 pts) (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · Agent.repairOrphanToolMessages (cognitive 53) · ×1
  • Agent.repairOrphanToolMessages (cognitive 53) internal/agent/agent.go:668 — Agent.repairOrphanToolMessages has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (37 pts), loops 4 (11 pts), boolean chains 3, match/switch 1 (2 pts) (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.
D2 · Cognitive Complexity · BatchTaskManager.LoadFromDB (cognitive 53) · ×1
  • BatchTaskManager.LoadFromDB (cognitive 53) internal/handler/batch_task_manager.go:539 — BatchTaskManager.LoadFromDB has cognitive complexity 53 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 3, loops 2 (3 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.
D2 · Cognitive Complexity · testHitlAuditModelConnection (cognitive 53) · ×1
  • testHitlAuditModelConnection (cognitive 53) web/static/js/settings.js:3824 — testHitlAuditModelConnection has cognitive complexity 53 (threshold 15). Drivers by points: ternaries 13 (28 pts), if/else 13 (19 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · Agent.getAvailableTools (cognitive 52) · ×1
  • Agent.getAvailableTools (cognitive 52) internal/agent/agent.go:313 — Agent.getAvailableTools has cognitive complexity 52 (threshold 15). Drivers by points: if/else 17 (46 pts), loops 3 (6 pts) (nesting depth added 32). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · chat-files.renderChatFilesTable (cognitive 52) · ×1
  • chat-files.renderChatFilesTable (cognitive 52) web/static/js/chat-files.js:992 — chat-files.renderChatFilesTable has cognitive complexity 52 (threshold 15). Drivers by points: ternaries 43 (66 pts), if/else 24 (32 pts), boolean chains 23, loops 1 (2 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: 2 other methods here (chat-files.renderChatFilesTable::rowHtml, chat-files.renderChatFilesTable::rowHtmlTreeFile) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 3 times rather than 3 independent problems. Splitting this body alone leaves the other 2 exactly as they are. Where these are variations on one operation, the change that clears all 3 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · saveKnowledgeItem (cognitive 52) · ×1
  • saveKnowledgeItem (cognitive 52) REDACTED:994 — saveKnowledgeItem has cognitive complexity 52 (threshold 15). Drivers by points: if/else 22 (33 pts), boolean chains 9, ternaries 6, error handling 3 (4 pts) (nesting depth added 12). Of this number, 49 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · startProcessDetailsLatestFollow (cognitive 52) · ×1
  • startProcessDetailsLatestFollow (cognitive 52) web/static/js/monitor.js:2149 — startProcessDetailsLatestFollow has cognitive complexity 52 (threshold 15). Drivers by points: if/else 28 (29 pts), boolean chains 20, ternaries 3 (nesting depth added 1). Most of this is not in the body itself: 15 of the 52 points are its own statements and the rest belongs to 19 function items inside it that branch (onScroll, onWheel, onKeyDown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · multiagent.runPiMulti (cognitive 51) · ×1
  • multiagent.runPiMulti (cognitive 51) internal/multiagent/pi_runner.go:67 — multiagent.runPiMulti has cognitive complexity 51 (threshold 15). Drivers by points: if/else 32 (45 pts), boolean chains 5, loops 1 (nesting depth added 13). Of this number, 29 points are the body's own statements and 22 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · onEvent (cognitive 51) · ×1
  • onEvent (cognitive 51) web/static/js/c2.js:4388 — onEvent has cognitive complexity 51 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 17, error handling 3 (9 pts), ternaries 1 (3 pts) (nesting depth added 16). Of this number, 44 points are the body's own statements and 7 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.
D2 · Cognitive Complexity · database.tokenizeSchema (cognitive 49) · ×1
  • database.tokenizeSchema (cognitive 49) internal/database/schema_reconcile.go:153 — database.tokenizeSchema has cognitive complexity 49 (threshold 15). Drivers by points: if/else 12 (32 pts), loops 4 (10 pts), boolean chains 7 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · router.updateNavState (cognitive 49) · ×1
  • router.updateNavState (cognitive 49) web/static/js/router.js:183 — router.updateNavState has cognitive complexity 49 (threshold 15). Drivers by points: if/else 26 (43 pts), boolean chains 6 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · vulnerability.syncVulnerabilityFiltersFromLocationHash (cognitive 49) · ×1
  • vulnerability.syncVulnerabilityFiltersFromLocationHash (cognitive 49) web/static/js/vulnerability.js:272 — vulnerability.syncVulnerabilityFiltersFromLocationHash has cognitive complexity 49 (threshold 15). Drivers by points: if/else 29 (38 pts), boolean chains 11 (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.
D2 · Cognitive Complexity · restoreWorkflowHitlInlineForConversation (cognitive 49) · ×1
  • restoreWorkflowHitlInlineForConversation (cognitive 49) web/static/js/monitor.js:5218 — restoreWorkflowHitlInlineForConversation has cognitive complexity 49 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 11, error handling 4 (7 pts), ternaries 2 (5 pts), loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · database.normalizeAsset (cognitive 48) · ×1
  • database.normalizeAsset (cognitive 48) internal/database/asset.go:98 — database.normalizeAsset has cognitive complexity 48 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 5, loops 1 (nesting depth added 22). 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.
D2 · Cognitive Complexity · hitl.openHitlLogModal (cognitive 48) · ×1
  • hitl.openHitlLogModal (cognitive 48) web/static/js/hitl.js:1874 — hitl.openHitlLogModal has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 16, ternaries 2 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatUploadsHandler.collectFiles (cognitive 47) · ×1
  • ChatUploadsHandler.collectFiles (cognitive 47) REDACTED:323 — ChatUploadsHandler.collectFiles has cognitive complexity 47 (threshold 15). Drivers by points: if/else 25 (34 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 13). Of this number, 31 points are the body's own statements and 16 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · addMessage (cognitive 47) · ×1
  • addMessage (cognitive 47) web/static/js/chat.js:3558 — addMessage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 24 (29 pts), boolean chains 9, ternaries 3 (5 pts), error handling 2 (4 pts) (nesting depth added 9). Of this number, 46 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · deleteKnowledgeItem (cognitive 47) · ×1
  • deleteKnowledgeItem (cognitive 47) REDACTED:1154 — deleteKnowledgeItem has cognitive complexity 47 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 6, error handling 2 (3 pts), ternaries 2 (nesting depth added 22). Of this number, 27 points are the body's own statements and 20 belong to 3 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · loadToolsList (cognitive 47) · ×1
  • loadToolsList (cognitive 47) web/static/js/settings.js:1224 — loadToolsList has cognitive complexity 47 (threshold 15). Drivers by points: if/else 18 (24 pts), ternaries 4 (12 pts), boolean chains 9, error handling 1, other 1 (nesting depth added 14). Of this number, 44 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchTaskManager.ListQueuesForAccess (cognitive 46) · ×1
  • BatchTaskManager.ListQueuesForAccess (cognitive 46) internal/handler/batch_task_manager.go:444 — BatchTaskManager.ListQueuesForAccess has cognitive complexity 46 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 26). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · update.Apply (cognitive 46) · ×1
  • update.Apply (cognitive 46) internal/update/apply.go:186 — update.Apply has cognitive complexity 46 (threshold 15). Drivers by points: if/else 34 (41 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · updateIndexProgress (cognitive 46) · ×1
  • updateIndexProgress (cognitive 46) REDACTED:438 — updateIndexProgress has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 13, ternaries 3 (6 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.
D2 · Cognitive Complexity · renderToolsList (cognitive 46) · ×1
  • renderToolsList (cognitive 46) web/static/js/settings.js:1389 — renderToolsList has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 18 (25 pts), if/else 10 (12 pts), boolean chains 9 (nesting depth added 9). Most of this is not in the body itself: 9 of the 46 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1420, 1471). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Manager.EnqueueTask (cognitive 45) · ×1
  • Manager.EnqueueTask (cognitive 45) internal/c2/manager.go:492 — Manager.EnqueueTask has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (36 pts), boolean chains 5, loops 1 (4 pts) (nesting depth added 22). Of this number, 42 points are the body's own statements and 3 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.
D2 · Cognitive Complexity · AgentHandler.ProcessMessageForRobot (cognitive 45) · ×1
  • AgentHandler.ProcessMessageForRobot (cognitive 45) internal/handler/agent.go:830 — AgentHandler.ProcessMessageForRobot has cognitive complexity 45 (threshold 15). Drivers by points: if/else 24 (34 pts), boolean chains 7, loops 1 (3 pts), match/switch 1 (nesting depth added 12). Of this number, 43 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KnowledgeHandler.GetItems (cognitive 45) · ×1
  • KnowledgeHandler.GetItems (cognitive 45) internal/handler/knowledge.go:63 — KnowledgeHandler.GetItems has cognitive complexity 45 (threshold 15). Drivers by points: if/else 18 (32 pts), loops 4 (9 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.
D2 · Cognitive Complexity · renderRetrievalLogs (cognitive 45) · ×1
  • renderRetrievalLogs (cognitive 45) REDACTED:1362 — renderRetrievalLogs has cognitive complexity 45 (threshold 15). Drivers by points: if/else 12 (27 pts), ternaries 13, error handling 1 (3 pts), boolean chains 2 (nesting depth added 17). Most of this is not in the body itself: 2 of the 45 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1378, 1386, 1403, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · app.initializeKnowledge (cognitive 44) · ×1
  • app.initializeKnowledge (cognitive 44) REDACTED:2130 — app.initializeKnowledge has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (40 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 20). Of this number, 16 points are the body's own statements and 28 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.ApplyWorkflowPackageImport (cognitive 44) · ×1
  • DB.ApplyWorkflowPackageImport (cognitive 44) internal/database/workflow_package.go:100 — DB.ApplyWorkflowPackageImport has cognitive complexity 44 (threshold 15). Drivers by points: if/else 30 (39 pts), boolean chains 4, match/switch 1 (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.
D2 · Cognitive Complexity · update.buildAndSwap (cognitive 44) · ×1
  • update.buildAndSwap (cognitive 44) internal/update/apply.go:579 — update.buildAndSwap has cognitive complexity 44 (threshold 15). Drivers by points: if/else 22 (36 pts), boolean chains 8 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · 1.onEvent (cognitive 44) · ×1
  • 1.onEvent (cognitive 44) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/BurpExtender.java:79 — 1.onEvent has cognitive complexity 44 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 11, ternaries 1 (3 pts), match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · terminal.removeTerminalTab (cognitive 44) · ×1
  • terminal.removeTerminalTab (cognitive 44) web/static/js/terminal.js:386 — terminal.removeTerminalTab has cognitive complexity 44 (threshold 15). Drivers by points: if/else 17 (28 pts), loops 5 (8 pts), boolean chains 5, ternaries 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · token-usage.renderTokenUsageAnalysis (cognitive 44) · ×1
  • token-usage.renderTokenUsageAnalysis (cognitive 44) web/static/js/token-usage.js:136 — token-usage.renderTokenUsageAnalysis has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 14 (18 pts), boolean chains 12, if/else 9, loops 5 (nesting depth added 4). Of this number, 17 points are the body's own statements and 27 belong to 9 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · refreshChatPanelI18n (cognitive 44) · ×1
  • refreshChatPanelI18n (cognitive 44) web/static/js/chat.js:11158 — refreshChatPanelI18n has cognitive complexity 44 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 5 (8 pts), boolean chains 7, error handling 2 (5 pts) (nesting depth added 17). Of this number, 21 points are the body's own statements and 23 belong to 5 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.
D2 · Cognitive Complexity · workflowAiBuildDraft (cognitive 44) · ×1
  • workflowAiBuildDraft (cognitive 44) web/static/js/workflows.js:1525 — workflowAiBuildDraft has cognitive complexity 44 (threshold 15). Drivers by points: ternaries 16 (27 pts), if/else 8 (12 pts), boolean chains 5 (nesting depth added 15). Of this number, 39 points are the body's own statements and 5 belong to 6 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.
D2 · Cognitive Complexity · mergeToolResultIntoCallItem (cognitive 43) · ×1
  • mergeToolResultIntoCallItem (cognitive 43) web/static/js/monitor.js:6197 — mergeToolResultIntoCallItem has cognitive complexity 43 (threshold 15). Drivers by points: if/else 13 (19 pts), ternaries 12 (15 pts), boolean chains 9 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · buildMcpTimelineSvg (cognitive 43) · ×1
  • buildMcpTimelineSvg (cognitive 43) web/static/js/monitor.js:7812 — buildMcpTimelineSvg has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 20 (21 pts), boolean chains 15, if/else 6 (7 pts) (nesting depth added 2). Most of this is not in the body itself: 11 of the 43 points are its own statements and the rest belongs to 13 function literals inside it that branch (lines 7890, 7879, 7868, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · saveWebshellConnection (cognitive 43) · ×1
  • saveWebshellConnection (cognitive 43) web/static/js/webshell.js:5296 — saveWebshellConnection has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 21, if/else 14 (15 pts), ternaries 5 (6 pts), error handling 1 (nesting depth added 2). Of this number, 36 points are the body's own statements and 7 belong to 5 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.
D2 · Cognitive Complexity · handler.updateExternalMCPConfig (cognitive 42) · ×1
  • handler.updateExternalMCPConfig (cognitive 42) internal/handler/external_mcp.go:408 — handler.updateExternalMCPConfig has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (28 pts), loops 4 (10 pts), boolean chains 4 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.validateNodeConfigs (cognitive 42) · ×1
  • workflow.validateNodeConfigs (cognitive 42) internal/workflow/validation.go:133 — workflow.validateNodeConfigs has cognitive complexity 42 (threshold 15). Drivers by points: if/else 13 (38 pts), match/switch 1 (2 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · assets.assetImportRecord (cognitive 42) · ×1
  • assets.assetImportRecord (cognitive 42) REDACTED:319 — assets.assetImportRecord has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 26, if/else 12 (13 pts), ternaries 2, error handling 1 (nesting depth added 1). Of this number, 40 points are the body's own statements and 2 belong to 2 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.
D2 · Cognitive Complexity · monitor.renderMcpStatsToolsPanel (cognitive 42) · ×1
  • monitor.renderMcpStatsToolsPanel (cognitive 42) web/static/js/monitor.js:8822 — monitor.renderMcpStatsToolsPanel has cognitive complexity 42 (threshold 15). Drivers by points: boolean chains 22, ternaries 16 (19 pts), if/else 1 (nesting depth added 3). Most of this is not in the body itself: 6 of the 42 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 8848, 8831, 8824, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · submitLogin (cognitive 42) · ×1
  • submitLogin (cognitive 42) web/static/js/auth.js:278 — submitLogin has cognitive complexity 42 (threshold 15). Drivers by points: if/else 14 (20 pts), ternaries 5 (13 pts), boolean chains 7, error handling 2 (nesting depth added 14). Of this number, 41 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · updateMentionCandidates (cognitive 42) · ×1
  • updateMentionCandidates (cognitive 42) web/static/js/chat.js:3043 — updateMentionCandidates has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 12 (16 pts), boolean chains 9 (nesting depth added 13). Most of this is not in the body itself: 8 of the 42 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 3084, 3069, 3059, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderVulnerabilityBrowser (cognitive 42) · ×1
  • renderVulnerabilityBrowser (cognitive 42) web/static/js/vulnerability.js:1422 — renderVulnerabilityBrowser has cognitive complexity 42 (threshold 15). Drivers by points: ternaries 11 (19 pts), if/else 9 (12 pts), boolean chains 9, loops 1, other 1 (nesting depth added 11). Of this number, 35 points are the body's own statements and 7 belong to 8 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.
D2 · Cognitive Complexity · DB.reconcileSchema (cognitive 41) · ×1
  • DB.reconcileSchema (cognitive 41) internal/database/schema_reconcile.go:66 — DB.reconcileSchema has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 5 (7 pts) (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatUploadsHandler.Upload (cognitive 41) · ×1
  • ChatUploadsHandler.Upload (cognitive 41) REDACTED:1402 — ChatUploadsHandler.Upload has cognitive complexity 41 (threshold 15). Drivers by points: if/else 25 (39 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.
D2 · Cognitive Complexity · WebShellHandler.buildFileCommand (cognitive 41) · ×1
  • WebShellHandler.buildFileCommand (cognitive 41) REDACTED:201 — WebShellHandler.buildFileCommand has cognitive complexity 41 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 1, match/switch 1 (nesting depth added 20). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · Server.handleCallTool (cognitive 41) · ×1
  • Server.handleCallTool (cognitive 41) internal/mcp/server.go:521 — Server.handleCallTool has cognitive complexity 41 (threshold 15). Drivers by points: if/else 27 (38 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Client.ChatCompletionStream (cognitive 41) · ×1
  • Client.ChatCompletionStream (cognitive 41) internal/openai/openai.go:181 — Client.ChatCompletionStream has cognitive complexity 41 (threshold 15). Drivers by points: if/else 23 (39 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.
D2 · Cognitive Complexity · dashboard.renderSeverityInsights (cognitive 41) · ×1
  • dashboard.renderSeverityInsights (cognitive 41) web/static/js/dashboard.js:1587 — dashboard.renderSeverityInsights has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 13, ternaries 7 (11 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.
D2 · Cognitive Complexity · renderDashboardAccessOverview (cognitive 41) · ×1
  • renderDashboardAccessOverview (cognitive 41) web/static/js/dashboard.js:471 — renderDashboardAccessOverview has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (22 pts), boolean chains 13, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 7). Of this number, 34 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · renderDashboardAlertBanner (cognitive 41) · ×1
  • renderDashboardAlertBanner (cognitive 41) web/static/js/dashboard.js:772 — renderDashboardAlertBanner has cognitive complexity 41 (threshold 15). Drivers by points: if/else 18 (21 pts), error handling 9 (15 pts), boolean chains 5 (nesting depth added 9). Of this number, 33 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · toggleToolDetail (cognitive 41) · ×1
  • toggleToolDetail (cognitive 41) web/static/js/settings.js:1488 — toggleToolDetail has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 7 (17 pts), if/else 8 (13 pts), boolean chains 9, error handling 1 (2 pts) (nesting depth added 16). Of this number, 21 points are the body's own statements and 20 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.
D2 · Cognitive Complexity · database.vulnerabilityTargetsJSON (cognitive 40) · ×1
  • database.vulnerabilityTargetsJSON (cognitive 40) internal/database/vulnerability_workspace.go:35 — database.vulnerabilityTargetsJSON has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (28 pts), boolean chains 9, loops 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.
D2 · Cognitive Complexity · Manager.GetItemsWithOptions (cognitive 40) · ×1
  • Manager.GetItemsWithOptions (cognitive 40) internal/knowledge/manager.go:253 — Manager.GetItemsWithOptions has cognitive complexity 40 (threshold 15). Drivers by points: if/else 15 (30 pts), loops 3 (7 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · api-docs.renderRequestBody (cognitive 40) · ×1
  • api-docs.renderRequestBody (cognitive 40) web/static/js/api-docs.js:353 — api-docs.renderRequestBody has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (26 pts), boolean chains 8, ternaries 4 (6 pts) (nesting depth added 10). Most of this is not in the body itself: 15 of the 40 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 374, 446). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · chat.ensureProjectSidebarStructure (cognitive 40) · ×1
  • chat.ensureProjectSidebarStructure (cognitive 40) web/static/js/chat.js:6089 — chat.ensureProjectSidebarStructure has cognitive complexity 40 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 6 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchChatSystemModelsForChannel (cognitive 40) · ×1
  • fetchChatSystemModelsForChannel (cognitive 40) web/static/js/chat.js:1547 — fetchChatSystemModelsForChannel has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 23, if/else 10 (13 pts), error handling 2, ternaries 2 (nesting depth added 3). Of this number, 36 points are the body's own statements and 4 belong to 5 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.
D2 · Cognitive Complexity · formatConversationAsMarkdown (cognitive 40) · ×1
  • formatConversationAsMarkdown (cognitive 40) web/static/js/chat.js:10683 — formatConversationAsMarkdown has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 18, if/else 10 (13 pts), ternaries 7 (9 pts) (nesting depth added 5). Most of this is not in the body itself: 12 of the 40 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 10702, 10717). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Builder.formatAgentTraceFromChatMessages (cognitive 39) · ×1
  • Builder.formatAgentTraceFromChatMessages (cognitive 39) internal/attackchain/builder.go:435 — Builder.formatAgentTraceFromChatMessages has cognitive complexity 39 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 4 (7 pts), match/switch 1 (3 pts), boolean chains 2 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.migrateVulnerabilitiesConversationFK (cognitive 39) · ×1
  • DB.migrateVulnerabilitiesConversationFK (cognitive 39) internal/database/schema_legacy.go:15 — DB.migrateVulnerabilitiesConversationFK has cognitive complexity 39 (threshold 15). Drivers by points: if/else 27 (34 pts), loops 4, boolean chains 1 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · robot.handleDingMessage (cognitive 39) · ×1
  • robot.handleDingMessage (cognitive 39) internal/robot/ding.go:70 — robot.handleDingMessage has cognitive complexity 39 (threshold 15). Drivers by points: if/else 19 (32 pts), loops 1 (4 pts), boolean chains 3 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.checkRecoveryValue (cognitive 39) · ×1
  • update.checkRecoveryValue (cognitive 39) internal/update/recovery_evidence.go:28 — update.checkRecoveryValue has cognitive complexity 39 (threshold 15). Drivers by points: if/else 13 (30 pts), loops 3 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · formatTaskCommand (cognitive 39) · ×1
  • formatTaskCommand (cognitive 39) web/static/js/c2.js:365 — formatTaskCommand has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 8 (17 pts), if/else 8 (14 pts), boolean chains 5, error handling 1 (2 pts), match/switch 1 (nesting depth added 16). Of this number, 38 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · bindChatScrollListeners (cognitive 39) · ×1
  • bindChatScrollListeners (cognitive 39) web/static/js/chat-scroll.js:683 — bindChatScrollListeners has cognitive complexity 39 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 8, ternaries 1 (2 pts), other 1 (nesting depth added 6). Most of this is not in the body itself: 6 of the 39 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 710, 721, 691, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · bindInlineHitlApproval · ×1
  • bindInlineHitlApproval::submit (cognitive 39) web/static/js/monitor.js:4751 — bindInlineHitlApproval::submit has cognitive complexity 39 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 13, ternaries 5 (8 pts), error handling 2 (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.
D2 · Cognitive Complexity · ChatUploadsHandler.Export (cognitive 38) · ×1
  • ChatUploadsHandler.Export (cognitive 38) REDACTED:866 — ChatUploadsHandler.Export has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (32 pts), boolean chains 5, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · report.Render (cognitive 38) · ×1
  • report.Render (cognitive 38) internal/report/docx.go:68 — report.Render has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (26 pts), loops 8 (12 pts) (nesting depth added 10). Of this number, 36 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · info-collect.refreshInfoCollectProviderUI (cognitive 38) · ×1
  • info-collect.refreshInfoCollectProviderUI (cognitive 38) web/static/js/info-collect.js:625 — info-collect.refreshInfoCollectProviderUI has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 13, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · skills.saveSkill (cognitive 38) · ×1
  • skills.saveSkill (cognitive 38) web/static/js/skills.js:766 — skills.saveSkill has cognitive complexity 38 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 12, error handling 1, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · followAgentRunAfterHitlDecision (cognitive 38) · ×1
  • followAgentRunAfterHitlDecision (cognitive 38) web/static/js/hitl.js:714 — followAgentRunAfterHitlDecision has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 8, error handling 3 (5 pts), loops 1, ternaries 1 (nesting depth added 14). Of this number, 32 points are the body's own statements and 6 belong to 8 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.
D2 · Cognitive Complexity · writeAIChannelToMainForm (cognitive 38) · ×1
  • writeAIChannelToMainForm (cognitive 38) web/static/js/settings.js:2679 — writeAIChannelToMainForm has cognitive complexity 38 (threshold 15). Drivers by points: boolean chains 17, if/else 13, ternaries 4 (8 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.
D2 · Cognitive Complexity · app.authorizeC2Action (cognitive 37) · ×1
  • app.authorizeC2Action (cognitive 37) internal/app/mcp_authorization.go:251 — app.authorizeC2Action has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (29 pts), boolean chains 6, loops 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatUploadsHandler.ResolvePath (cognitive 37) · ×1
  • ChatUploadsHandler.ResolvePath (cognitive 37) REDACTED:1062 — ChatUploadsHandler.ResolvePath has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 3, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MonitorHandler.loadExecutionsWithPagination (cognitive 37) · ×1
  • MonitorHandler.loadExecutionsWithPagination (cognitive 37) internal/handler/monitor.go:357 — MonitorHandler.loadExecutionsWithPagination has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 6, loops 2 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · reasoning.ProviderExtraFields (cognitive 37) · ×1
  • reasoning.ProviderExtraFields (cognitive 37) internal/reasoning/provider.go:46 — reasoning.ProviderExtraFields has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (32 pts), boolean chains 4, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.Adopt (cognitive 37) · ×1
  • update.Adopt (cognitive 37) REDACTED:137 — update.Adopt has cognitive complexity 37 (threshold 15). Drivers by points: if/else 27 (35 pts), boolean chains 1, loops 1 (nesting depth added 8). Of this number, 36 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · workflowpackage.InspectArchive (cognitive 37) · ×1
  • workflowpackage.InspectArchive (cognitive 37) internal/workflow/package/inspector.go:57 — workflowpackage.InspectArchive has cognitive complexity 37 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 11, loops 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.
D2 · Cognitive Complexity · renderRbacRoles (cognitive 37) · ×1
  • renderRbacRoles (cognitive 37) web/static/js/rbac.js:659 — renderRbacRoles has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 10 (19 pts), if/else 11 (13 pts), boolean chains 5 (nesting depth added 11). Of this number, 29 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · main.main (cognitive 36) · ×1
  • main.main (cognitive 36) cmd/server/main.go:24 — main.main has cognitive complexity 36 (threshold 15). Drivers by points: if/else 26 (31 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DB.UpsertAssets (cognitive 36) · ×1
  • DB.UpsertAssets (cognitive 36) internal/database/asset.go:306 — DB.UpsertAssets has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (31 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · RoleHandler.UpdateRole (cognitive 36) · ×1
  • RoleHandler.UpdateRole (cognitive 36) REDACTED:96 — RoleHandler.UpdateRole has cognitive complexity 36 (threshold 15). Drivers by points: if/else 20 (34 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.
D2 · Cognitive Complexity · Retriever.vectorSearch (cognitive 36) · ×1
  • Retriever.vectorSearch (cognitive 36) internal/knowledge/retriever.go:188 — Retriever.vectorSearch has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (24 pts), boolean chains 6, loops 3, match/switch 1 (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.
D2 · Cognitive Complexity · SQLiteIndexer.Store (cognitive 36) · ×1
  • SQLiteIndexer.Store (cognitive 36) internal/knowledge/sqlite_indexer.go:34 — SQLiteIndexer.Store has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (28 pts), loops 6 (7 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · robot.runTelegramPoll (cognitive 36) · ×1
  • robot.runTelegramPoll (cognitive 36) internal/robot/telegram.go:96 — robot.runTelegramPoll has cognitive complexity 36 (threshold 15). Drivers by points: if/else 11 (29 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleJson.extractObjectArray (cognitive 36) · ×1
  • SimpleJson.extractObjectArray (cognitive 36) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SimpleJson.java:98 — SimpleJson.extractObjectArray has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (29 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.
D2 · Cognitive Complexity · i18n.applyTranslations (cognitive 36) · ×1
  • i18n.applyTranslations (cognitive 36) web/static/js/i18n.js:75 — i18n.applyTranslations has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 13, error handling 3, ternaries 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 19 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tasks.showBatchImportModal (cognitive 36) · ×1
  • tasks.showBatchImportModal (cognitive 36) web/static/js/tasks.js:898 — tasks.showBatchImportModal has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 5, error handling 1 (3 pts) (nesting depth added 17). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · testOpenAIConnection (cognitive 36) · ×1
  • testOpenAIConnection (cognitive 36) web/static/js/settings.js:4072 — testOpenAIConnection has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 11, ternaries 5 (10 pts), error handling 1 (nesting depth added 9). Of this number, 34 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderWebshellList (cognitive 36) · ×1
  • renderWebshellList (cognitive 36) web/static/js/webshell.js:1142 — renderWebshellList has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 22, if/else 9, ternaries 4 (5 pts) (nesting depth added 1). Most of this is not in the body itself: 7 of the 36 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 1168, 1155, 1211, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadWebshellAiHistory (cognitive 36) · ×1
  • loadWebshellAiHistory (cognitive 36) web/static/js/webshell.js:3325 — loadWebshellAiHistory has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 8, ternaries 4 (6 pts), error handling 2 (3 pts) (nesting depth added 8). Most of this is not in the body itself: 4 of the 36 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 3341, 3330, 3335, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderWorkflowPackageResolution (cognitive 36) · ×1
  • renderWorkflowPackageResolution (cognitive 36) web/static/js/workflows.js:2690 — renderWorkflowPackageResolution has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (23 pts), ternaries 4 (7 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.UpdateAssetsBulk (cognitive 35) · ×1
  • DB.UpdateAssetsBulk (cognitive 35) internal/database/asset.go:961 — DB.UpdateAssetsBulk has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (28 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.ListConversationPlanTasksSince (cognitive 35) · ×1
  • DB.ListConversationPlanTasksSince (cognitive 35) internal/database/plantask.go:41 — DB.ListConversationPlanTasksSince has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (31 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · DB.BootstrapRBAC (cognitive 35) · ×1
  • DB.BootstrapRBAC (cognitive 35) REDACTED:114 — DB.BootstrapRBAC has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.RunRoleBoundWorkflow (cognitive 35) · ×1
  • workflow.RunRoleBoundWorkflow (cognitive 35) internal/workflow/runner.go:28 — workflow.RunRoleBoundWorkflow has cognitive complexity 35 (threshold 15). Drivers by points: if/else 21 (33 pts), loops 1, 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.
D2 · Cognitive Complexity · monitor.renderMonitorStats (cognitive 35) · ×1
  • monitor.renderMonitorStats (cognitive 35) web/static/js/monitor.js:8976 — monitor.renderMonitorStats has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 13, ternaries 11 (12 pts), if/else 8 (10 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · workflows.readTypedConfig (cognitive 35) · ×1
  • workflows.readTypedConfig (cognitive 35) web/static/js/workflows.js:1175 — workflows.readTypedConfig has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 30, if/else 3 (4 pts), match/switch 1 (nesting depth added 1). 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.
D2 · Cognitive Complexity · showConversationContextMenu (cognitive 35) · ×1
  • showConversationContextMenu (cognitive 35) web/static/js/chat.js:10343 — showConversationContextMenu has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (23 pts), ternaries 3 (10 pts), boolean chains 2 (nesting depth added 13). Of this number, 32 points are the body's own statements and 3 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.
D2 · Cognitive Complexity · showProjectFactGraphNode (cognitive 35) · ×1
  • showProjectFactGraphNode (cognitive 35) web/static/js/projects.js:1360 — showProjectFactGraphNode has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 12, ternaries 5 (8 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.
D2 · Cognitive Complexity · loadVulnerabilities (cognitive 35) · ×1
  • loadVulnerabilities (cognitive 35) web/static/js/vulnerability.js:1274 — loadVulnerabilities has cognitive complexity 35 (threshold 15). Drivers by points: if/else 16 (19 pts), boolean chains 9, ternaries 5 (6 pts), error handling 1 (nesting depth added 4). Of this number, 33 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AgentHandler.runRoleWorkflowStreamIfBound (cognitive 34) · ×1
  • AgentHandler.runRoleWorkflowStreamIfBound (cognitive 34) internal/handler/workflow_integration.go:58 — AgentHandler.runRoleWorkflowStreamIfBound has cognitive complexity 34 (threshold 15). Drivers by points: if/else 19 (31 pts), boolean chains 2, loops 1 (nesting depth added 12). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectHandler.UpdateFact (cognitive 34) · ×1
  • ProjectHandler.UpdateFact (cognitive 34) internal/handler/project.go:465 — ProjectHandler.UpdateFact has cognitive complexity 34 (threshold 15). Drivers by points: if/else 21 (28 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · multiagent.resolveMainOrchestratorInstruction (cognitive 34) · ×1
  • multiagent.resolveMainOrchestratorInstruction (cognitive 34) internal/multiagent/orchestrator_instruction.go:26 — multiagent.resolveMainOrchestratorInstruction has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (30 pts), boolean chains 3, match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.streamCommandOutput (cognitive 34) · ×1
  • security.streamCommandOutput (cognitive 34) internal/security/executor.go:1127 — security.streamCommandOutput has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (23 pts), match/switch 3 (6 pts), boolean chains 2, loops 2, jumps 1 (nesting depth added 12). Of this number, 22 points are the body's own statements and 12 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.
D2 · Cognitive Complexity · api.streamTest (cognitive 34) · ×1
  • api.streamTest (cognitive 34) plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:113 — api.streamTest has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 5, error handling 1 (3 pts), loops 2 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · api-docs.formatDescription (cognitive 34) · ×1
  • api-docs.formatDescription (cognitive 34) web/static/js/api-docs.js:862 — api-docs.formatDescription has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (29 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 15). Of this number, 33 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.pollExternalMCPStatus (cognitive 34) · ×1
  • settings.pollExternalMCPStatus (cognitive 34) web/static/js/settings.js:5000 — settings.pollExternalMCPStatus has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (20 pts), ternaries 2 (6 pts), boolean chains 5, error handling 1 (2 pts), loops 1 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · refreshHitlPending (cognitive 34) · ×1
  • refreshHitlPending (cognitive 34) web/static/js/hitl.js:893 — refreshHitlPending has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 13, if/else 9, ternaries 6 (8 pts), error handling 3 (4 pts) (nesting depth added 3). Of this number, 26 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · renderMonitorPagination (cognitive 34) · ×1
  • renderMonitorPagination (cognitive 34) web/static/js/monitor.js:9265 — renderMonitorPagination has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 17, boolean chains 14, if/else 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.
D2 · Cognitive Complexity · watchdogProbe (cognitive 34) · ×1
  • watchdogProbe (cognitive 34) web/static/js/update.js:290 — watchdogProbe has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 19, if/else 8, ternaries 2 (4 pts), error handling 2 (3 pts) (nesting depth added 3). 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.
D2 · Cognitive Complexity · renderTypedConfig (cognitive 34) · ×1
  • renderTypedConfig (cognitive 34) web/static/js/workflows.js:1043 — renderTypedConfig has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 10 (19 pts), boolean chains 7, if/else 4 (7 pts), match/switch 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.Load (cognitive 33) · ×1
  • config.Load (cognitive 33) internal/config/config.go:1546 — config.Load has cognitive complexity 33 (threshold 15). Drivers by points: if/else 22 (30 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetAssetStats (cognitive 33) · ×1
  • DB.GetAssetStats (cognitive 33) internal/database/asset.go:1241 — DB.GetAssetStats has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (26 pts), loops 5, 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.
D2 · Cognitive Complexity · ConfigHandler.resolveProbeHeaders (cognitive 33) · ×1
  • ConfigHandler.resolveProbeHeaders (cognitive 33) internal/handler/config_probe_headers.go:12 — ConfigHandler.resolveProbeHeaders has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 3 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MarkdownAgentsHandler.CreateMarkdownAgent (cognitive 33) · ×1
  • MarkdownAgentsHandler.CreateMarkdownAgent (cognitive 33) internal/handler/markdown_agents.go:156 — MarkdownAgentsHandler.CreateMarkdownAgent has cognitive complexity 33 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · knowledge.RegisterKnowledgeTool (cognitive 33) · ×1
  • knowledge.RegisterKnowledgeTool (cognitive 33) internal/knowledge/tool.go:17 — knowledge.RegisterKnowledgeTool has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 5 (8 pts), boolean chains 2 (nesting depth added 12). None of this is in the body itself: all 33 points belong to 2 function literals inside it that branch (lines 102, 35). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ExecutionService.finishEntry (cognitive 33) · ×1
  • ExecutionService.finishEntry (cognitive 33) internal/mcp/execution_service.go:266 — ExecutionService.finishEntry has cognitive complexity 33 (threshold 15). Drivers by points: if/else 19 (25 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ExternalMCPManager.CallTool (cognitive 33) · ×1
  • ExternalMCPManager.CallTool (cognitive 33) internal/mcp/external_manager.go:698 — ExternalMCPManager.CallTool has cognitive complexity 33 (threshold 15). Drivers by points: if/else 25 (29 pts), boolean chains 4 (nesting depth added 4). Most of this is not in the body itself: 9 of the 33 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 723, 789, 777, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · worker.importHistory (cognitive 33) · ×1
  • worker.importHistory (cognitive 33) runtime/pi/src/worker.ts:85 — worker.importHistory has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (21 pts), error handling 1 (5 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · info-collect.initInfoCollectPage (cognitive 33) · ×1
  • info-collect.initInfoCollectPage (cognitive 33) web/static/js/info-collect.js:250 — info-collect.initInfoCollectPage has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 11, error handling 1 (nesting depth added 7). Of this number, 24 points are the body's own statements and 9 belong to 3 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.
D2 · Cognitive Complexity · monitor.renderMcpStatsInsightPanel (cognitive 33) · ×1
  • monitor.renderMcpStatsInsightPanel (cognitive 33) web/static/js/monitor.js:8487 — monitor.renderMcpStatsInsightPanel has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 17 (19 pts), boolean chains 11, if/else 2 (3 pts) (nesting depth added 3). Most of this is not in the body itself: 14 of the 33 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8499, 8519, 8494). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderTestSection (cognitive 33) · ×1
  • renderTestSection (cognitive 33) web/static/js/api-docs.js:520 — renderTestSection has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 8 (18 pts), boolean chains 9, if/else 5 (6 pts) (nesting depth added 11). Most of this is not in the body itself: 12 of the 33 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 568, 533, 553, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · copyCurlCommand (cognitive 33) · ×1
  • copyCurlCommand (cognitive 33) web/static/js/api-docs.js:737 — copyCurlCommand has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 7, error handling 4 (7 pts), ternaries 2 (3 pts) (nesting depth added 7). Of this number, 20 points are the body's own statements and 13 belong to 7 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · initChatAgentModeFromConfig (cognitive 33) · ×1
  • initChatAgentModeFromConfig (cognitive 33) web/static/js/chat.js:2059 — initChatAgentModeFromConfig has cognitive complexity 33 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 11, ternaries 3 (4 pts), error handling 2 (nesting depth added 4). Of this number, 25 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · syncHitlConfigFromServer (cognitive 33) · ×1
  • syncHitlConfigFromServer (cognitive 33) web/static/js/hitl.js:586 — syncHitlConfigFromServer has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 6 (9 pts), boolean chains 7, error handling 3 (7 pts) (nesting depth added 8). Of this number, 32 points are the body's own statements and 1 belongs to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · updateProcessDetailsPaginationButtons (cognitive 33) · ×1
  • updateProcessDetailsPaginationButtons (cognitive 33) web/static/js/monitor.js:2039 — updateProcessDetailsPaginationButtons has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (21 pts), ternaries 4 (8 pts), boolean chains 4 (nesting depth added 11). Of this number, 26 points are the body's own statements and 7 belong to 6 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.
D2 · Cognitive Complexity · renderActiveTasks (cognitive 33) · ×1
  • renderActiveTasks (cognitive 33) web/static/js/monitor.js:7091 — renderActiveTasks has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (17 pts), ternaries 7 (11 pts), boolean chains 5 (nesting depth added 7). Most of this is not in the body itself: 7 of the 33 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 7146, openActiveTaskConversation, (anonymous)::_t, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · openNotificationTarget (cognitive 33) · ×1
  • openNotificationTarget (cognitive 33) web/static/js/notifications.js:136 — openNotificationTarget has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 8, error handling 2 (6 pts) (nesting depth added 9). Of this number, 18 points are the body's own statements and 15 belong to 5 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · attackchain.PromoteToProject (cognitive 32) · ×1
  • attackchain.PromoteToProject (cognitive 32) internal/attackchain/promote_project.go:26 — attackchain.PromoteToProject has cognitive complexity 32 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 4, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.AssignResourcesToUserAuto (cognitive 32) · ×1
  • DB.AssignResourcesToUserAuto (cognitive 32) REDACTED:898 — DB.AssignResourcesToUserAuto has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 4 (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.
D2 · Cognitive Complexity · ChatUploadsHandler.Download (cognitive 32) · ×1
  • ChatUploadsHandler.Download (cognitive 32) REDACTED:980 — ChatUploadsHandler.Download has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.GetItemsSummary (cognitive 32) · ×1
  • Manager.GetItemsSummary (cognitive 32) internal/knowledge/manager.go:454 — Manager.GetItemsSummary has cognitive complexity 32 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (7 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.
D2 · Cognitive Complexity · MarkdownRenderer.toHtml (cognitive 32) · ×1
  • MarkdownRenderer.toHtml (cognitive 32) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/MarkdownRenderer.java:16 — MarkdownRenderer.toHtml has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · markdown.markdownToHtml (cognitive 32) · ×1
  • markdown.markdownToHtml (cognitive 32) plugins/browser-extension/cyberstrikeai-browser-extension/lib/markdown.js:68 — markdown.markdownToHtml has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (27 pts), boolean chains 2, ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat.renderProcessDetails · ×1
  • chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage (cognitive 32) web/static/js/chat.js:4261 — chat.renderProcessDetails::formatProcessDetailPiRunRetryMessage has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 7 (13 pts), boolean chains 12, if/else 6 (7 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.
D2 · Cognitive Complexity · chat.showNodeDetails (cognitive 32) · ×1
  • chat.showNodeDetails (cognitive 32) web/static/js/chat.js:7961 — chat.showNodeDetails has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 6 (nesting depth added 9). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.pruneLiveTimelineIfNeeded (cognitive 32) · ×1
  • monitor.pruneLiveTimelineIfNeeded (cognitive 32) web/static/js/monitor.js:6583 — monitor.pruneLiveTimelineIfNeeded has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 12, loops 1, ternaries 1 (nesting depth added 9). Of this number, 30 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · syncAssistantTurnSummary (cognitive 32) · ×1
  • syncAssistantTurnSummary (cognitive 32) web/static/js/chat.js:5150 — syncAssistantTurnSummary has cognitive complexity 32 (threshold 15). Drivers by points: ternaries 12 (19 pts), if/else 8, boolean chains 5 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fetchModelList (cognitive 32) · ×1
  • fetchModelList (cognitive 32) web/static/js/settings.js:3618 — fetchModelList has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (18 pts), ternaries 4 (7 pts), boolean chains 6, error handling 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · saveToolsConfig (cognitive 32) · ×1
  • saveToolsConfig (cognitive 32) web/static/js/settings.js:4159 — saveToolsConfig has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 10, if/else 8 (10 pts), ternaries 5 (9 pts), error handling 2, loops 1 (nesting depth added 6). Of this number, 23 points are the body's own statements and 9 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentruntime.preparePiRuntime (cognitive 31) · ×1
  • agentruntime.preparePiRuntime (cognitive 31) internal/agentruntime/build.go:65 — agentruntime.preparePiRuntime has cognitive complexity 31 (threshold 15). Drivers by points: if/else 20 (29 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.
D2 · Cognitive Complexity · app.registerAssetTools (cognitive 31) · ×1
  • app.registerAssetTools (cognitive 31) internal/app/asset_tools.go:21 — app.registerAssetTools has cognitive complexity 31 (threshold 15). Drivers by points: if/else 25 (27 pts), boolean chains 3, loops 1 (nesting depth added 2). Most of this is not in the body itself: 2 of the 31 points are its own statements and the rest belongs to 6 function literals inside it that branch (lines 83, 33, 61, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · handler.saveAttachmentsToDateAndConversationDir (cognitive 31) · ×1
  • handler.saveAttachmentsToDateAndConversationDir (cognitive 31) internal/handler/agent.go:562 — handler.saveAttachmentsToDateAndConversationDir has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 1, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.updateAIConfig (cognitive 31) · ×1
  • handler.updateAIConfig (cognitive 31) internal/handler/config.go:2309 — handler.updateAIConfig has cognitive complexity 31 (threshold 15). Drivers by points: if/else 16 (29 pts), loops 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.
D2 · Cognitive Complexity · BatchTaskManager.loadQueueFromDB (cognitive 31) · ×1
  • BatchTaskManager.loadQueueFromDB (cognitive 31) internal/handler/batch_task_manager.go:302 — BatchTaskManager.loadQueueFromDB has cognitive complexity 31 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 4, loops 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.
D2 · Cognitive Complexity · SkillsHandler.GetSkills (cognitive 31) · ×1
  • SkillsHandler.GetSkills (cognitive 31) internal/handler/skills.go:62 — SkillsHandler.GetSkills has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · nativeMultiQuery.Retrieve (cognitive 31) · ×1
  • nativeMultiQuery.Retrieve (cognitive 31) internal/knowledge/wire_retriever.go:59 — nativeMultiQuery.Retrieve has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (22 pts), loops 4 (7 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.
D2 · Cognitive Complexity · robot.SendProactive (cognitive 31) · ×1
  • robot.SendProactive (cognitive 31) internal/robot/proactive.go:25 — robot.SendProactive has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.findStandaloneAmpersandPositions (cognitive 31) · ×1
  • security.findStandaloneAmpersandPositions (cognitive 31) internal/security/shell_background_io.go:8 — security.findStandaloneAmpersandPositions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 7, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.GenerateDraftFromNaturalLanguage (cognitive 31) · ×1
  • workflow.GenerateDraftFromNaturalLanguage (cognitive 31) internal/workflow/draft_generator.go:95 — workflow.GenerateDraftFromNaturalLanguage has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat.initializeChatUI (cognitive 31) · ×1
  • chat.initializeChatUI (cognitive 31) web/static/js/chat.js:3315 — chat.initializeChatUI has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (27 pts), boolean chains 4 (nesting depth added 17). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · integrateProgressToMCPSection (cognitive 31) · ×1
  • integrateProgressToMCPSection (cognitive 31) web/static/js/monitor.js:1726 — integrateProgressToMCPSection has cognitive complexity 31 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 5 (8 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.
D2 · Cognitive Complexity · resolveInlineHitlDecision (cognitive 31) · ×1
  • resolveInlineHitlDecision (cognitive 31) web/static/js/monitor.js:4529 — resolveInlineHitlDecision has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (11 pts) (nesting depth added 2). 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.
D2 · Cognitive Complexity · toggleExternalMCP (cognitive 31) · ×1
  • toggleExternalMCP (cognitive 31) web/static/js/settings.js:4918 — toggleExternalMCP has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 6, error handling 2 (3 pts), ternaries 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.
D2 · Cognitive Complexity · createBatchQueue (cognitive 31) · ×1
  • createBatchQueue (cognitive 31) web/static/js/tasks.js:1020 — createBatchQueue has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 10, boolean chains 9, if/else 9, error handling 2 (3 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · agents.LoadMarkdownAgentsDir (cognitive 30) · ×1
  • agents.LoadMarkdownAgentsDir (cognitive 30) internal/agents/markdown.go:328 — agents.LoadMarkdownAgentsDir has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (27 pts), match/switch 1 (2 pts), 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.
D2 · Cognitive Complexity · App.RunWithContext (cognitive 30) · ×1
  • App.RunWithContext (cognitive 30) REDACTED:715 — App.RunWithContext has cognitive complexity 30 (threshold 15). Drivers by points: if/else 16 (24 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 9). Of this number, 20 points are the body's own statements and 10 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Builder.formatProcessDetailsForAttackChain (cognitive 30) · ×1
  • Builder.formatProcessDetailsForAttackChain (cognitive 30) internal/attackchain/builder.go:312 — Builder.formatProcessDetailsForAttackChain has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (24 pts), boolean chains 5, loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatUploadsHandler.collectReductionFiles (cognitive 30) · ×1
  • ChatUploadsHandler.collectReductionFiles (cognitive 30) REDACTED:459 — ChatUploadsHandler.collectReductionFiles has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 5, loops 1 (nesting depth added 11). Most of this is not in the body itself: 4 of the 30 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.
D2 · Cognitive Complexity · update.validateRollbackEvidence (cognitive 30) · ×1
  • update.validateRollbackEvidence (cognitive 30) internal/update/recovery_evidence.go:217 — update.validateRollbackEvidence has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 10 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.finishRollback (cognitive 30) · ×1
  • update.finishRollback (cognitive 30) internal/update/rollback_pending.go:60 — update.finishRollback has cognitive complexity 30 (threshold 15). Drivers by points: if/else 15 (24 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · audit-datetime-picker.ensurePopover (cognitive 30) · ×1
  • audit-datetime-picker.ensurePopover (cognitive 30) web/static/js/audit-datetime-picker.js:116 — audit-datetime-picker.ensurePopover has cognitive complexity 30 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 3 (nesting depth added 9). Most of this is not in the body itself: 1 of the 30 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 150, 208). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · chat-files.deleteChatFolderFromBrowse (cognitive 30) · ×1
  • chat-files.deleteChatFolderFromBrowse (cognitive 30) web/static/js/chat-files.js:1377 — chat-files.deleteChatFolderFromBrowse has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (7 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 14). 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.
D2 · Cognitive Complexity · chat.fetchMentionTools (cognitive 30) · ×1
  • chat.fetchMentionTools (cognitive 30) web/static/js/chat.js:2850 — chat.fetchMentionTools has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 11, ternaries 2 (3 pts), error handling 2, loops 1 (nesting depth added 7). Of this number, 20 points are the body's own statements and 10 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.formatPiRunRetryMessage (cognitive 30) · ×1
  • monitor.formatPiRunRetryMessage (cognitive 30) web/static/js/monitor.js:2729 — monitor.formatPiRunRetryMessage has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 7 (12 pts), boolean chains 11, if/else 6 (7 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.
D2 · Cognitive Complexity · roles.loadRoleTools (cognitive 30) · ×1
  • roles.loadRoleTools (cognitive 30) web/static/js/roles.js:827 — roles.loadRoleTools has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 10, error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · settings.resolveModelListCredentials (cognitive 30) · ×1
  • settings.resolveModelListCredentials (cognitive 30) web/static/js/settings.js:3443 — settings.resolveModelListCredentials has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 27, if/else 3. 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.
D2 · Cognitive Complexity · webshell.buildWebshellDbCommand (cognitive 30) · ×1
  • webshell.buildWebshellDbCommand (cognitive 30) web/static/js/webshell.js:1872 — webshell.buildWebshellDbCommand has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 21, if/else 6, ternaries 2 (3 pts) (nesting depth added 1). 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.
D2 · Cognitive Complexity · testAPI (cognitive 30) · ×1
  • testAPI (cognitive 30) web/static/js/api-docs.js:629 — testAPI has cognitive complexity 30 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 7, error handling 3 (5 pts), ternaries 3 (4 pts) (nesting depth added 5). Of this number, 22 points are the body's own statements and 8 belong to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · exportChatFiles (cognitive 30) · ×1
  • exportChatFiles (cognitive 30) web/static/js/chat-files.js:435 — exportChatFiles has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (11 pts), if/else 8 (10 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · applyHitlSidebarConfig (cognitive 30) · ×1
  • applyHitlSidebarConfig (cognitive 30) web/static/js/chat.js:740 — applyHitlSidebarConfig has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 9 (10 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · cancelMCPToolExecutionSubmit (cognitive 30) · ×1
  • cancelMCPToolExecutionSubmit (cognitive 30) web/static/js/chat.js:5781 — cancelMCPToolExecutionSubmit has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 10, if/else 8 (10 pts), ternaries 4 (7 pts), error handling 2 (3 pts) (nesting depth added 6). Of this number, 29 points are the body's own statements and 1 belongs to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · syncVisibleConversationTaskReplay (cognitive 30) · ×1
  • syncVisibleConversationTaskReplay (cognitive 30) web/static/js/monitor.js:6979 — syncVisibleConversationTaskReplay has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (13 pts), ternaries 2, error handling 1 (nesting depth added 2). Of this number, 15 points are the body's own statements and 15 belong to 4 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · renderRolesList (cognitive 30) · ×1
  • renderRolesList (cognitive 30) web/static/js/roles.js:581 — renderRolesList has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 7, ternaries 5 (7 pts), error handling 1 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 605, 589, 632). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · webshellAiConvListSelect (cognitive 30) · ×1
  • webshellAiConvListSelect (cognitive 30) web/static/js/webshell.js:2392 — webshellAiConvListSelect has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 9, ternaries 2 (3 pts), error handling 1 (nesting depth added 5). Most of this is not in the body itself: 5 of the 30 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 2405, 2401, 2395, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Embedder.EmbedStrings (cognitive 29) · ×1
  • Embedder.EmbedStrings (cognitive 29) internal/knowledge/embedder.go:142 — Embedder.EmbedStrings has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 3 (8 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.SearchItemsByKeyword (cognitive 29) · ×1
  • Manager.SearchItemsByKeyword (cognitive 29) internal/knowledge/manager.go:369 — Manager.SearchItemsByKeyword has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (7 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.
D2 · Cognitive Complexity · webshell.parseWebshellDbSchema (cognitive 29) · ×1
  • webshell.parseWebshellDbSchema (cognitive 29) web/static/js/webshell.js:1979 — webshell.parseWebshellDbSchema has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 9, ternaries 3 (5 pts), loops 1 (nesting depth added 7). Of this number, 26 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · exportAttackChain (cognitive 29) · ×1
  • exportAttackChain (cognitive 29) web/static/js/chat.js:9074 — exportAttackChain has cognitive complexity 29 (threshold 15). Drivers by points: error handling 4 (10 pts), if/else 7 (9 pts), boolean chains 8, ternaries 1 (2 pts) (nesting depth added 9). Most of this is not in the body itself: 3 of the 29 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 9081, 9093, 9100, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · toggleProcessDetails (cognitive 29) · ×1
  • toggleProcessDetails (cognitive 29) web/static/js/monitor.js:2575 — toggleProcessDetails has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (16 pts), ternaries 4 (7 pts), boolean chains 6 (nesting depth added 5). Of this number, 26 points are the body's own statements and 3 belong to 3 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · updateRoleSelectorDisplay (cognitive 29) · ×1
  • updateRoleSelectorDisplay (cognitive 29) web/static/js/roles.js:346 — updateRoleSelectorDisplay has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 4 (8 pts), boolean chains 7, error handling 1 (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.
D2 · Cognitive Complexity · testVisionConnection (cognitive 29) · ×1
  • testVisionConnection (cognitive 29) web/static/js/settings.js:3716 — testVisionConnection has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 7 (15 pts), boolean chains 7, if/else 5 (6 pts), error handling 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderBatchQueues (cognitive 29) · ×1
  • renderBatchQueues (cognitive 29) web/static/js/tasks.js:1572 — renderBatchQueues has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 10, boolean chains 8 (nesting depth added 1). Most of this is not in the body itself: 6 of the 29 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1594, 1607, 1633). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · updateControls (cognitive 29) · ×1
  • updateControls (cognitive 29) web/static/js/tool-guard.js:29 — updateControls has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10, ternaries 5 (10 pts), boolean chains 9 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.WriteVersion (cognitive 28) · ×1
  • config.WriteVersion (cognitive 28) internal/config/config.go:1754 — config.WriteVersion has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · database.grantSystemRolePermissions (cognitive 28) · ×1
  • database.grantSystemRolePermissions (cognitive 28) REDACTED:210 — database.grantSystemRolePermissions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 6 (17 pts), loops 3 (7 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchTaskManager.PrepareSingleTaskRun (cognitive 28) · ×1
  • BatchTaskManager.PrepareSingleTaskRun (cognitive 28) internal/handler/batch_task_manager.go:993 — BatchTaskManager.PrepareSingleTaskRun has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 5 (6 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.
D2 · Cognitive Complexity · ChatUploadsHandler.collectWorkspaceFiles (cognitive 28) · ×1
  • ChatUploadsHandler.collectWorkspaceFiles (cognitive 28) REDACTED:535 — ChatUploadsHandler.collectWorkspaceFiles has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 5, loops 1 (nesting depth added 10). Most of this is not in the body itself: 4 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 549). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · HITLManager.reconcileRestartInterruptedMessages (cognitive 28) · ×1
  • HITLManager.reconcileRestartInterruptedMessages (cognitive 28) internal/handler/hitl.go:93 — HITLManager.reconcileRestartInterruptedMessages has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 2, loops 2, match/switch 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.
D2 · Cognitive Complexity · WorkflowHandler.save (cognitive 28) · ×1
  • WorkflowHandler.save (cognitive 28) REDACTED:211 — WorkflowHandler.save has cognitive complexity 28 (threshold 15). Drivers by points: if/else 20 (25 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Executor.parseAdditionalArgs (cognitive 28) · ×1
  • Executor.parseAdditionalArgs (cognitive 28) internal/security/executor.go:627 — Executor.parseAdditionalArgs has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 7, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Executor.executeSystemCommand (cognitive 28) · ×1
  • Executor.executeSystemCommand (cognitive 28) internal/security/executor.go:773 — Executor.executeSystemCommand has cognitive complexity 28 (threshold 15). Drivers by points: if/else 15 (22 pts), boolean chains 6 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.restoreInterruptedProtected (cognitive 28) · ×1
  • update.restoreInterruptedProtected (cognitive 28) internal/update/apply.go:837 — update.restoreInterruptedProtected has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 3, loops 2 (3 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.
D2 · Cognitive Complexity · webshell.webshellDbRenderTable (cognitive 28) · ×1
  • webshell.webshellDbRenderTable (cognitive 28) web/static/js/webshell.js:1800 — webshell.webshellDbRenderTable has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 8, ternaries 2 (3 pts), loops 2 (nesting depth added 3). Of this number, 20 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · webshell.parseWebshellDbColumns (cognitive 28) · ×1
  • webshell.parseWebshellDbColumns (cognitive 28) web/static/js/webshell.js:2010 — webshell.parseWebshellDbColumns has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 9, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 7). Of this number, 25 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · openAssetEditor (cognitive 28) · ×1
  • openAssetEditor (cognitive 28) REDACTED:1295 — openAssetEditor has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 21, ternaries 5, if/else 2. 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.
D2 · Cognitive Complexity · loadChatFilesPage (cognitive 28) · ×1
  • loadChatFilesPage (cognitive 28) web/static/js/chat-files.js:364 — loadChatFilesPage has cognitive complexity 28 (threshold 15). Drivers by points: if/else 11, ternaries 10 (11 pts), boolean chains 5, error handling 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · hydrateConversationTokenUsage (cognitive 28) · ×1
  • hydrateConversationTokenUsage (cognitive 28) web/static/js/chat.js:6344 — hydrateConversationTokenUsage has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 12, if/else 10, ternaries 5, error handling 1. Of this number, 18 points are the body's own statements and 10 belong to 3 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · batchScanSelectedFofaRows (cognitive 28) · ×1
  • batchScanSelectedFofaRows (cognitive 28) web/static/js/info-collect.js:1576 — batchScanSelectedFofaRows has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12, boolean chains 8, error handling 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 2). Of this number, 24 points are the body's own statements and 4 belong to 4 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderMcpStatsToolTable (cognitive 28) · ×1
  • renderMcpStatsToolTable (cognitive 28) web/static/js/monitor.js:8755 — renderMcpStatsToolTable has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 15, ternaries 13. Most of this is not in the body itself: 5 of the 28 points are its own statements and the rest belongs to one function literal inside it that branches (line 8763). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · detectAIContext (cognitive 28) · ×1
  • detectAIContext (cognitive 28) web/static/js/settings.js:4007 — detectAIContext has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 13, if/else 10 (13 pts), error handling 2 (nesting depth added 3). Of this number, 27 points are the body's own statements and 1 belongs to 2 function items 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.
D2 · Cognitive Complexity · selectSkillPackageFile (cognitive 28) · ×1
  • selectSkillPackageFile (cognitive 28) web/static/js/skills.js:550 — selectSkillPackageFile has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 4 (7 pts), boolean chains 5, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · pollUpdateJob (cognitive 28) · ×1
  • pollUpdateJob (cognitive 28) web/static/js/update.js:358 — pollUpdateJob has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflowAiRenderResult (cognitive 28) · ×1
  • workflowAiRenderResult (cognitive 28) web/static/js/workflows.js:1722 — workflowAiRenderResult has cognitive complexity 28 (threshold 15). Drivers by points: ternaries 14, boolean chains 9, if/else 4 (5 pts) (nesting depth added 1). Of this number, 26 points are the body's own statements and 2 belong to 6 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · app.assetFilterFromToolArgs (cognitive 27) · ×1
  • app.assetFilterFromToolArgs (cognitive 27) internal/app/asset_tools.go:287 — app.assetFilterFromToolArgs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (24 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.
D2 · Cognitive Complexity · database.validateAsset (cognitive 27) · ×1
  • database.validateAsset (cognitive 27) internal/database/asset.go:194 — database.validateAsset has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 7, 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.
D2 · Cognitive Complexity · DB.GetConversationByWebshellConnectionID (cognitive 27) · ×1
  • DB.GetConversationByWebshellConnectionID (cognitive 27) REDACTED:111 — DB.GetConversationByWebshellConnectionID has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetConversation (cognitive 27) · ×1
  • DB.GetConversation (cognitive 27) REDACTED:240 — DB.GetConversation has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (23 pts), loops 2 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetMessages (cognitive 27) · ×1
  • DB.GetMessages (cognitive 27) REDACTED:1002 — DB.GetMessages has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (24 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.
D2 · Cognitive Complexity · handler.batchMCPTasksFromArgs (cognitive 27) · ×1
  • handler.batchMCPTasksFromArgs (cognitive 27) internal/handler/batch_task_mcp.go:783 — handler.batchMCPTasksFromArgs has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 2 (5 pts), match/switch 1 (2 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.
D2 · Cognitive Complexity · AgentHandler.handleBatchSubTaskRunError (cognitive 27) · ×1
  • AgentHandler.handleBatchSubTaskRunError (cognitive 27) internal/handler/batch_queue_executor.go:366 — AgentHandler.handleBatchSubTaskRunError has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FofaHandler.Search (cognitive 27) · ×1
  • FofaHandler.Search (cognitive 27) REDACTED:578 — FofaHandler.Search has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (23 pts), loops 2 (3 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.
D2 · Cognitive Complexity · WechatRobotHandler.HandleWechatQRCodeStatus (cognitive 27) · ×1
  • WechatRobotHandler.HandleWechatQRCodeStatus (cognitive 27) internal/handler/wechat_robot.go:141 — WechatRobotHandler.HandleWechatQRCodeStatus has cognitive complexity 27 (threshold 15). Drivers by points: if/else 15 (25 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.
D2 · Cognitive Complexity · robot.runWechatPoll (cognitive 27) · ×1
  • robot.runWechatPoll (cognitive 27) internal/robot/wechat.go:54 — robot.runWechatPoll has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.stashProtected (cognitive 27) · ×1
  • update.stashProtected (cognitive 27) internal/update/apply.go:680 — update.stashProtected has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (21 pts), loops 4, boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.validateBuildEvidence (cognitive 27) · ×1
  • update.validateBuildEvidence (cognitive 27) internal/update/recovery_evidence.go:143 — update.validateBuildEvidence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 12, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.normalizeLLMDraft (cognitive 27) · ×1
  • workflow.normalizeLLMDraft (cognitive 27) internal/workflow/draft_generator.go:419 — workflow.normalizeLLMDraft has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 4, loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CyberStrikeAIClient.streamTest (cognitive 27) · ×1
  • CyberStrikeAIClient.streamTest (cognitive 27) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAIClient.java:301 — CyberStrikeAIClient.streamTest has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (20 pts), ternaries 3, boolean chains 2, error handling 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SimpleJson.extractStringField (cognitive 27) · ×1
  • SimpleJson.extractStringField (cognitive 27) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/SimpleJson.java:26 — SimpleJson.extractStringField has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (14 pts), error handling 1 (5 pts), boolean chains 3, match/switch 1 (3 pts), loops 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.
D2 · Cognitive Complexity · audit.auditResourceLink (cognitive 27) · ×1
  • audit.auditResourceLink (cognitive 27) web/static/js/audit.js:543 — audit.auditResourceLink has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10, boolean chains 9, ternaries 4 (8 pts) (nesting depth added 4). Of this number, 26 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · knowledge.formatTime (cognitive 27) · ×1
  • knowledge.formatTime (cognitive 27) REDACTED:2031 — knowledge.formatTime has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 4 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mobile-ui.filterNav (cognitive 27) · ×1
  • mobile-ui.filterNav (cognitive 27) web/static/js/mobile-ui.js:535 — mobile-ui.filterNav has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts), loops 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 27 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 541, 550, 583, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · monitor._normalizeEmphasisMarkersForMarkdown · ×1
  • monitor._normalizeEmphasisMarkersForMarkdown::normalizeLine (cognitive 27) web/static/js/monitor.js:766 — monitor._normalizeEmphasisMarkersForMarkdown::normalizeLine has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 3 (4 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.
D2 · Cognitive Complexity · settings.enhanceSettingsSelect (cognitive 27) · ×1
  • settings.enhanceSettingsSelect (cognitive 27) web/static/js/settings.js:186 — settings.enhanceSettingsSelect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 20 (21 pts), boolean chains 6 (nesting depth added 1). Most of this is not in the body itself: 8 of the 27 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 242, 271, 234). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadAttackChain (cognitive 27) · ×1
  • loadAttackChain (cognitive 27) web/static/js/chat.js:7029 — loadAttackChain has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 1 (3 pts), boolean chains 2, error handling 1 (nesting depth added 11). Of this number, 24 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · collapseAllProgressDetails (cognitive 27) · ×1
  • collapseAllProgressDetails (cognitive 27) web/static/js/monitor.js:1648 — collapseAllProgressDetails has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (9 pts), boolean chains 3 (nesting depth added 13). Of this number, 20 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · reconcileConversationAfterTaskReplay (cognitive 27) · ×1
  • reconcileConversationAfterTaskReplay (cognitive 27) web/static/js/monitor.js:5544 — reconcileConversationAfterTaskReplay has cognitive complexity 27 (threshold 15). Drivers by points: if/else 13 (15 pts), boolean chains 9, error handling 1, loops 1, ternaries 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.
D2 · Cognitive Complexity · renderSkillsPagination (cognitive 27) · ×1
  • renderSkillsPagination (cognitive 27) web/static/js/skills.js:222 — renderSkillsPagination has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 10, boolean chains 7 (nesting depth added 2). Of this number, 21 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · openVulnerabilityInspector (cognitive 27) · ×1
  • openVulnerabilityInspector (cognitive 27) web/static/js/vulnerability-workspace.js:104 — openVulnerabilityInspector has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, ternaries 9, if/else 4 (5 pts), error handling 2 (nesting depth added 1). Of this number, 22 points are the body's own statements and 5 belong to 5 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Agent.convertSchemaTypes (cognitive 26) · ×1
  • Agent.convertSchemaTypes (cognitive 26) internal/agent/agent.go:458 — Agent.convertSchemaTypes has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (7 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.
D2 · Cognitive Complexity · database.assetWhere (cognitive 26) · ×1
  • database.assetWhere (cognitive 26) internal/database/asset.go:400 — database.assetWhere has cognitive complexity 26 (threshold 15). Drivers by points: if/else 21 (22 pts), loops 2 (3 pts), match/switch 1 (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.
D2 · Cognitive Complexity · DB.LoadToolExecutionsWithPagination (cognitive 26) · ×1
  • DB.LoadToolExecutionsWithPagination (cognitive 26) REDACTED:164 — DB.LoadToolExecutionsWithPagination has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (22 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.CreateBatchQueue (cognitive 26) · ×1
  • AgentHandler.CreateBatchQueue (cognitive 26) internal/handler/agent.go:1900 — AgentHandler.CreateBatchQueue has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssetHandler.RecordScans (cognitive 26) · ×1
  • AssetHandler.RecordScans (cognitive 26) internal/handler/asset.go:271 — AssetHandler.RecordScans has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 6, loops 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AssetHandler.Merge (cognitive 26) · ×1
  • AssetHandler.Merge (cognitive 26) internal/handler/asset.go:437 — AssetHandler.Merge has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 6 (7 pts), boolean chains 3 (nesting depth added 5). Of this number, 24 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MonitorHandler.loadExecutionListWithPagination (cognitive 26) · ×1
  • MonitorHandler.loadExecutionListWithPagination (cognitive 26) internal/handler/monitor.go:207 — MonitorHandler.loadExecutionListWithPagination has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 2 (5 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.
D2 · Cognitive Complexity · MonitorHandler.loadStatsMap (cognitive 26) · ×1
  • MonitorHandler.loadStatsMap (cognitive 26) internal/handler/monitor.go:502 — MonitorHandler.loadStatsMap has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 4 (10 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.
D2 · Cognitive Complexity · MonitorHandler.DeleteExecutions (cognitive 26) · ×1
  • MonitorHandler.DeleteExecutions (cognitive 26) internal/handler/monitor.go:929 — MonitorHandler.DeleteExecutions has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (21 pts), loops 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.
D2 · Cognitive Complexity · AgentTaskManager.CancelTask (cognitive 26) · ×1
  • AgentTaskManager.CancelTask (cognitive 26) internal/handler/task_manager.go:475 — AgentTaskManager.CancelTask has cognitive complexity 26 (threshold 15). Drivers by points: if/else 16 (18 pts), boolean chains 8 (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.
D2 · Cognitive Complexity · VulnerabilityHandler.UpdateVulnerability (cognitive 26) · ×1
  • VulnerabilityHandler.UpdateVulnerability (cognitive 26) REDACTED:278 — VulnerabilityHandler.UpdateVulnerability has cognitive complexity 26 (threshold 15). Drivers by points: if/else 22 (25 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.
D2 · Cognitive Complexity · VulnerabilityHandler.ExportVulnerabilities (cognitive 26) · ×1
  • VulnerabilityHandler.ExportVulnerabilities (cognitive 26) REDACTED:455 — VulnerabilityHandler.ExportVulnerabilities has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (13 pts), loops 5 (11 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · VectorRetriever.Retrieve (cognitive 26) · ×1
  • VectorRetriever.Retrieve (cognitive 26) internal/knowledge/vector_retriever.go:31 — VectorRetriever.Retrieve has cognitive complexity 26 (threshold 15). Drivers by points: if/else 15 (20 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.
D2 · Cognitive Complexity · workflow.DryRunGraphJSON (cognitive 26) · ×1
  • workflow.DryRunGraphJSON (cognitive 26) internal/workflow/dry_run.go:21 — workflow.DryRunGraphJSON has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (5 pts), match/switch 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.
D2 · Cognitive Complexity · assets.openAssetDetailRecord (cognitive 26) · ×1
  • assets.openAssetDetailRecord (cognitive 26) REDACTED:1744 — assets.openAssetDetailRecord has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 6, ternaries 6. 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.
D2 · Cognitive Complexity · knowledge.getTimeAgo (cognitive 26) · ×1
  • knowledge.getTimeAgo (cognitive 26) REDACTED:1546 — knowledge.getTimeAgo has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (23 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tasks.renderTaskItem (cognitive 26) · ×1
  • tasks.renderTaskItem (cognitive 26) web/static/js/tasks.js:521 — tasks.renderTaskItem has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 17 (18 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · parseAssetEditorTarget (cognitive 26) · ×1
  • parseAssetEditorTarget (cognitive 26) REDACTED:1391 — parseAssetEditorTarget has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 9, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · prefetchProcessDetailsSummaryHint (cognitive 26) · ×1
  • prefetchProcessDetailsSummaryHint (cognitive 26) web/static/js/chat.js:4580 — prefetchProcessDetailsSummaryHint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12, boolean chains 8, ternaries 4, error handling 2. Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 4588, 4589, 4610, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderSeverityDonut (cognitive 26) · ×1
  • renderSeverityDonut (cognitive 26) web/static/js/dashboard.js:2034 — renderSeverityDonut has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 5, ternaries 3 (4 pts) (nesting depth added 5). Of this number, 17 points are the body's own statements and 9 belong to 5 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.
D2 · Cognitive Complexity · prepareSurface (cognitive 26) · ×1
  • prepareSurface (cognitive 26) web/static/js/modal.js:42 — prepareSurface has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 8, ternaries 4 (7 pts) (nesting depth added 5). Of this number, 23 points are the body's own statements and 3 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.
D2 · Cognitive Complexity · loadAllToolsToStateMap (cognitive 26) · ×1
  • loadAllToolsToStateMap (cognitive 26) web/static/js/roles.js:1583 — loadAllToolsToStateMap has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 5, ternaries 1 (4 pts), error handling 1, loops 1 (nesting depth added 10). Most of this is not in the body itself: 7 of the 26 points are its own statements and the rest belongs to one function literal inside it that branches (line 1600). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · persistAIChannelsToServer (cognitive 26) · ×1
  • persistAIChannelsToServer (cognitive 26) web/static/js/settings.js:3025 — persistAIChannelsToServer has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), error handling 3 (5 pts), ternaries 1 (nesting depth added 3). 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.
D2 · Cognitive Complexity · refreshVulnerabilityProjectFilter (cognitive 26) · ×1
  • refreshVulnerabilityProjectFilter (cognitive 26) web/static/js/vulnerability.js:2580 — refreshVulnerabilityProjectFilter has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 7, ternaries 4 (6 pts), error handling 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · app.registerC2PayloadTool (cognitive 25) · ×1
  • app.registerC2PayloadTool (cognitive 25) internal/app/c2_tools.go:532 — app.registerC2PayloadTool has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 1 (3 pts), match/switch 1 (nesting depth added 13). None of this is in the body itself: all 25 points belong to one function literal inside it that branches (line 557). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · PayloadBuilder.BuildBeacon (cognitive 25) · ×1
  • PayloadBuilder.BuildBeacon (cognitive 25) internal/c2/payload_builder.go:66 — PayloadBuilder.BuildBeacon has cognitive complexity 25 (threshold 15). Drivers by points: if/else 20 (22 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.
D2 · Cognitive Complexity · config.persistMCPAuth (cognitive 25) · ×1
  • config.persistMCPAuth (cognitive 25) internal/config/config.go:1953 — config.persistMCPAuth has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (23 pts), boolean chains 1, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetMessagesLite (cognitive 25) · ×1
  • DB.GetMessagesLite (cognitive 25) REDACTED:1065 — DB.GetMessagesLite has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.ListVulnerabilitiesByGroupForAccess (cognitive 25) · ×1
  • DB.ListVulnerabilitiesByGroupForAccess (cognitive 25) REDACTED:366 — DB.ListVulnerabilitiesByGroupForAccess has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (22 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.transformHeaderSecrets (cognitive 25) · ×1
  • handler.transformHeaderSecrets (cognitive 25) internal/handler/config_header_secrets.go:10 — handler.transformHeaderSecrets 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.
D2 · Cognitive Complexity · C2Handler.ListTasks (cognitive 25) · ×1
  • C2Handler.ListTasks (cognitive 25) internal/handler/c2.go:476 — C2Handler.ListTasks has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 4 (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. This shape REPEATS in the file: one other method here (C2Handler.ListEvents) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · C2Handler.ListEvents (cognitive 25) · ×1
  • C2Handler.ListEvents (cognitive 25) internal/handler/c2.go:872 — C2Handler.ListEvents has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 4 (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. This shape REPEATS in the file: one other method here (C2Handler.ListTasks) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · TerminalHandler.RunCommand (cognitive 25) · ×1
  • TerminalHandler.RunCommand (cognitive 25) internal/handler/terminal.go:64 — TerminalHandler.RunCommand has cognitive complexity 25 (threshold 15). Drivers by points: if/else 18 (23 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VulnerabilityHandler.CreateRetest (cognitive 25) · ×1
  • VulnerabilityHandler.CreateRetest (cognitive 25) internal/handler/vulnerability_retest.go:14 — VulnerabilityHandler.CreateRetest has cognitive complexity 25 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ExternalMCPManager.refreshToolCounts (cognitive 25) · ×1
  • ExternalMCPManager.refreshToolCounts (cognitive 25) internal/mcp/external_manager.go:1308 — ExternalMCPManager.refreshToolCounts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 6 (nesting depth added 9). Of this number, 16 points are the body's own statements and 9 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Executor.ExecuteTool (cognitive 25) · ×1
  • Executor.ExecuteTool (cognitive 25) internal/security/executor.go:122 — Executor.ExecuteTool has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, loops 1 (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.
D2 · Cognitive Complexity · service-worker.chrome.runtime.onMessage.addListener() (cognitive 25) · ×1
  • service-worker.chrome.runtime.onMessage.addListener() (cognitive 25) plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:74 — service-worker.chrome.runtime.onMessage.addListener() has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 7). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.renderMcpStatsTimelineBody (cognitive 25) · ×1
  • monitor.renderMcpStatsTimelineBody (cognitive 25) web/static/js/monitor.js:8126 — monitor.renderMcpStatsTimelineBody has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 16, ternaries 6, if/else 3. Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, 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.
D2 · Cognitive Complexity · wechat-robot.pollWechatBindStatus (cognitive 25) · ×1
  • wechat-robot.pollWechatBindStatus (cognitive 25) web/static/js/wechat-robot.js:315 — wechat-robot.pollWechatBindStatus has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, error handling 1, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chatSystemModelConfigState (cognitive 25) · ×1
  • chatSystemModelConfigState (cognitive 25) web/static/js/chat.js:1098 — chatSystemModelConfigState has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, ternaries 6 (8 pts), if/else 4 (nesting depth added 2). Of this number, 20 points are the body's own statements and 5 belong to 2 function items 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.
D2 · Cognitive Complexity · renderMentionSuggestions (cognitive 25) · ×1
  • renderMentionSuggestions (cognitive 25) web/static/js/chat.js:3125 — renderMentionSuggestions has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 14 (16 pts), if/else 5, boolean chains 4 (nesting depth added 2). Most of this is not in the body itself: 12 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 3152, 3198, 3197). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · deleteRetrievalLog (cognitive 25) · ×1
  • deleteRetrievalLog (cognitive 25) REDACTED:1637 — deleteRetrievalLog has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 5, error handling 2 (3 pts), ternaries 1 (nesting depth added 7). Of this number, 23 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · triggerLazyProcessDetailsLoad (cognitive 25) · ×1
  • triggerLazyProcessDetailsLoad (cognitive 25) web/static/js/monitor.js:2500 — triggerLazyProcessDetailsLoad has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 3 (6 pts), boolean chains 1, error handling 1 (nesting depth added 11). Most of this is not in the body itself: 8 of the 25 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2527, 2515, 2537). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · getToolResultDisplayState (cognitive 25) · ×1
  • getToolResultDisplayState (cognitive 25) web/static/js/monitor.js:5930 — getToolResultDisplayState has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (11 pts), ternaries 1 (nesting depth added 2). 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.
D2 · Cognitive Complexity · refreshMonitorPanel (cognitive 25) · ×1
  • refreshMonitorPanel (cognitive 25) web/static/js/monitor.js:7365 — refreshMonitorPanel has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 5 (9 pts), boolean chains 5, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · applyWebshellDetectedOS (cognitive 25) · ×1
  • applyWebshellDetectedOS (cognitive 25) web/static/js/webshell.js:121 — applyWebshellDetectedOS has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 10, if/else 7 (9 pts), error handling 2 (4 pts), loops 1 (2 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.
D2 · Cognitive Complexity · (anonymous) (cognitive 25) · ×1
  • (anonymous) (cognitive 25) plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:74 — (anonymous) has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 7). Of this number, 23 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · app.registerC2TaskManageTool (cognitive 24) · ×1
  • app.registerC2TaskManageTool (cognitive 24) internal/app/c2_tools.go:444 — app.registerC2TaskManageTool has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 13). None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 464). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TCPReverseListener.handleShellConn (cognitive 24) · ×1
  • TCPReverseListener.handleShellConn (cognitive 24) internal/c2/listener_tcp.go:152 — TCPReverseListener.handleShellConn has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 10). Of this number, 22 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · database.matchToolExecutionIndex (cognitive 24) · ×1
  • database.matchToolExecutionIndex (cognitive 24) REDACTED:1714 — database.matchToolExecutionIndex has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.AssignResourcesToUser (cognitive 24) · ×1
  • DB.AssignResourcesToUser (cognitive 24) REDACTED:823 — DB.AssignResourcesToUser has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 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.
D2 · Cognitive Complexity · handler.updateRolesConfig (cognitive 24) · ×1
  • handler.updateRolesConfig (cognitive 24) REDACTED:420 — handler.updateRolesConfig has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 4 (12 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.
D2 · Cognitive Complexity · AgentHandler.submitAgentRunWithExecutor (cognitive 24) · ×1
  • AgentHandler.submitAgentRunWithExecutor (cognitive 24) internal/handler/async_agent_runs.go:29 — AgentHandler.submitAgentRunWithExecutor has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AgentHandler.waitHITLApproval (cognitive 24) · ×1
  • AgentHandler.waitHITLApproval (cognitive 24) internal/handler/hitl.go:624 — AgentHandler.waitHITLApproval has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 7). Of this number, 19 points are the body's own statements and 5 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchTaskManager.UpdateTaskStatusWithConversationID (cognitive 24) · ×1
  • BatchTaskManager.UpdateTaskStatusWithConversationID (cognitive 24) internal/handler/batch_task_manager.go:653 — BatchTaskManager.UpdateTaskStatusWithConversationID has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 2, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.scanAdoption (cognitive 24) · ×1
  • update.scanAdoption (cognitive 24) REDACTED:342 — update.scanAdoption has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 4, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CyberStrikeAITab.wireActions (cognitive 24) · ×1
  • CyberStrikeAITab.wireActions (cognitive 24) plugins/burp-suite/cyberstrikeai-burp-extension/src/main/java/burp/CyberStrikeAITab.java:426 — CyberStrikeAITab.wireActions has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 3, error handling 2, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · assets.assetExportRows (cognitive 24) · ×1
  • assets.assetExportRows (cognitive 24) REDACTED:1021 — assets.assetExportRows has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 24. None of this is in the body itself: all 24 points belong to one function literal inside it that branches (line 1022). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · chat.enhanceSessionSettingsSelect (cognitive 24) · ×1
  • chat.enhanceSessionSettingsSelect (cognitive 24) web/static/js/chat.js:218 — chat.enhanceSessionSettingsSelect has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (17 pts), boolean chains 6, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 6 of the 24 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 266, 297, 257). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · info-collect.bindFofaTableEvents (cognitive 24) · ×1
  • info-collect.bindFofaTableEvents (cognitive 24) web/static/js/info-collect.js:1356 — info-collect.bindFofaTableEvents has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7, ternaries 2 (nesting depth added 5). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1364, 1390). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · monitor.setHitlApprovalInterruptedVisualState (cognitive 24) · ×1
  • monitor.setHitlApprovalInterruptedVisualState (cognitive 24) web/static/js/monitor.js:1195 — monitor.setHitlApprovalInterruptedVisualState has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 9 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · projects.parseProjectDate (cognitive 24) · ×1
  • projects.parseProjectDate (cognitive 24) web/static/js/projects.js:2455 — projects.parseProjectDate has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, ternaries 2 (4 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.
D2 · Cognitive Complexity · settings.switchSettingsSection (cognitive 24) · ×1
  • settings.switchSettingsSection (cognitive 24) web/static/js/settings.js:688 — settings.switchSettingsSection has cognitive complexity 24 (threshold 15). Drivers by points: if/else 15 (17 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · tasks.getBatchQueueStatusPresentation (cognitive 24) · ×1
  • tasks.getBatchQueueStatusPresentation (cognitive 24) web/static/js/tasks.js:35 — tasks.getBatchQueueStatusPresentation has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (11 pts), boolean chains 9, if/else 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · webshell.parseWebshellDbTableColumns (cognitive 24) · ×1
  • webshell.parseWebshellDbTableColumns (cognitive 24) web/static/js/webshell.js:2042 — webshell.parseWebshellDbTableColumns has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, ternaries 2 (3 pts), loops 1 (nesting depth added 5). Of this number, 21 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · webshell.normalizeWebshellDbSchema (cognitive 24) · ×1
  • webshell.normalizeWebshellDbSchema (cognitive 24) web/static/js/webshell.js:2069 — webshell.normalizeWebshellDbSchema has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 7). Most of this is not in the body itself: 2 of the 24 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2072, 2084, 2077, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderFofaResults (cognitive 24) · ×1
  • renderFofaResults (cognitive 24) web/static/js/info-collect.js:1038 — renderFofaResults has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 12, if/else 6 (7 pts), boolean chains 5 (nesting depth added 1). Of this number, 16 points are the body's own statements and 8 belong to 5 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · updateToolsStats (cognitive 24) · ×1
  • updateToolsStats (cognitive 24) web/static/js/settings.js:1836 — updateToolsStats has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 3 (7 pts), boolean chains 2, error handling 1, other 1 (nesting depth added 10). Most of this is not in the body itself: 10 of the 24 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1871, a function literal at line 1855, t). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · toggleWorkflowEnabled (cognitive 24) · ×1
  • toggleWorkflowEnabled (cognitive 24) web/static/js/workflows.js:2042 — toggleWorkflowEnabled has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · app.registerWebshellTools (cognitive 23) · ×1
  • app.registerWebshellTools (cognitive 23) REDACTED:1534 — app.registerWebshellTools has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15, boolean chains 8. Most of this is not in the body itself: 2 of the 23 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1560, 1660, 1627, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Service.Record (cognitive 23) · ×1
  • Service.Record (cognitive 23) internal/audit/service.go:45 — Service.Record has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · database.columnDefinitions (cognitive 23) · ×1
  • database.columnDefinitions (cognitive 23) internal/database/schema_reconcile.go:214 — database.columnDefinitions has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 2 (4 pts), boolean chains 1, loops 1 (nesting depth added 10). Of this number, 15 points are the body's own statements and 8 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.batchQueueSchedulerLoop (cognitive 23) · ×1
  • AgentHandler.batchQueueSchedulerLoop (cognitive 23) internal/handler/agent.go:2470 — AgentHandler.batchQueueSchedulerLoop has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (17 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · AgentHandler.runMultiJSON (cognitive 23) · ×1
  • AgentHandler.runMultiJSON (cognitive 23) internal/handler/agent_multi_json_runner.go:15 — AgentHandler.runMultiJSON has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConversationHandler.GetMessageProcessDetails (cognitive 23) · ×1
  • ConversationHandler.GetMessageProcessDetails (cognitive 23) REDACTED:325 — ConversationHandler.GetMessageProcessDetails has cognitive complexity 23 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RobotHandler.HandleWecomPOST (cognitive 23) · ×1
  • RobotHandler.HandleWecomPOST (cognitive 23) REDACTED:1550 — RobotHandler.HandleWecomPOST has cognitive complexity 23 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 2 (nesting depth added 2). Of this number, 22 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AgentTaskManager.FinishTaskRun (cognitive 23) · ×1
  • AgentTaskManager.FinishTaskRun (cognitive 23) internal/handler/task_manager.go:615 — AgentTaskManager.FinishTaskRun has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 6, match/switch 1 (2 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.
D2 · Cognitive Complexity · WebShellHandler.FileOp (cognitive 23) · ×1
  • WebShellHandler.FileOp (cognitive 23) REDACTED:854 — WebShellHandler.FileOp 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WorkflowHandler.ResumeRun (cognitive 23) · ×1
  • WorkflowHandler.ResumeRun (cognitive 23) internal/handler/workflow_run.go:100 — WorkflowHandler.ResumeRun has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · storage.scanDatedSessionDirs (cognitive 23) · ×1
  • storage.scanDatedSessionDirs (cognitive 23) internal/storage/category.go:228 — storage.scanDatedSessionDirs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), 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.
D2 · Cognitive Complexity · workflow.validateNodeTopology (cognitive 23) · ×1
  • workflow.validateNodeTopology (cognitive 23) internal/workflow/validation.go:93 — workflow.validateNodeTopology has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (20 pts), 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.
D2 · Cognitive Complexity · hitl.hitlAuditEngineFromItem (cognitive 23) · ×1
  • hitl.hitlAuditEngineFromItem (cognitive 23) web/static/js/hitl.js:1272 — hitl.hitlAuditEngineFromItem has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (8 pts), ternaries 3 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.renderMcpStatsCombinedSection (cognitive 23) · ×1
  • monitor.renderMcpStatsCombinedSection (cognitive 23) web/static/js/monitor.js:8174 — monitor.renderMcpStatsCombinedSection has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 9 (10 pts), boolean chains 9, if/else 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · projects.saveProjectModal (cognitive 23) · ×1
  • projects.saveProjectModal (cognitive 23) web/static/js/projects.js:2009 — projects.saveProjectModal has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 5, error handling 1, ternaries 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.
D2 · Cognitive Complexity · terminal.switchTerminalTab (cognitive 23) · ×1
  • terminal.switchTerminalTab (cognitive 23) web/static/js/terminal.js:294 — terminal.switchTerminalTab has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 2 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 11). Most of this is not in the body itself: 9 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 313, 300). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadAuditLogs (cognitive 23) · ×1
  • loadAuditLogs (cognitive 23) web/static/js/audit.js:275 — loadAuditLogs has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 4 (7 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · renderSessions (cognitive 23) · ×1
  • renderSessions (cognitive 23) web/static/js/c2.js:1523 — renderSessions has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), ternaries 6 (7 pts) (nesting depth added 2). Of this number, 13 points are the body's own statements and 10 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.
D2 · Cognitive Complexity · renderSessionDetail (cognitive 23) · ×1
  • renderSessionDetail (cognitive 23) web/static/js/c2.js:1599 — renderSessionDetail has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 8, boolean chains 7 (nesting depth added 1). Of this number, 17 points are the body's own statements and 6 belong to 8 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · performHardCancelProgressTask (cognitive 23) · ×1
  • performHardCancelProgressTask (cognitive 23) web/static/js/monitor.js:1467 — performHardCancelProgressTask has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (9 pts), ternaries 4 (9 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · loadProjectAssets (cognitive 23) · ×1
  • loadProjectAssets (cognitive 23) web/static/js/projects.js:1056 — loadProjectAssets has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 12, if/else 7 (8 pts), ternaries 3 (nesting depth added 1). 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, 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.
D2 · Cognitive Complexity · renderRows (cognitive 23) · ×1
  • renderRows (cognitive 23) web/static/js/storage.js:137 — renderRows has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, ternaries 8, if/else 5 (7 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 23 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 149, 147). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · populateVulnerabilityModalProjectSelect (cognitive 23) · ×1
  • populateVulnerabilityModalProjectSelect (cognitive 23) web/static/js/vulnerability.js:1733 — populateVulnerabilityModalProjectSelect has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 2 (6 pts), boolean chains 4, error handling 1 (nesting depth added 8). Of this number, 19 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c2.ValidateBeaconDialHost (cognitive 22) · ×1
  • c2.ValidateBeaconDialHost (cognitive 22) internal/c2/beacon_host.go:44 — c2.ValidateBeaconDialHost has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 8, loops 3 (4 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.
D2 · Cognitive Complexity · config.EnsureLocalConfig (cognitive 22) · ×1
  • config.EnsureLocalConfig (cognitive 22) internal/config/config.go:1890 — config.EnsureLocalConfig has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.startBatchQueueExecution (cognitive 22) · ×1
  • AgentHandler.startBatchQueueExecution (cognitive 22) internal/handler/agent.go:2409 — AgentHandler.startBatchQueueExecution has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.taskFinishingEventSender (cognitive 22) · ×1
  • AgentHandler.taskFinishingEventSender (cognitive 22) internal/handler/task_lifecycle.go:27 — AgentHandler.taskFinishingEventSender has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (7 pts), boolean chains 1 (nesting depth added 13). None of this is in the body itself: all 22 points belong to one function literal inside it that branches (line 28). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ConfigHandler.saveConfig (cognitive 22) · ×1
  • ConfigHandler.saveConfig (cognitive 22) internal/handler/config.go:2064 — ConfigHandler.saveConfig has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 1 (2 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.
D2 · Cognitive Complexity · MarkdownAgentsHandler.UpdateMarkdownAgent (cognitive 22) · ×1
  • MarkdownAgentsHandler.UpdateMarkdownAgent (cognitive 22) internal/handler/markdown_agents.go:264 — MarkdownAgentsHandler.UpdateMarkdownAgent has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 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.
D2 · Cognitive Complexity · knowledge.truncateDocumentsByBudget (cognitive 22) · ×1
  • knowledge.truncateDocumentsByBudget (cognitive 22) internal/knowledge/retrieval_postprocess.go:125 — knowledge.truncateDocumentsByBudget has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (18 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.
D2 · Cognitive Complexity · Server.GetAllExecutions (cognitive 22) · ×1
  • Server.GetAllExecutions (cognitive 22) internal/mcp/server.go:849 — Server.GetAllExecutions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 4 (10 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · modelmeta.detectLMStudio (cognitive 22) · ×1
  • modelmeta.detectLMStudio (cognitive 22) internal/modelmeta/context.go:291 — modelmeta.detectLMStudio has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · modelmeta.detectOpenAICompatible (cognitive 22) · ×1
  • modelmeta.detectOpenAICompatible (cognitive 22) internal/modelmeta/context.go:356 — modelmeta.detectOpenAICompatible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 2 (4 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.
D2 · Cognitive Complexity · Client.claudeNativeChatCompletionStream (cognitive 22) · ×1
  • Client.claudeNativeChatCompletionStream (cognitive 22) internal/openai/claude_native.go:215 — Client.claudeNativeChatCompletionStream has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (20 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project.BuildFactIndexBlock (cognitive 22) · ×1
  • project.BuildFactIndexBlock (cognitive 22) internal/project/blackboard.go:31 — project.BuildFactIndexBlock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 16 (20 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · project.extractBodySyncLinksBlock (cognitive 22) · ×1
  • project.extractBodySyncLinksBlock (cognitive 22) internal/project/fact_body_links.go:75 — project.extractBodySyncLinksBlock has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 5, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.startShellSessionContext (cognitive 22) · ×1
  • security.startShellSessionContext (cognitive 22) internal/security/process_scope.go:59 — security.startShellSessionContext has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.permissionForRequest (cognitive 22) · ×1
  • security.permissionForRequest (cognitive 22) internal/security/rbac_middleware.go:91 — security.permissionForRequest has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · Executor.buildInputSchema (cognitive 22) · ×1
  • Executor.buildInputSchema (cognitive 22) internal/security/executor.go:1402 — Executor.buildInputSchema has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (20 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.
D2 · Cognitive Complexity · update.stashProtectedEdits (cognitive 22) · ×1
  • update.stashProtectedEdits (cognitive 22) internal/update/apply.go:761 — update.stashProtectedEdits has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 4, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.resolveBinding (cognitive 22) · ×1
  • workflow.resolveBinding (cognitive 22) internal/workflow/bindings.go:48 — workflow.resolveBinding has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat-plan-progress.fetchPlanTasks (cognitive 22) · ×1
  • chat-plan-progress.fetchPlanTasks (cognitive 22) web/static/js/chat-plan-progress.js:250 — chat-plan-progress.fetchPlanTasks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6, ternaries 2 (4 pts), 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.
D2 · Cognitive Complexity · mobile-ui.enableSelectionPanelSwipe (cognitive 22) · ×1
  • mobile-ui.enableSelectionPanelSwipe (cognitive 22) web/static/js/mobile-ui.js:291 — mobile-ui.enableSelectionPanelSwipe has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 9, loops 1, ternaries 1 (nesting depth added 1). None of this is in the body itself: all 22 points belong to 4 function literals inside it that branch (lines 302, 316, 327, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadActiveTasks (cognitive 22) · ×1
  • loadActiveTasks (cognitive 22) web/static/js/monitor.js:6936 — loadActiveTasks has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, error handling 4 (5 pts), ternaries 2 (5 pts) (nesting depth added 6). Most of this is not in the body itself: 1 of the 22 points is its own statement and the rest belongs to 5 function literals inside it that branch (lines 6939, 6943, 6945, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · initChatProjectSelector (cognitive 22) · ×1
  • initChatProjectSelector (cognitive 22) web/static/js/projects.js:4040 — initChatProjectSelector has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, error handling 2 (4 pts), ternaries 1 (3 pts) (nesting depth added 8). Most of this is not in the body itself: 3 of the 22 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 4045, 4064, 4056, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · wsRenderRoleList (cognitive 22) · ×1
  • wsRenderRoleList (cognitive 22) web/static/js/webshell.js:219 — wsRenderRoleList has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 4 (8 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · renderWebshellTerminalSessions (cognitive 22) · ×1
  • renderWebshellTerminalSessions (cognitive 22) web/static/js/webshell.js:1587 — renderWebshellTerminalSessions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 8, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 4 of the 22 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1604, 1594, 1603, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Agent.executeToolViaMCP (cognitive 21) · ×1
  • Agent.executeToolViaMCP (cognitive 21) internal/agent/agent.go:533 — Agent.executeToolViaMCP has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 5, loops 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · C2HITLBridge.RequestApproval (cognitive 21) · ×1
  • C2HITLBridge.RequestApproval (cognitive 21) REDACTED:48 — C2HITLBridge.RequestApproval has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (15 pts), match/switch 2 (5 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HTTPBeaconListener.handleCheckIn (cognitive 21) · ×1
  • HTTPBeaconListener.handleCheckIn (cognitive 21) internal/c2/listener_http.go:161 — HTTPBeaconListener.handleCheckIn has cognitive complexity 21 (threshold 15). Drivers by points: if/else 18 (20 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.
D2 · Cognitive Complexity · config.LoadRoleFromFile (cognitive 21) · ×1
  • config.LoadRoleFromFile (cognitive 21) internal/config/config.go:2242 — config.LoadRoleFromFile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.GetToolExecutionsByIds (cognitive 21) · ×1
  • DB.GetToolExecutionsByIds (cognitive 21) REDACTED:743 — DB.GetToolExecutionsByIds has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (18 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ProjectHandler.ListFacts (cognitive 21) · ×1
  • ProjectHandler.ListFacts (cognitive 21) internal/handler/project.go:337 — ProjectHandler.ListFacts has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · RobotHandler.getOrCreateConversation (cognitive 21) · ×1
  • RobotHandler.getOrCreateConversation (cognitive 21) REDACTED:234 — RobotHandler.getOrCreateConversation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ExecutionService.Submit (cognitive 21) · ×1
  • ExecutionService.Submit (cognitive 21) internal/mcp/execution_service.go:125 — ExecutionService.Submit has cognitive complexity 21 (threshold 15). Drivers by points: if/else 16 (20 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.
D2 · Cognitive Complexity · ExternalMCPManager.GetToolStats (cognitive 21) · ×1
  • ExternalMCPManager.GetToolStats (cognitive 21) internal/mcp/external_manager.go:1215 — ExternalMCPManager.GetToolStats has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 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.
D2 · Cognitive Complexity · ExternalMCPManager.StartAllEnabled (cognitive 21) · ×1
  • ExternalMCPManager.StartAllEnabled (cognitive 21) internal/mcp/external_manager.go:1574 — ExternalMCPManager.StartAllEnabled has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (16 pts), boolean chains 3, loops 2 (nesting depth added 10). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to one function literal inside it that branches (line 1584). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Server.generateToolDocumentation (cognitive 21) · ×1
  • Server.generateToolDocumentation (cognitive 21) internal/mcp/server.go:1600 — Server.generateToolDocumentation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (17 pts), loops 1 (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.
D2 · Cognitive Complexity · piRun.piLocalCatalog (cognitive 21) · ×1
  • piRun.piLocalCatalog (cognitive 21) internal/multiagent/pi_local_tools.go:26 — piRun.piLocalCatalog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project.buildResumeSection (cognitive 21) · ×1
  • project.buildResumeSection (cognitive 21) internal/project/resume.go:41 — project.buildResumeSection has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · security.streamShellForeground (cognitive 21) · ×1
  • security.streamShellForeground (cognitive 21) internal/security/shell_execute_stream.go:92 — security.streamShellForeground has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (15 pts), match/switch 2 (4 pts), loops 2 (nesting depth added 7). Of this number, 12 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · toolguard.Compile (cognitive 21) · ×1
  • toolguard.Compile (cognitive 21) internal/toolguard/toolguard.go:78 — toolguard.Compile has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.recoverAdoption (cognitive 21) · ×1
  • update.recoverAdoption (cognitive 21) REDACTED:21 — update.recoverAdoption 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.
D2 · Cognitive Complexity · workflow.normalizeLLMNodeConfig (cognitive 21) · ×1
  • workflow.normalizeLLMNodeConfig (cognitive 21) internal/workflow/draft_generator.go:513 — workflow.normalizeLLMNodeConfig has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 1, match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · http-normalize.normalizeRequestBlock (cognitive 21) · ×1
  • http-normalize.normalizeRequestBlock (cognitive 21) plugins/browser-extension/cyberstrikeai-browser-extension/lib/http-normalize.js:31 — http-normalize.normalizeRequestBlock has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 8, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c2.c2ProjectDisplayName (cognitive 21) · ×1
  • c2.c2ProjectDisplayName (cognitive 21) web/static/js/c2.js:79 — c2.c2ProjectDisplayName has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 10 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat-files.submitChatFilesMkdir (cognitive 21) · ×1
  • chat-files.submitChatFilesMkdir (cognitive 21) web/static/js/chat-files.js:1720 — chat-files.submitChatFilesMkdir has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 4 (5 pts), boolean chains 4, error handling 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.
D2 · Cognitive Complexity · chat-plan-progress.handlePlanToolEvent (cognitive 21) · ×1
  • chat-plan-progress.handlePlanToolEvent (cognitive 21) web/static/js/chat-plan-progress.js:299 — chat-plan-progress.handlePlanToolEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, ternaries 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.
D2 · Cognitive Complexity · chat.regenerateAttackChain (cognitive 21) · ×1
  • chat.regenerateAttackChain (cognitive 21) web/static/js/chat.js:8208 — chat.regenerateAttackChain has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2, error handling 1 (nesting depth added 6). Of this number, 18 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat._acWrapLabel (cognitive 21) · ×1
  • chat._acWrapLabel (cognitive 21) web/static/js/chat.js:8327 — chat._acWrapLabel has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 8). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat._acCollectExportData (cognitive 21) · ×1
  • chat._acCollectExportData (cognitive 21) web/static/js/chat.js:8403 — chat._acCollectExportData has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 6, ternaries 2. Most of this is not in the body itself: 1 of the 21 points is its own statement and the rest belongs to 2 function literals inside it that branch (lines 8406, 8436). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fact-graph.wrapTextLines (cognitive 21) · ×1
  • fact-graph.wrapTextLines (cognitive 21) web/static/js/fact-graph.js:205 — fact-graph.wrapTextLines has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · fact-graph.resolveGraphNodeType (cognitive 21) · ×1
  • fact-graph.resolveGraphNodeType (cognitive 21) web/static/js/fact-graph.js:781 — fact-graph.resolveGraphNodeType has cognitive complexity 21 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 5 (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.
D2 · Cognitive Complexity · monitor.renderInlineHitlApproval (cognitive 21) · ×1
  • monitor.renderInlineHitlApproval (cognitive 21) web/static/js/monitor.js:4467 — monitor.renderInlineHitlApproval has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, ternaries 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.
D2 · Cognitive Complexity · router.initRouter (cognitive 21) · ×1
  • router.initRouter (cognitive 21) web/static/js/router.js:106 — router.initRouter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (13 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · tasks.startInlineEditRole (cognitive 21) · ×1
  • tasks.startInlineEditRole (cognitive 21) web/static/js/tasks.js:2580 — tasks.startInlineEditRole has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 2 of the 21 points are its own statements and the rest belongs to 7 function literals inside it that branch (lines 2586, 2589, 2589, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · webshell.selectWebshell · ×1
  • webshell.selectWebshell::applyActiveDbProfileToForm (cognitive 21) web/static/js/webshell.js:2876 — webshell.selectWebshell::applyActiveDbProfileToForm has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 10. 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 shape REPEATS in the file: one other method here (webshell.selectWebshell) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · workflows.syncWorkflowMetaIdField (cognitive 21) · ×1
  • workflows.syncWorkflowMetaIdField (cognitive 21) web/static/js/workflows.js:825 — workflows.syncWorkflowMetaIdField has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (19 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.
D2 · Cognitive Complexity · saveMarkdownAgent (cognitive 21) · ×1
  • saveMarkdownAgent (cognitive 21) web/static/js/agents.js:160 — saveMarkdownAgent has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 3, error handling 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · uploadFileToImplant (cognitive 21) · ×1
  • uploadFileToImplant (cognitive 21) web/static/js/c2.js:2987 — uploadFileToImplant has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 9, error handling 1, ternaries 1. Most of this is not in the body itself: 7 of the 21 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 3031, a function literal at line 3022, a function literal at line 3045, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · isAnonymousTaskFragmentToolCallDetail (cognitive 21) · ×1
  • isAnonymousTaskFragmentToolCallDetail (cognitive 21) web/static/js/chat.js:3922 — isAnonymousTaskFragmentToolCallDetail has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 3 (5 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · renderConversationsPagination (cognitive 21) · ×1
  • renderConversationsPagination (cognitive 21) web/static/js/chat.js:9917 — renderConversationsPagination has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 12, if/else 5 (6 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderRecentVulns (cognitive 21) · ×1
  • renderRecentVulns (cognitive 21) web/static/js/dashboard.js:1241 — renderRecentVulns has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, error handling 2 (5 pts), ternaries 2 (nesting depth added 6). Most of this is not in the body itself: 10 of the 21 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 1270, (anonymous)::onkeydown, onclick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · initI18n (cognitive 21) · ×1
  • initI18n (cognitive 21) web/static/js/i18n.js:204 — initI18n has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 5, error handling 2 (nesting depth added 1). Of this number, 11 points are the body's own statements and 10 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · showFofaParseModal (cognitive 21) · ×1
  • showFofaParseModal (cognitive 21) web/static/js/info-collect.js:891 — showFofaParseModal has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7, ternaries 4, error handling 1 (2 pts) (nesting depth added 1). Most of this is not in the body itself: 6 of the 21 points are its own statements and the rest belongs to 8 function items inside it that branch ((anonymous)::applyToQuery, a function literal at line 910, a function literal at line 962, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · isToolGuardBlockedResult (cognitive 21) · ×1
  • isToolGuardBlockedResult (cognitive 21) web/static/js/monitor.js:5904 — isToolGuardBlockedResult has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7, error handling 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.
D2 · Cognitive Complexity · refreshMonitorPanelWithFilter (cognitive 21) · ×1
  • refreshMonitorPanelWithFilter (cognitive 21) web/static/js/monitor.js:7604 — refreshMonitorPanelWithFilter has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 2 (6 pts), boolean chains 4, error handling 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · applyMonitorPayload (cognitive 21) · ×1
  • applyMonitorPayload (cognitive 21) web/static/js/monitor.js:7654 — applyMonitorPayload has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, ternaries 6 (7 pts), if/else 6 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · updateAIChannelEditorChrome (cognitive 21) · ×1
  • updateAIChannelEditorChrome (cognitive 21) web/static/js/settings.js:2942 — updateAIChannelEditorChrome has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (12 pts), boolean chains 7, if/else 2 (nesting depth added 6). Of this number, 19 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · probeSelectedAIChannels · ×1
  • probeSelectedAIChannels::probeNextAIChannel (cognitive 21) web/static/js/settings.js:3275 — probeSelectedAIChannels::probeNextAIChannel has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, ternaries 2 (4 pts), if/else 3, error handling 2 (nesting depth added 2). 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.
D2 · Cognitive Complexity · changePassword (cognitive 21) · ×1
  • changePassword (cognitive 21) web/static/js/settings.js:4322 — changePassword has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 6, ternaries 2 (3 pts), error handling 2 (nesting depth added 2). Of this number, 20 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · downloadSelectedVulnerability (cognitive 21) · ×1
  • downloadSelectedVulnerability (cognitive 21) web/static/js/vulnerability-download.js:17 — downloadSelectedVulnerability has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4, error handling 2 (4 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.
D2 · Cognitive Complexity · probeWebshellConnection (cognitive 21) · ×1
  • probeWebshellConnection (cognitive 21) web/static/js/webshell.js:1230 — probeWebshellConnection has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, ternaries 4 (5 pts), if/else 2, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 4 of the 21 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1254, 1236, 1261, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · fillSelect (cognitive 21) · ×1
  • fillSelect (cognitive 21) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:784 — fillSelect has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 4 (7 pts), boolean chains 6, if/else 4 (5 pts), loops 2 (3 pts) (nesting depth added 5). Of this number, 16 points are the body's own statements and 5 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.
D2 · Cognitive Complexity · Builder.parseChainJSON (cognitive 20) · ×1
  • Builder.parseChainJSON (cognitive 20) internal/attackchain/builder.go:961 — Builder.parseChainJSON has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.PopTasksForBeacon (cognitive 20) · ×1
  • Manager.PopTasksForBeacon (cognitive 20) internal/c2/manager.go:652 — Manager.PopTasksForBeacon has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.UpdateRBACUser (cognitive 20) · ×1
  • DB.UpdateRBACUser (cognitive 20) REDACTED:1157 — DB.UpdateRBACUser has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (18 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.CreateVulnerabilityRetest (cognitive 20) · ×1
  • DB.CreateVulnerabilityRetest (cognitive 20) internal/database/vulnerability_retest.go:61 — DB.CreateVulnerabilityRetest has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), loops 2, 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.
D2 · Cognitive Complexity · handler.extractRemoteAPIError (cognitive 20) · ×1
  • handler.extractRemoteAPIError (cognitive 20) REDACTED:946 — handler.extractRemoteAPIError has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (14 pts), boolean chains 3, loops 1 (3 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · handler.robotCommandPermission (cognitive 20) · ×1
  • handler.robotCommandPermission (cognitive 20) REDACTED:1089 — handler.robotCommandPermission has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, match/switch 1. The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AssetHandler.Import (cognitive 20) · ×1
  • AssetHandler.Import (cognitive 20) internal/handler/asset.go:87 — AssetHandler.Import has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ConfigHandler.GetToolSchema (cognitive 20) · ×1
  • ConfigHandler.GetToolSchema (cognitive 20) internal/handler/config.go:3015 — ConfigHandler.GetToolSchema has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 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.
D2 · Cognitive Complexity · ConversationHandler.GetConversationPlanTasks (cognitive 20) · ×1
  • ConversationHandler.GetConversationPlanTasks (cognitive 20) REDACTED:252 — ConversationHandler.GetConversationPlanTasks has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 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.
D2 · Cognitive Complexity · RobotHandler.HandleMessage (cognitive 20) · ×1
  • RobotHandler.HandleMessage (cognitive 20) REDACTED:383 — RobotHandler.HandleMessage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · RobotHandler.cmdHelp (cognitive 20) · ×1
  • RobotHandler.cmdHelp (cognitive 20) REDACTED:465 — RobotHandler.cmdHelp has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 4 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.ScanKnowledgeBase (cognitive 20) · ×1
  • Manager.ScanKnowledgeBase (cognitive 20) internal/knowledge/manager.go:35 — Manager.ScanKnowledgeBase has cognitive complexity 20 (threshold 15). Drivers by points: if/else 15 (19 pts), boolean chains 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 20 points are its own statements and the rest belongs to one function literal inside it that branches (line 48). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · Server.FinishToolExecution (cognitive 20) · ×1
  • Server.FinishToolExecution (cognitive 20) internal/mcp/server.go:1065 — Server.FinishToolExecution 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.
D2 · Cognitive Complexity · security.finalizeJoinedBoundedOutputs (cognitive 20) · ×1
  • security.finalizeJoinedBoundedOutputs (cognitive 20) internal/security/executor.go:1022 — security.finalizeJoinedBoundedOutputs has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6 (nesting depth added 2). Of this number, 18 points are the body's own statements and 2 belong to 2 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Cleaner.selectCategories (cognitive 20) · ×1
  • Cleaner.selectCategories (cognitive 20) internal/storage/cleaner.go:181 — Cleaner.selectCategories has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 5 (6 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.
D2 · Cognitive Complexity · workflow.executeNode (cognitive 20) · ×1
  • workflow.executeNode (cognitive 20) internal/workflow/node_exec.go:15 — workflow.executeNode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14 (19 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.
D2 · Cognitive Complexity · panel.handleStreamEvent (cognitive 20) · ×1
  • panel.handleStreamEvent (cognitive 20) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:976 — panel.handleStreamEvent has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · assets.renderAssetCoverage (cognitive 20) · ×1
  • assets.renderAssetCoverage (cognitive 20) REDACTED:523 — assets.renderAssetCoverage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (7 pts), ternaries 4 (7 pts), boolean chains 6 (nesting depth added 5). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · assets.ensureAssetEditorInteractions (cognitive 20) · ×1
  • assets.ensureAssetEditorInteractions (cognitive 20) REDACTED:1499 — assets.ensureAssetEditorInteractions has cognitive complexity 20 (threshold 15). Drivers by points: if/else 13, boolean chains 7. Most of this is not in the body itself: 1 of the 20 points is its own statement and the rest belongs to 6 function literals inside it that branch (lines 1516, 1511, 1505, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · chat.document.addEventListener("DOMContentLoaded") (cognitive 20) · ×1
  • chat.document.addEventListener("DOMContentLoaded") (cognitive 20) web/static/js/chat.js:11245 — chat.document.addEventListener("DOMContentLoaded") has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 11291, 11277, 11265, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · monitor.renderInlineWorkflowHitlApproval (cognitive 20) · ×1
  • monitor.renderInlineWorkflowHitlApproval (cognitive 20) web/static/js/monitor.js:5085 — monitor.renderInlineWorkflowHitlApproval has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 6, ternaries 2, error handling 1. Most of this is not in the body itself: 9 of the 20 points are its own statements and the rest belongs to one function item inside it that branches (submit). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · monitor.formatExecutionDuration (cognitive 20) · ×1
  • monitor.formatExecutionDuration (cognitive 20) web/static/js/monitor.js:9499 — monitor.formatExecutionDuration has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 7 (12 pts), if/else 6 (7 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.
D2 · Cognitive Complexity · skills.wireSkillModalOnce (cognitive 20) · ×1
  • skills.wireSkillModalOnce (cognitive 20) web/static/js/skills.js:455 — skills.wireSkillModalOnce has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 3 (nesting depth added 6). Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 466, 462, 463). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · saveAsset (cognitive 20) · ×1
  • saveAsset (cognitive 20) REDACTED:1593 — saveAsset has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 4, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · copyMessageToClipboard (cognitive 20) · ×1
  • copyMessageToClipboard (cognitive 20) web/static/js/chat.js:3697 — copyMessageToClipboard has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), error handling 3 (4 pts), ternaries 2 (4 pts), boolean chains 2 (nesting depth added 6). Of this number, 10 points are the body's own statements and 10 belong to 4 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.
D2 · Cognitive Complexity · ensureMcpCallSectionChrome (cognitive 20) · ×1
  • ensureMcpCallSectionChrome (cognitive 20) web/static/js/chat.js:5212 — ensureMcpCallSectionChrome has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 19 points are the body's own statements and 1 belongs to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · (anonymous) (cognitive 20) · ×1
  • (anonymous) (cognitive 20) web/static/js/chat.js:11245 — (anonymous) has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 11291, 11277, 11265, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderRecentEvents (cognitive 20) · ×1
  • renderRecentEvents (cognitive 20) web/static/js/dashboard.js:950 — renderRecentEvents has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 4. Most of this is not in the body itself: 5 of the 20 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 983, 966, 958). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · submitWorkflowHitlDecisionFromPage (cognitive 20) · ×1
  • submitWorkflowHitlDecisionFromPage (cognitive 20) web/static/js/hitl.js:855 — submitWorkflowHitlDecisionFromPage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 3 (6 pts), boolean chains 5, error handling 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.
D2 · Cognitive Complexity · parseFofaNaturalLanguage (cognitive 20) · ×1
  • parseFofaNaturalLanguage (cognitive 20) web/static/js/info-collect.js:789 — parseFofaNaturalLanguage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 3). Of this number, 19 points are the body's own statements and 1 belongs 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.
D2 · Cognitive Complexity · searchKnowledgeItems (cognitive 20) · ×1
  • searchKnowledgeItems (cognitive 20) REDACTED:732 — searchKnowledgeItems has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 2 (5 pts), boolean chains 3, error handling 1 (nesting depth added 4). Of this number, 19 points are the body's own statements and 1 belongs to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · submitUserInterruptContinue (cognitive 20) · ×1
  • submitUserInterruptContinue (cognitive 20) web/static/js/monitor.js:1408 — submitUserInterruptContinue has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (10 pts), boolean chains 5, if/else 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.
D2 · Cognitive Complexity · refreshLastAssistantProcessDetails (cognitive 20) · ×1
  • refreshLastAssistantProcessDetails (cognitive 20) web/static/js/monitor.js:5487 — refreshLastAssistantProcessDetails has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, error handling 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · renderRoleToolsPagination (cognitive 20) · ×1
  • renderRoleToolsPagination (cognitive 20) web/static/js/roles.js:992 — renderRoleToolsPagination has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12, boolean chains 5, if/else 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.
D2 · Cognitive Complexity · fillVisionConfigFromCurrent (cognitive 20) · ×1
  • fillVisionConfigFromCurrent (cognitive 20) web/static/js/settings.js:2318 — fillVisionConfigFromCurrent has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, ternaries 3 (5 pts), if/else 4 (nesting depth added 2). Of this number, 16 points are the body's own statements and 4 belong to one function item inside it that branches. 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.
D2 · Cognitive Complexity · ensureAIConfigShape (cognitive 20) · ×1
  • ensureAIConfigShape (cognitive 20) web/static/js/settings.js:2604 — ensureAIConfigShape has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 13, ternaries 4 (6 pts), if/else 1 (nesting depth added 2). 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.
D2 · Cognitive Complexity · syncHitlAuditBackendUI (cognitive 20) · ×1
  • syncHitlAuditBackendUI (cognitive 20) web/static/js/settings.js:3764 — syncHitlAuditBackendUI has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 8, boolean chains 1 (nesting depth added 5). Of this number, 18 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderSkillsList (cognitive 20) · ×1
  • renderSkillsList (cognitive 20) web/static/js/skills.js:143 — renderSkillsList has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 6, if/else 4 (5 pts) (nesting depth added 2). Most of this is not in the body itself: 6 of the 20 points are its own statements and the rest belongs to 10 function literals inside it that branch (lines 162, 211, 176, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadTasks (cognitive 20) · ×1
  • loadTasks (cognitive 20) web/static/js/tasks.js:227 — loadTasks has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (7 pts), error handling 3 (4 pts) (nesting depth added 2). Of this number, 15 points are the body's own statements and 5 belong to 5 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.
D2 · Cognitive Complexity · renderBatchQueuesPagination (cognitive 20) · ×1
  • renderBatchQueuesPagination (cognitive 20) web/static/js/tasks.js:1681 — renderBatchQueuesPagination has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · startInlineEditSchedule (cognitive 20) · ×1
  • startInlineEditSchedule (cognitive 20) web/static/js/tasks.js:2812 — startInlineEditSchedule has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 3, ternaries 3 (nesting depth added 4). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (a function literal at line 2817, a function literal at line 2838, a function literal at line 2844, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · createTerminalInContainer (cognitive 20) · ×1
  • createTerminalInContainer (cognitive 20) web/static/js/terminal.js:185 — createTerminalInContainer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10, error handling 3 (6 pts), boolean chains 4 (nesting depth added 3). Most of this is not in the body itself: 8 of the 20 points are its own statements and the rest belongs to 7 function items inside it that branch (sendToWS, sendResize, a function literal at line 233, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · wsInitAgentMode (cognitive 20) · ×1
  • wsInitAgentMode (cognitive 20) web/static/js/webshell.js:284 — wsInitAgentMode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 2 (3 pts), error handling 1 (nesting depth added 4). Most of this is not in the body itself: 2 of the 20 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 286, 294, 286, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderDirectoryTree · ×1
  • renderDirectoryTree::renderNode (cognitive 20) web/static/js/webshell.js:4614 — renderDirectoryTree::renderNode has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 12, boolean chains 5, loops 1 (2 pts), if/else 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · agent.MessagesToTraceJSON (cognitive 19) · ×1
  • agent.MessagesToTraceJSON (cognitive 19) internal/agent/agent_trace.go:257 — agent.MessagesToTraceJSON has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · agentruntime.ResolveWorker (cognitive 19) · ×1
  • agentruntime.ResolveWorker (cognitive 19) internal/agentruntime/pi.go:41 — agentruntime.ResolveWorker has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 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.
D2 · Cognitive Complexity · WebSocketListener.handleConn (cognitive 19) · ×1
  • WebSocketListener.handleConn (cognitive 19) REDACTED:151 — WebSocketListener.handleConn has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 2 (4 pts), loops 2, boolean chains 1 (nesting depth added 7). Of this number, 16 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OpenAIConfig.EffectiveMaxTotalTokens (cognitive 19) · ×1
  • OpenAIConfig.EffectiveMaxTotalTokens (cognitive 19) internal/config/context_profile.go:74 — OpenAIConfig.EffectiveMaxTotalTokens 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.
D2 · Cognitive Complexity · handler.decodeSpaceSearchRows (cognitive 19) · ×1
  • handler.decodeSpaceSearchRows (cognitive 19) REDACTED:876 — handler.decodeSpaceSearchRows has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), match/switch 2 (4 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RoleHandler.saveConfig (cognitive 19) · ×1
  • RoleHandler.saveConfig (cognitive 19) REDACTED:326 — RoleHandler.saveConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SkillsHandler.saveRolesConfig (cognitive 19) · ×1
  • SkillsHandler.saveRolesConfig (cognitive 19) internal/handler/skills.go:607 — SkillsHandler.saveRolesConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VulnerabilityHandler.CreateVulnerability (cognitive 19) · ×1
  • VulnerabilityHandler.CreateVulnerability (cognitive 19) REDACTED:59 — VulnerabilityHandler.CreateVulnerability has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Indexer.indexItemIDs (cognitive 19) · ×1
  • Indexer.indexItemIDs (cognitive 19) internal/knowledge/indexer.go:311 — Indexer.indexItemIDs has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 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.
D2 · Cognitive Complexity · knowledgePipelineRetriever.Retrieve (cognitive 19) · ×1
  • knowledgePipelineRetriever.Retrieve (cognitive 19) internal/knowledge/retrieval_pipeline.go:30 — knowledgePipelineRetriever.Retrieve has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · multiagent.piHistoryJSON (cognitive 19) · ×1
  • multiagent.piHistoryJSON (cognitive 19) internal/multiagent/pi_memory.go:16 — multiagent.piHistoryJSON has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (5 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · multiagent.piModelConfig (cognitive 19) · ×1
  • multiagent.piModelConfig (cognitive 19) internal/multiagent/pi_model.go:10 — multiagent.piModelConfig has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, 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.
D2 · Cognitive Complexity · Client.claudeRequest (cognitive 19) · ×1
  • Client.claudeRequest (cognitive 19) internal/openai/claude_native.go:108 — Client.claudeRequest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2, 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.
D2 · Cognitive Complexity · Cleaner.evaluate (cognitive 19) · ×1
  • Cleaner.evaluate (cognitive 19) internal/storage/cleaner.go:294 — Cleaner.evaluate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 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.
D2 · Cognitive Complexity · update.validateBuildFiles (cognitive 19) · ×1
  • update.validateBuildFiles (cognitive 19) internal/update/recovery_evidence.go:184 — update.validateBuildFiles has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.check (cognitive 19) · ×1
  • update.check (cognitive 19) internal/update/update.go:393 — update.check has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 2, loops 1 (2 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.
D2 · Cognitive Complexity · mcp_pent_claude_agent._run_claude_agent (cognitive 19) · ×1
  • mcp_pent_claude_agent._run_claude_agent (cognitive 19) mcp-servers/pent_claude_agent/mcp_pent_claude_agent.py:114 — mcp_pent_claude_agent._run_claude_agent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (3 pts), 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.
D2 · Cognitive Complexity · panel.onSendConfirmed (cognitive 19) · ×1
  • panel.onSendConfirmed (cognitive 19) plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:904 — panel.onSendConfirmed has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), error handling 2 (nesting depth added 2). 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.
D2 · Cognitive Complexity · network.modelFetch (cognitive 19) · ×1
  • network.modelFetch (cognitive 19) runtime/pi/src/network.ts:13 — network.modelFetch has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 5, ternaries 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · c2.C2.setSessionSleep (cognitive 19) · ×1
  • c2.C2.setSessionSleep (cognitive 19) web/static/js/c2.js:1753 — c2.C2.setSessionSleep has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, boolean chains 7, ternaries 4. Of this number, 16 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · chat-files.copyChatFolderPathFromBrowse (cognitive 19) · ×1
  • chat-files.copyChatFolderPathFromBrowse (cognitive 19) web/static/js/chat-files.js:1427 — chat-files.copyChatFolderPathFromBrowse has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 3 (7 pts), if/else 5 (6 pts), boolean chains 4, error handling 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · chat.loadProjectFilterLocalOptions (cognitive 19) · ×1
  • chat.loadProjectFilterLocalOptions (cognitive 19) web/static/js/chat.js:9249 — chat.loadProjectFilterLocalOptions has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 2, error handling 1 (nesting depth added 1). Of this number, 17 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · info-collect.initInfoCollectProviderSelect (cognitive 19) · ×1
  • info-collect.initInfoCollectProviderSelect (cognitive 19) web/static/js/info-collect.js:445 — info-collect.initInfoCollectProviderSelect has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13, boolean chains 5, ternaries 1. Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 494, 523, 486, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · info-collect.inferTargetFromRow (cognitive 19) · ×1
  • info-collect.inferTargetFromRow (cognitive 19) web/static/js/info-collect.js:1155 — info-collect.inferTargetFromRow has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 5 (7 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.
D2 · Cognitive Complexity · info-collect.exportFofaResults (cognitive 19) · ×1
  • info-collect.exportFofaResults (cognitive 19) web/static/js/info-collect.js:1502 — info-collect.exportFofaResults has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (5 pts), ternaries 3 (5 pts) (nesting depth added 3). Of this number, 12 points are the body's own statements and 7 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.findToolCallItemForHitl (cognitive 19) · ×1
  • monitor.findToolCallItemForHitl (cognitive 19) web/static/js/monitor.js:4585 — monitor.findToolCallItemForHitl has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (7 pts), ternaries 3 (4 pts), 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.
D2 · Cognitive Complexity · monitor.renderMcpTimelineActiveMoments (cognitive 19) · ×1
  • monitor.renderMcpTimelineActiveMoments (cognitive 19) web/static/js/monitor.js:8051 — monitor.renderMcpTimelineActiveMoments has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, ternaries 4, if/else 2. Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 8063, 8057, 8056). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · monitor.bindMonitorStatsPanelEvents (cognitive 19) · ×1
  • monitor.bindMonitorStatsPanelEvents (cognitive 19) web/static/js/monitor.js:8640 — monitor.bindMonitorStatsPanelEvents has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 5, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 8644, 8664, 8686, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · notifications.renderNotificationList (cognitive 19) · ×1
  • notifications.renderNotificationList (cognitive 19) web/static/js/notifications.js:199 — notifications.renderNotificationList has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 3. Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 207, 227, 243, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · projects.createVulnerabilityFromCurrentFact (cognitive 19) · ×1
  • projects.createVulnerabilityFromCurrentFact (cognitive 19) web/static/js/projects.js:1745 — projects.createVulnerabilityFromCurrentFact has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 7. 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.
D2 · Cognitive Complexity · projects.showProjectConversationPreview (cognitive 19) · ×1
  • projects.showProjectConversationPreview (cognitive 19) web/static/js/projects.js:3133 — projects.showProjectConversationPreview has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 4 (10 pts), boolean chains 6, if/else 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · projects.syncProjectConversationApprovalStatuses (cognitive 19) · ×1
  • projects.syncProjectConversationApprovalStatuses (cognitive 19) web/static/js/projects.js:3697 — projects.syncProjectConversationApprovalStatuses has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 5 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 3708, 3699). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · storage.renderResult (cognitive 19) · ×1
  • storage.renderResult (cognitive 19) web/static/js/storage.js:218 — storage.renderResult has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 13, ternaries 4, if/else 2. Of this number, 10 points are the body's own statements and 9 belong to 2 function literals inside it that branch. To reduce it, 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.
D2 · Cognitive Complexity · tool-guard.addRule (cognitive 19) · ×1
  • tool-guard.addRule (cognitive 19) web/static/js/tool-guard.js:402 — tool-guard.addRule has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, ternaries 1 (nesting depth added 3). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 430, 429, 433). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · loadMarkdownAgents (cognitive 19) · ×1
  • loadMarkdownAgents (cognitive 19) web/static/js/agents.js:34 — loadMarkdownAgents has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (6 pts), if/else 4, error handling 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 8 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · editMarkdownAgent (cognitive 19) · ×1
  • editMarkdownAgent (cognitive 19) web/static/js/agents.js:112 — editMarkdownAgent has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 5, ternaries 3 (4 pts), error handling 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 128). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · showAuditLogDetail (cognitive 19) · ×1
  • showAuditLogDetail (cognitive 19) web/static/js/audit.js:678 — showAuditLogDetail has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 6, error handling 1 (nesting depth added 1). Of this number, 11 points are the body's own statements and 8 belong to 4 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderTasks (cognitive 19) · ×1
  • renderTasks (cognitive 19) web/static/js/c2.js:3520 — renderTasks has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 6, boolean chains 5 (nesting depth added 1). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 3563). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · finishProcessDetailsRender (cognitive 19) · ×1
  • finishProcessDetailsRender (cognitive 19) web/static/js/chat.js:4542 — finishProcessDetailsRender has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 7, ternaries 2 (4 pts) (nesting depth added 3). Of this number, 16 points are the body's own statements and 3 belong to 3 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · showRetrievalLogDetailsModal (cognitive 19) · ×1
  • showRetrievalLogDetailsModal (cognitive 19) REDACTED:1822 — showRetrievalLogDetailsModal has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 5 (6 pts), boolean chains 5 (nesting depth added 3). 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 1852, 1858). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · setMcpStatsDistHover (cognitive 19) · ×1
  • setMcpStatsDistHover (cognitive 19) web/static/js/monitor.js:8441 — setMcpStatsDistHover has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (8 pts), ternaries 1 (nesting depth added 3). Of this number, 13 points are the body's own statements and 6 belong to 2 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.
D2 · Cognitive Complexity · appendChatProjectConversationItem (cognitive 19) · ×1
  • appendChatProjectConversationItem (cognitive 19) web/static/js/projects.js:3319 — appendChatProjectConversationItem has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11, boolean chains 6, ternaries 2. Of this number, 10 points are the body's own statements and 9 belong to 6 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderChatProjectFolders (cognitive 19) · ×1
  • renderChatProjectFolders (cognitive 19) web/static/js/projects.js:3555 — renderChatProjectFolders has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 5 (7 pts), boolean chains 4 (nesting depth added 3). Of this number, 14 points are the body's own statements and 5 belong to 6 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.
D2 · Cognitive Complexity · renderRbacAssignments (cognitive 19) · ×1
  • renderRbacAssignments (cognitive 19) web/static/js/rbac.js:850 — renderRbacAssignments has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 5, ternaries 2. Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 870, 888, 854). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderRoleToolsList (cognitive 19) · ×1
  • renderRoleToolsList (cognitive 19) web/static/js/roles.js:908 — renderRoleToolsList has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 4 (6 pts) (nesting depth added 2). Most of this is not in the body itself: 4 of the 19 points are its own statements and the rest belongs to one function literal inside it that branches (line 941). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · updateRoleToolsStats (cognitive 19) · ×1
  • updateRoleToolsStats (cognitive 19) web/static/js/roles.js:1184 — updateRoleToolsStats has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6, ternaries 3 (nesting depth added 3). Most of this is not in the body itself: 7 of the 19 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1215, 1210). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderAIChannelList (cognitive 19) · ×1
  • renderAIChannelList (cognitive 19) web/static/js/settings.js:2869 — renderAIChannelList has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, ternaries 6, if/else 5. Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 4 function items inside it that branch (a function literal at line 2873, (anonymous)::onkeydown, (anonymous)::onclick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · startInlineEditHITLPolicy (cognitive 19) · ×1
  • startInlineEditHITLPolicy (cognitive 19) web/static/js/tasks.js:2982 — startInlineEditHITLPolicy has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 7, if/else 7, error handling 3 (4 pts), ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 8 of the 19 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 2998, 2992, 2995, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · ensureTerminalWS (cognitive 19) · ×1
  • ensureTerminalWS (cognitive 19) web/static/js/terminal.js:123 — ensureTerminalWS has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), error handling 2 (4 pts), boolean chains 3 (nesting depth added 4). Most of this is not in the body itself: 6 of the 19 points are its own statements and the rest belongs to 5 function items inside it that branch (onopen, onmessage, onclose, …). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · renderUpdateApplyBody (cognitive 19) · ×1
  • renderUpdateApplyBody (cognitive 19) web/static/js/update.js:823 — renderUpdateApplyBody has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, if/else 8, ternaries 3. Of this number, 15 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · loadVulnerabilityAlertSubscription (cognitive 19) · ×1
  • loadVulnerabilityAlertSubscription (cognitive 19) web/static/js/vulnerability.js:2014 — loadVulnerabilityAlertSubscription has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 4). Of this number, 16 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · applyWebshellAiProjectSelection (cognitive 19) · ×1
  • applyWebshellAiProjectSelection (cognitive 19) web/static/js/webshell.js:493 — applyWebshellAiProjectSelection has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (5 pts), boolean chains 3, ternaries 1 (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.
D2 · Cognitive Complexity · fetchAndRenderWebshellAiConvList (cognitive 19) · ×1
  • fetchAndRenderWebshellAiConvList (cognitive 19) web/static/js/webshell.js:2342 — fetchAndRenderWebshellAiConvList has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, error handling 3 (4 pts), ternaries 1 (nesting depth added 4). Most of this is not in the body itself: 3 of the 19 points are its own statements and the rest belongs to 8 function literals inside it that branch (lines 2370, 2349, 2365, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · selectWorkflowElement (cognitive 19) · ×1
  • selectWorkflowElement (cognitive 19) web/static/js/workflows.js:942 — selectWorkflowElement has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (5 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.
D2 · Cognitive Complexity · app.registerC2SessionTool (cognitive 18) · ×1
  • app.registerC2SessionTool (cognitive 18) internal/app/c2_tools.go:237 — app.registerC2SessionTool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (2 pts), match/switch 1 (nesting depth added 8). None of this is in the body itself: all 18 points belong to one function literal inside it that branches (line 264). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · c2.GenerateOneliner (cognitive 18) · ×1
  • c2.GenerateOneliner (cognitive 18) internal/c2/payload_oneliner.go:107 — c2.GenerateOneliner has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), 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.
D2 · Cognitive Complexity · TCPReverseListener.taskDispatcherLoop (cognitive 18) · ×1
  • TCPReverseListener.taskDispatcherLoop (cognitive 18) internal/c2/listener_tcp.go:245 — TCPReverseListener.taskDispatcherLoop has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 1 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · WebSocketListener.taskDispatcherLoop (cognitive 18) · ×1
  • WebSocketListener.taskDispatcherLoop (cognitive 18) REDACTED:240 — WebSocketListener.taskDispatcherLoop has cognitive complexity 18 (threshold 15). Drivers by points: loops 4 (11 pts), if/else 1 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · DB.MergeAssets (cognitive 18) · ×1
  • DB.MergeAssets (cognitive 18) internal/database/asset.go:1113 — DB.MergeAssets has cognitive complexity 18 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 3, loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DB.FinalizeStaleRunningToolExecutions (cognitive 18) · ×1
  • DB.FinalizeStaleRunningToolExecutions (cognitive 18) REDACTED:644 — DB.FinalizeStaleRunningToolExecutions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.UpsertProjectFact (cognitive 18) · ×1
  • DB.UpsertProjectFact (cognitive 18) internal/database/project.go:505 — DB.UpsertProjectFact has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · DB.MergeVulnerabilities (cognitive 18) · ×1
  • DB.MergeVulnerabilities (cognitive 18) internal/database/vulnerability_workspace.go:171 — DB.MergeVulnerabilities has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 2, 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.
D2 · Cognitive Complexity · handler.addModelContextToResponse (cognitive 18) · ×1
  • handler.addModelContextToResponse (cognitive 18) internal/handler/config.go:1300 — handler.addModelContextToResponse has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · handler.extractFirstJSONObject (cognitive 18) · ×1
  • handler.extractFirstJSONObject (cognitive 18) internal/handler/hitl_audit_agent.go:219 — handler.extractFirstJSONObject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (15 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.runSingleJSON (cognitive 18) · ×1
  • AgentHandler.runSingleJSON (cognitive 18) internal/handler/agent_single_json_runner.go:11 — AgentHandler.runSingleJSON has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.auditAgentReview (cognitive 18) · ×1
  • AgentHandler.auditAgentReview (cognitive 18) internal/handler/hitl_audit_agent.go:23 — AgentHandler.auditAgentReview has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AgentHandler.collectHitlCognition (cognitive 18) · ×1
  • AgentHandler.collectHitlCognition (cognitive 18) internal/handler/hitl_context.go:40 — AgentHandler.collectHitlCognition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 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.
D2 · Cognitive Complexity · BatchTaskManager.UpdateQueueMetadata (cognitive 18) · ×1
  • BatchTaskManager.UpdateQueueMetadata (cognitive 18) internal/handler/batch_task_manager.go:759 — BatchTaskManager.UpdateQueueMetadata has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ChatUploadsHandler.Mkdir (cognitive 18) · ×1
  • ChatUploadsHandler.Mkdir (cognitive 18) REDACTED:1205 — ChatUploadsHandler.Mkdir has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · HITLManager.popApprovedInterruptForTool (cognitive 18) · ×1
  • HITLManager.popApprovedInterruptForTool (cognitive 18) internal/handler/hitl_execution.go:49 — HITLManager.popApprovedInterruptForTool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 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.
D2 · Cognitive Complexity · RobotHandler.cmdVulnerabilityAlerts (cognitive 18) · ×1
  • RobotHandler.cmdVulnerabilityAlerts (cognitive 18) internal/handler/vulnerability_alert.go:168 — RobotHandler.cmdVulnerabilityAlerts has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkflowHandler.CreatePackageInspection (cognitive 18) · ×1
  • WorkflowHandler.CreatePackageInspection (cognitive 18) internal/handler/workflow_package.go:58 — WorkflowHandler.CreatePackageInspection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 13 (16 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.
D2 · Cognitive Complexity · Manager.GetItem (cognitive 18) · ×1
  • Manager.GetItem (cognitive 18) internal/knowledge/manager.go:541 — Manager.GetItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 2 (4 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Manager.UpdateItem (cognitive 18) · ×1
  • Manager.UpdateItem (cognitive 18) internal/knowledge/manager.go:636 — Manager.UpdateItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (18 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.
D2 · Cognitive Complexity · ExternalMCPManager.startClient (cognitive 18) · ×1
  • ExternalMCPManager.startClient (cognitive 18) internal/mcp/external_manager.go:315 — ExternalMCPManager.startClient has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 2 (nesting depth added 5). Of this number, 14 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Server.HandleStdio (cognitive 18) · ×1
  • Server.HandleStdio (cognitive 18) internal/mcp/server.go:1678 — Server.HandleStdio has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (17 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.
D2 · Cognitive Complexity · project.ParseLinksFromBody (cognitive 18) · ×1
  • project.ParseLinksFromBody (cognitive 18) internal/project/fact_body_links.go:19 — project.ParseLinksFromBody has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 3 (nesting depth added 5). Of this number, 15 points are the body's own statements and 3 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · project.BuildScopeBlock (cognitive 18) · ×1
  • project.BuildScopeBlock (cognitive 18) internal/project/scope_block.go:20 — project.BuildScopeBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 2 (4 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.
D2 · Cognitive Complexity · skillpackage.buildSummaryMarkdown (cognitive 18) · ×1
  • skillpackage.buildSummaryMarkdown (cognitive 18) internal/skillpackage/content.go:106 — skillpackage.buildSummaryMarkdown has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 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.
D2 · Cognitive Complexity · Cleaner.buildReport (cognitive 18) · ×1
  • Cleaner.buildReport (cognitive 18) internal/storage/cleaner.go:407 — Cleaner.buildReport has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (5 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.
D2 · Cognitive Complexity · workflow.matchDraftTool (cognitive 18) · ×1
  • workflow.matchDraftTool (cognitive 18) internal/workflow/draft_generator.go:691 — workflow.matchDraftTool has cognitive complexity 18 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.validateConditionAtom (cognitive 18) · ×1
  • workflow.validateConditionAtom (cognitive 18) internal/workflow/expression.go:30 — workflow.validateConditionAtom has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.runToolNode (cognitive 18) · ×1
  • workflow.runToolNode (cognitive 18) internal/workflow/nodes.go:57 — workflow.runToolNode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 2 (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.
D2 · Cognitive Complexity · workflow.ResumeWorkflowRun (cognitive 18) · ×1
  • workflow.ResumeWorkflowRun (cognitive 18) internal/workflow/resume.go:11 — workflow.ResumeWorkflowRun has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 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.
D2 · Cognitive Complexity · workflow.validateReachability (cognitive 18) · ×1
  • workflow.validateReachability (cognitive 18) internal/workflow/validation.go:270 — workflow.validateReachability has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 5). Of this number, 11 points are the body's own statements and 7 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · worker.command (cognitive 18) · ×1
  • worker.command (cognitive 18) runtime/pi/src/worker.ts:328 — worker.command has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 2, loops 1 (2 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.
D2 · Cognitive Complexity · audit.auditMessageLabel (cognitive 18) · ×1
  • audit.auditMessageLabel (cognitive 18) web/static/js/audit.js:65 — audit.auditMessageLabel has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts) (nesting depth added 3). 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.
D2 · Cognitive Complexity · c2.C2.viewTask (cognitive 18) · ×1
  • c2.C2.viewTask (cognitive 18) web/static/js/c2.js:3612 — c2.C2.viewTask has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 7. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (renderTaskModal, a function literal at line 3716, a function literal at line 3723). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · info-collect.scanFofaRow (cognitive 18) · ×1
  • info-collect.scanFofaRow (cognitive 18) web/static/js/info-collect.js:1289 — info-collect.scanFofaRow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, error handling 2 (nesting depth added 2). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 1314). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · monitor.finalizeMainResponseStreamItem (cognitive 18) · ×1
  • monitor.finalizeMainResponseStreamItem (cognitive 18) web/static/js/monitor.js:310 — monitor.finalizeMainResponseStreamItem has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 2. 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.
D2 · Cognitive Complexity · monitor.applyStreamPlainTextNow (cognitive 18) · ×1
  • monitor.applyStreamPlainTextNow (cognitive 18) web/static/js/monitor.js:932 — monitor.applyStreamPlainTextNow has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.buildToolResultSectionHtml (cognitive 18) · ×1
  • monitor.buildToolResultSectionHtml (cognitive 18) web/static/js/monitor.js:5988 — monitor.buildToolResultSectionHtml has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9 (15 pts), boolean chains 2, if/else 1 (nesting depth added 6). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · projects.selectProject (cognitive 18) · ×1
  • projects.selectProject (cognitive 18) web/static/js/projects.js:994 — projects.selectProject has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 6, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · roles.initSelectionDetailTooltip (cognitive 18) · ×1
  • roles.initSelectionDetailTooltip (cognitive 18) web/static/js/roles.js:177 — roles.initSelectionDetailTooltip has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 7, ternaries 1. Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 6 function items inside it that branch (positionTooltip, a function literal at line 217, a function literal at line 222, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · settings.collectHitlAuditModelEffectiveConfig (cognitive 18) · ×1
  • settings.collectHitlAuditModelEffectiveConfig (cognitive 18) web/static/js/settings.js:3801 — settings.collectHitlAuditModelEffectiveConfig has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, ternaries 2 (3 pts) (nesting depth added 1). 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.
D2 · Cognitive Complexity · vulnerability.renderVulnerabilities (cognitive 18) · ×1
  • vulnerability.renderVulnerabilities (cognitive 18) web/static/js/vulnerability.js:1370 — vulnerability.renderVulnerabilities has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 3 (4 pts) (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.
D2 · Cognitive Complexity · vulnerability.editVulnerability (cognitive 18) · ×1
  • vulnerability.editVulnerability (cognitive 18) web/static/js/vulnerability.js:1793 — vulnerability.editVulnerability has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 16, error handling 1, if/else 1. Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to one function literal inside it that branches (line 1801). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · workflows.workflowAiAnimateGraph (cognitive 18) · ×1
  • workflows.workflowAiAnimateGraph (cognitive 18) web/static/js/workflows.js:1800 — workflows.workflowAiAnimateGraph has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, ternaries 3, loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · submitSessionSleep (cognitive 18) · ×1
  • submitSessionSleep (cognitive 18) web/static/js/c2.js:1917 — submitSessionSleep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, error handling 2 (3 pts), ternaries 1 (nesting depth added 2). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 3 function items inside it that branch (a function literal at line 1935, (anonymous)::after, a function literal at line 1955). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · saveSessionNote (cognitive 18) · ×1
  • saveSessionNote (cognitive 18) web/static/js/c2.js:2006 — saveSessionNote has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, ternaries 2 (3 pts), error handling 1 (nesting depth added 2). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 2017, 2036, 2024). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderTasksPagination (cognitive 18) · ×1
  • renderTasksPagination (cognitive 18) web/static/js/c2.js:3250 — renderTasksPagination has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, if/else 5 (6 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderEventsPagination (cognitive 18) · ×1
  • renderEventsPagination (cognitive 18) web/static/js/c2.js:4188 — renderEventsPagination has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 9, if/else 5 (6 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · setupChatFilesDragDrop (cognitive 18) · ×1
  • setupChatFilesDragDrop (cognitive 18) web/static/js/chat-files.js:1911 — setupChatFilesDragDrop has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 1 (4 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 6). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 1930, 1937, 1917, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · syncAssistantReasoningContentFromServer (cognitive 18) · ×1
  • syncAssistantReasoningContentFromServer (cognitive 18) web/static/js/chat.js:3857 — syncAssistantReasoningContentFromServer has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, error handling 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 3). Of this number, 17 points are the body's own statements and 1 belongs to 3 function literals inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · copyDetailBlock (cognitive 18) · ×1
  • copyDetailBlock (cognitive 18) web/static/js/chat.js:5846 — copyDetailBlock has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 2, ternaries 2 (nesting depth added 1). Of this number, 10 points are the body's own statements and 8 belong to 6 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · formatFofaRowSummary (cognitive 18) · ×1
  • formatFofaRowSummary (cognitive 18) web/static/js/info-collect.js:1251 — formatFofaRowSummary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, boolean chains 4, ternaries 3 (4 pts), error handling 1 (2 pts) (nesting depth added 2). Most of this is not in the body itself: 4 of the 18 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 1272, 1257, 1264). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderInlineWorkflowHitlApproval · ×1
  • renderInlineWorkflowHitlApproval::submit (cognitive 18) web/static/js/monitor.js:5140 — renderInlineWorkflowHitlApproval::submit has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 6 (9 pts), boolean chains 6, if/else 2, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · appendChatProjectFolderItem (cognitive 18) · ×1
  • appendChatProjectFolderItem (cognitive 18) web/static/js/projects.js:3202 — appendChatProjectFolderItem has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7, ternaries 6 (7 pts), boolean chains 4 (nesting depth added 1). Of this number, 11 points are the body's own statements and 7 belong to 7 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · loadChatProjectFolderContext (cognitive 18) · ×1
  • loadChatProjectFolderContext (cognitive 18) web/static/js/projects.js:3413 — loadChatProjectFolderContext has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 4. Of this number, 11 points are the body's own statements and 7 belong to 4 function literals inside it that branch. To reduce it, 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.
D2 · Cognitive Complexity · applyChatProjectSelection (cognitive 18) · ×1
  • applyChatProjectSelection (cognitive 18) web/static/js/projects.js:3977 — applyChatProjectSelection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (5 pts), ternaries 1 (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.
D2 · Cognitive Complexity · mergeToolIntoRoleStateMap (cognitive 18) · ×1
  • mergeToolIntoRoleStateMap (cognitive 18) web/static/js/roles.js:721 — mergeToolIntoRoleStateMap has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 1 (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.
D2 · Cognitive Complexity · renderToolsPagination (cognitive 18) · ×1
  • renderToolsPagination (cognitive 18) web/static/js/settings.js:1674 — renderToolsPagination has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10, if/else 6, boolean chains 2. Of this number, 13 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · resolveSavedAIChannelId (cognitive 18) · ×1
  • resolveSavedAIChannelId (cognitive 18) web/static/js/settings.js:2990 — resolveSavedAIChannelId has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. Of this number, 10 points are the body's own statements and 8 belong to one function literal inside it that branches. 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.
D2 · Cognitive Complexity · viewSkill (cognitive 18) · ×1
  • viewSkill (cognitive 18) web/static/js/skills.js:658 — viewSkill has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, ternaries 4 (5 pts), if/else 4, error handling 2 (nesting depth added 1). Most of this is not in the body itself: 8 of the 18 points are its own statements and the rest belongs to 5 function items inside it that branch (a function literal at line 721, a function literal at line 682, close, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · renderSkillsMonitor (cognitive 18) · ×1
  • renderSkillsMonitor (cognitive 18) web/static/js/skills.js:968 — renderSkillsMonitor has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 3 (4 pts) (nesting depth added 1). Most of this is not in the body itself: 6 of the 18 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 1035, 1013). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · refreshBatchProjectSelectOptions (cognitive 18) · ×1
  • refreshBatchProjectSelectOptions (cognitive 18) web/static/js/tasks.js:859 — refreshBatchProjectSelectOptions has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 3 (5 pts), error handling 1 (nesting depth added 3). 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 into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · startInlineEditAgentMode (cognitive 18) · ×1
  • startInlineEditAgentMode (cognitive 18) web/static/js/tasks.js:2647 — startInlineEditAgentMode has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), ternaries 4, boolean chains 2 (nesting depth added 4). Most of this is not in the body itself: 2 of the 18 points are its own statements and the rest belongs to 6 function items inside it that branch (a function literal at line 2652, (anonymous)::onEscape, a function literal at line 2676, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · renderVulnerabilityPagination (cognitive 18) · ×1
  • renderVulnerabilityPagination (cognitive 18) web/static/js/vulnerability.js:1644 — renderVulnerabilityPagination has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 10, boolean chains 5, if/else 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.
D2 · Cognitive Complexity · vulnerabilityCopyEncoded (cognitive 18) · ×1
  • vulnerabilityCopyEncoded (cognitive 18) web/static/js/vulnerability.js:2170 — vulnerabilityCopyEncoded has cognitive complexity 18 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 5 (6 pts), boolean chains 4 (nesting depth added 5). Of this number, 10 points are the body's own statements and 8 belong to 3 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.
D2 · Cognitive Complexity · setWechatQrImage (cognitive 18) · ×1
  • setWechatQrImage (cognitive 18) web/static/js/wechat-robot.js:227 — setWechatQrImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 1 (nesting depth added 8). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · saveWorkflowDraft (cognitive 18) · ×1
  • saveWorkflowDraft (cognitive 18) web/static/js/workflows.js:2232 — saveWorkflowDraft has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, error handling 2 (3 pts), ternaries 3 (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.
D2 · Cognitive Complexity · refreshWorkflowsI18n (cognitive 18) · ×1
  • refreshWorkflowsI18n (cognitive 18) web/static/js/workflows.js:3078 — refreshWorkflowsI18n has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 2 (5 pts), boolean chains 3 (nesting depth added 4). Of this number, 16 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · app.mcpResourceProjectID (cognitive 17) · ×1
  • app.mcpResourceProjectID (cognitive 17) internal/app/mcp_authorization.go:333 — app.mcpResourceProjectID has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), 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.
D2 · Cognitive Complexity · Manager.IngestTaskResult (cognitive 17) · ×1
  • Manager.IngestTaskResult (cognitive 17) internal/c2/manager.go:713 — Manager.IngestTaskResult has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · database.scanConversationRows (cognitive 17) · ×1
  • database.scanConversationRows (cognitive 17) REDACTED:627 — database.scanConversationRows has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · database.vulnerabilityTargetHost (cognitive 17) · ×1
  • database.vulnerabilityTargetHost (cognitive 17) REDACTED:274 — database.vulnerabilityTargetHost has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6 (nesting depth added 1). 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.
D2 · Cognitive Complexity · DB.ListC2Tasks (cognitive 17) · ×1
  • DB.ListC2Tasks (cognitive 17) REDACTED:1142 — DB.ListC2Tasks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.PurgeToolExecutionsBefore (cognitive 17) · ×1
  • DB.PurgeToolExecutionsBefore (cognitive 17) REDACTED:839 — DB.PurgeToolExecutionsBefore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2, match/switch 1 (2 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.
D2 · Cognitive Complexity · DB.UpsertRBACRole (cognitive 17) · ×1
  • DB.UpsertRBACRole (cognitive 17) REDACTED:1041 — DB.UpsertRBACRole has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.migrateLegacyToolGuardBlocks (cognitive 17) · ×1
  • DB.migrateLegacyToolGuardBlocks (cognitive 17) internal/database/tool_guard_migration.go:38 — DB.migrateLegacyToolGuardBlocks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.assetListFilterFromQuery (cognitive 17) · ×1
  • handler.assetListFilterFromQuery (cognitive 17) internal/handler/asset.go:161 — handler.assetListFilterFromQuery has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · handler.auditAgentPickObject (cognitive 17) · ×1
  • handler.auditAgentPickObject (cognitive 17) internal/handler/hitl_audit_agent.go:285 — handler.auditAgentPickObject has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (11 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · AgentHandler.runBatchQueueWorker (cognitive 17) · ×1
  • AgentHandler.runBatchQueueWorker (cognitive 17) internal/handler/batch_queue_executor.go:49 — AgentHandler.runBatchQueueWorker has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (16 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.
D2 · Cognitive Complexity · C2Handler.UpdateListener (cognitive 17) · ×1
  • C2Handler.UpdateListener (cognitive 17) internal/handler/c2.go:154 — C2Handler.UpdateListener has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChatUploadsHandler.Delete (cognitive 17) · ×1
  • ChatUploadsHandler.Delete (cognitive 17) REDACTED:1153 — ChatUploadsHandler.Delete has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 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.
D2 · Cognitive Complexity · ConfigHandler.resolveProbeSecret (cognitive 17) · ×1
  • ConfigHandler.resolveProbeSecret (cognitive 17) internal/handler/config_secrets.go:143 — ConfigHandler.resolveProbeSecret has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), loops 2 (3 pts), boolean chains 2, match/switch 1 (nesting depth added 4). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FofaHandler.searchShodan (cognitive 17) · ×1
  • FofaHandler.searchShodan (cognitive 17) REDACTED:969 — FofaHandler.searchShodan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MonitorHandler.BatchGetToolNames (cognitive 17) · ×1
  • MonitorHandler.BatchGetToolNames (cognitive 17) internal/handler/monitor.go:684 — MonitorHandler.BatchGetToolNames has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MonitorHandler.DeleteExecution (cognitive 17) · ×1
  • MonitorHandler.DeleteExecution (cognitive 17) internal/handler/monitor.go:865 — MonitorHandler.DeleteExecution has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (17 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.
D2 · Cognitive Complexity · NotificationHandler.GetSummary (cognitive 17) · ×1
  • NotificationHandler.GetSummary (cognitive 17) REDACTED:691 — NotificationHandler.GetSummary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 2 (nesting depth added 3). 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, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · UpdateHandler.startJob (cognitive 17) · ×1
  • UpdateHandler.startJob (cognitive 17) internal/handler/update.go:393 — UpdateHandler.startJob has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1, loops 1 (nesting depth added 4). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to one function literal inside it that branches (line 423). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · WebShellHandler.UpdateConnection (cognitive 17) · ×1
  • WebShellHandler.UpdateConnection (cognitive 17) REDACTED:470 — WebShellHandler.UpdateConnection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 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.
D2 · Cognitive Complexity · WebShellHandler.Exec (cognitive 17) · ×1
  • WebShellHandler.Exec (cognitive 17) REDACTED:741 — WebShellHandler.Exec has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Manager.GetRetrievalLogs (cognitive 17) · ×1
  • Manager.GetRetrievalLogs (cognitive 17) internal/knowledge/manager.go:793 — Manager.GetRetrievalLogs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 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.
D2 · Cognitive Complexity · mcp.createSDKClient (cognitive 17) · ×1
  • mcp.createSDKClient (cognitive 17) internal/mcp/client_sdk.go:342 — mcp.createSDKClient has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (16 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.
D2 · Cognitive Complexity · Server.CallTool (cognitive 17) · ×1
  • Server.CallTool (cognitive 17) internal/mcp/server.go:923 — Server.CallTool has cognitive complexity 17 (threshold 15). Drivers by points: if/else 15 (16 pts), boolean chains 1 (nesting depth added 1). Of this number, 10 points are the body's own statements and 7 belong to 2 function literals inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · openai.patchNativeOpenAIReasoning (cognitive 17) · ×1
  • openai.patchNativeOpenAIReasoning (cognitive 17) internal/openai/native_reasoning_compat.go:17 — openai.patchNativeOpenAIReasoning has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · security.runCommandWithPTY (cognitive 17) · ×1
  • security.runCommandWithPTY (cognitive 17) internal/security/executor.go:1306 — security.runCommandWithPTY has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1, match/switch 1 (nesting depth added 5). Of this number, 14 points are the body's own statements and 3 belong to 2 function literals inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Executor.RegisterTools (cognitive 17) · ×1
  • Executor.RegisterTools (cognitive 17) internal/security/executor.go:284 — Executor.RegisterTools has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · skillpackage.ValidateAgentSkillManifest (cognitive 17) · ×1
  • skillpackage.ValidateAgentSkillManifest (cognitive 17) internal/skillpackage/validate.go:17 — skillpackage.ValidateAgentSkillManifest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 5, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · toolguard.candidateTexts (cognitive 17) · ×1
  • toolguard.candidateTexts (cognitive 17) internal/toolguard/toolguard.go:196 — toolguard.candidateTexts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), loops 4 (7 pts), match/switch 1 (nesting depth added 6). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function literals inside it that branch (lines 216, 199). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · vision.compressWithImaging (cognitive 17) · ×1
  • vision.compressWithImaging (cognitive 17) internal/vision/preprocess.go:121 — vision.compressWithImaging has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 2 (3 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.
D2 · Cognitive Complexity · workflow.parseJSONPathTokens (cognitive 17) · ×1
  • workflow.parseJSONPathTokens (cognitive 17) internal/workflow/jsonpath.go:65 — workflow.parseJSONPathTokens has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 2 (4 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · workflow.runHITLNode (cognitive 17) · ×1
  • workflow.runHITLNode (cognitive 17) internal/workflow/nodes.go:334 — workflow.runHITLNode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 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.
D2 · Cognitive Complexity · assets.fofaResultToAsset (cognitive 17) · ×1
  • assets.fofaResultToAsset (cognitive 17) REDACTED:1637 — assets.fofaResultToAsset has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 7 (8 pts), boolean chains 5, if/else 2 (3 pts), loops 1 (nesting depth added 2). Most of this is not in the body itself: 7 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (value, firstValue). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · c2.C2.renderEvents (cognitive 17) · ×1
  • c2.C2.renderEvents (cognitive 17) web/static/js/c2.js:4291 — c2.C2.renderEvents has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (8 pts) (nesting depth added 1). 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.
D2 · Cognitive Complexity · chat.openChatSystemModelView (cognitive 17) · ×1
  • chat.openChatSystemModelView (cognitive 17) web/static/js/chat.js:1433 — chat.openChatSystemModelView has cognitive complexity 17 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · chat.openChatSessionSettings (cognitive 17) · ×1
  • chat.openChatSessionSettings (cognitive 17) web/static/js/chat.js:1736 — chat.openChatSessionSettings has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, ternaries 1. 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, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · chat.setAssistantTurnTiming (cognitive 17) · ×1
  • chat.setAssistantTurnTiming (cognitive 17) web/static/js/chat.js:5119 — chat.setAssistantTurnTiming has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6, ternaries 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.
D2 · Cognitive Complexity · fact-graph.applyElkLayout (cognitive 17) · ×1
  • fact-graph.applyElkLayout (cognitive 17) web/static/js/fact-graph.js:484 — fact-graph.applyElkLayout has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8 (9 pts), boolean chains 6, if/else 2 (nesting depth added 1). Most of this is not in the body itself: 6 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 509, 532, 531). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · hitl.applyHitlDefaultConfigFromServer (cognitive 17) · ×1
  • hitl.applyHitlDefaultConfigFromServer (cognitive 17) web/static/js/hitl.js:266 — hitl.applyHitlDefaultConfigFromServer has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, ternaries 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.piMainStreamPlanningTitle (cognitive 17) · ×1
  • monitor.piMainStreamPlanningTitle (cognitive 17) web/static/js/monitor.js:180 — monitor.piMainStreamPlanningTitle has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.findRestoredMainResponseStreamItem (cognitive 17) · ×1
  • monitor.findRestoredMainResponseStreamItem (cognitive 17) web/static/js/monitor.js:550 — monitor.findRestoredMainResponseStreamItem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, ternaries 3, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.setHitlApprovalTaskAvailability (cognitive 17) · ×1
  • monitor.setHitlApprovalTaskAvailability (cognitive 17) web/static/js/monitor.js:1246 — monitor.setHitlApprovalTaskAvailability has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6 (nesting depth added 2). Of this number, 13 points are the body's own statements and 4 belong to one function literal inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · monitor.renderToolCallApprovalSummary (cognitive 17) · ×1
  • monitor.renderToolCallApprovalSummary (cognitive 17) web/static/js/monitor.js:4432 — monitor.renderToolCallApprovalSummary has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (6 pts), ternaries 2 (nesting depth added 1). 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.
D2 · Cognitive Complexity · monitor.renderDirectHitlSidebarApproval (cognitive 17) · ×1
  • monitor.renderDirectHitlSidebarApproval (cognitive 17) web/static/js/monitor.js:4923 — monitor.renderDirectHitlSidebarApproval has cognitive complexity 17 (threshold 15). Drivers by points: if/else 12 (14 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.
D2 · Cognitive Complexity · projects.getProjectApprovalTiming (cognitive 17) · ×1
  • projects.getProjectApprovalTiming (cognitive 17) web/static/js/projects.js:2659 — projects.getProjectApprovalTiming has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4, ternaries 4, error handling 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · projects.createProjectTaskStatus (cognitive 17) · ×1
  • projects.createProjectTaskStatus (cognitive 17) web/static/js/projects.js:2780 — projects.createProjectTaskStatus has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 5 (6 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.
D2 · Cognitive Complexity · roles.toggleRoleSelectionPanel (cognitive 17) · ×1
  • roles.toggleRoleSelectionPanel (cognitive 17) web/static/js/roles.js:490 — roles.toggleRoleSelectionPanel has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 1 (nesting depth added 7). Of this number, 11 points are the body's own statements and 6 belong to one function literal inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · update.renderUpdateRemoteBody (cognitive 17) · ×1
  • update.renderUpdateRemoteBody (cognitive 17) web/static/js/update.js:761 — update.renderUpdateRemoteBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · workflows.graphToElements (cognitive 17) · ×1
  • workflows.graphToElements (cognitive 17) web/static/js/workflows.js:185 — workflows.graphToElements has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 14, ternaries 3. Most of this is not in the body itself: 2 of the 17 points are its own statements and the rest belongs to 3 function literals inside it that branch (lines 186, 200, 209). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderAuditLogs (cognitive 17) · ×1
  • renderAuditLogs (cognitive 17) web/static/js/audit.js:315 — renderAuditLogs has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, ternaries 5, if/else 3. Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (a function literal at line 337, escapeHtml). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · generateRobotBindingCode (cognitive 17) · ×1
  • generateRobotBindingCode (cognitive 17) web/static/js/auth.js:803 — generateRobotBindingCode has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 3, error handling 2 (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.
D2 · Cognitive Complexity · chatFilesUploadFile (cognitive 17) · ×1
  • chatFilesUploadFile (cognitive 17) web/static/js/chat-files.js:1843 — chatFilesUploadFile has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 5, if/else 5, ternaries 3 (5 pts), error handling 2 (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.
D2 · Cognitive Complexity · uploadOneChatAttachment (cognitive 17) · ×1
  • uploadOneChatAttachment (cognitive 17) web/static/js/chat.js:2671 — uploadOneChatAttachment has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 4 (6 pts), boolean chains 2, error handling 2 (nesting depth added 3). Of this number, 16 points are the body's own statements and 1 belongs to 5 function items 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.
D2 · Cognitive Complexity · prefetchLastAssistantProcessDetails (cognitive 17) · ×1
  • prefetchLastAssistantProcessDetails (cognitive 17) web/static/js/chat.js:6319 — prefetchLastAssistantProcessDetails has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8, boolean chains 7, error handling 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderExternalMcpHealth (cognitive 17) · ×1
  • renderExternalMcpHealth (cognitive 17) web/static/js/dashboard.js:891 — renderExternalMcpHealth has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, other 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · switchHitlPageTab (cognitive 17) · ×1
  • switchHitlPageTab (cognitive 17) web/static/js/hitl.js:1056 — switchHitlPageTab has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 8 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · submitFofaSearch (cognitive 17) · ×1
  • submitFofaSearch (cognitive 17) web/static/js/info-collect.js:742 — submitFofaSearch has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), error handling 2, ternaries 1 (2 pts) (nesting depth added 2). 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.
D2 · Cognitive Complexity · requestFullscreenSafe (cognitive 17) · ×1
  • requestFullscreenSafe (cognitive 17) web/static/js/mobile-ui.js:718 — requestFullscreenSafe has cognitive complexity 17 (threshold 15). Drivers by points: error handling 4 (8 pts), if/else 4 (5 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · enableDrawerSwipe (cognitive 17) · ×1
  • enableDrawerSwipe (cognitive 17) web/static/js/mobile-ui.js:975 — enableDrawerSwipe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 1 of the 17 points is its own statement and the rest belongs to 3 function literals inside it that branch (lines 990, 1008, 982). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · batchDeleteExecutions (cognitive 17) · ×1
  • batchDeleteExecutions (cognitive 17) web/static/js/monitor.js:9451 — batchDeleteExecutions has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), error handling 3 (4 pts), if/else 3, boolean chains 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · renderRbacUsers (cognitive 17) · ×1
  • renderRbacUsers (cognitive 17) web/static/js/rbac.js:552 — renderRbacUsers has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 9 (11 pts), boolean chains 3, if/else 3 (nesting depth added 2). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 565, 559, 567, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · saveInlineConcurrency (cognitive 17) · ×1
  • saveInlineConcurrency (cognitive 17) web/static/js/tasks.js:2747 — saveInlineConcurrency has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 5 (6 pts), error handling 2 (3 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · configForRequest (cognitive 17) · ×1
  • configForRequest (cognitive 17) web/static/js/tool-guard.js:331 — configForRequest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 2 (5 pts), loops 2 (3 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.
D2 · Cognitive Complexity · revealValidationError (cognitive 17) · ×1
  • revealValidationError (cognitive 17) web/static/js/tool-guard.js:353 — revealValidationError has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 3 (5 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.
D2 · Cognitive Complexity · confirmVulnerabilityRetest (cognitive 17) · ×1
  • confirmVulnerabilityRetest (cognitive 17) web/static/js/vulnerability.js:2676 — confirmVulnerabilityRetest has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, error handling 2, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · runWebshellAiSend (cognitive 17) · ×1
  • runWebshellAiSend (cognitive 17) web/static/js/webshell.js:3383 — runWebshellAiSend has cognitive complexity 17 (threshold 15). Drivers by points: if/else 109 (226 pts), ternaries 59 (182 pts), boolean chains 97, error handling 6 (17 pts), loops 1 (nesting depth added 251). 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.
D2 · Cognitive Complexity · main.updateCommandIfNeeded (cognitive 16) · ×1
  • main.updateCommandIfNeeded (cognitive 16) cmd/server/update_cli.go:20 — main.updateCommandIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · app.setupRoutes (cognitive 16) · ×1
  • app.setupRoutes (cognitive 16) REDACTED:948 — app.setupRoutes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. None of this is in the body itself: all 16 points belong to 16 function literals inside it that branch (lines 1011, 1209, 1220, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · app.scopedProjectMemoryEdges (cognitive 16) · ×1
  • app.scopedProjectMemoryEdges (cognitive 16) internal/app/project_fact_tools.go:443 — app.scopedProjectMemoryEdges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 2 (3 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.
D2 · Cognitive Complexity · HTTPBeaconListener.handleFileServe (cognitive 16) · ×1
  • HTTPBeaconListener.handleFileServe (cognitive 16) internal/c2/listener_http.go:374 — HTTPBeaconListener.handleFileServe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionWatchdog.expireOfflineCommands (cognitive 16) · ×1
  • SessionWatchdog.expireOfflineCommands (cognitive 16) internal/c2/session_watchdog.go:92 — SessionWatchdog.expireOfflineCommands has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · config.RemoveVersion (cognitive 16) · ×1
  • config.RemoveVersion (cognitive 16) internal/config/config.go:1829 — config.RemoveVersion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DB.ReplaceIncomingProjectFactEdges (cognitive 16) · ×1
  • DB.ReplaceIncomingProjectFactEdges (cognitive 16) internal/database/project_fact_edges.go:196 — DB.ReplaceIncomingProjectFactEdges has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · handler.relocateManualOrNewUploadToConversation (cognitive 16) · ×1
  • handler.relocateManualOrNewUploadToConversation (cognitive 16) internal/handler/agent.go:505 — handler.relocateManualOrNewUploadToConversation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 3, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · handler.findBoolInMap (cognitive 16) · ×1
  • handler.findBoolInMap (cognitive 16) internal/handler/config.go:2839 — handler.findBoolInMap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AgentHandler.SubscribeAgentTaskEvents (cognitive 16) · ×1
  • AgentHandler.SubscribeAgentTaskEvents (cognitive 16) internal/handler/agent.go:1749 — AgentHandler.SubscribeAgentTaskEvents has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), 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.
D2 · Cognitive Complexity · AgentHandler.loadHistoryFromAgentTrace (cognitive 16) · ×1
  • AgentHandler.loadHistoryFromAgentTrace (cognitive 16) internal/handler/agent.go:2501 — AgentHandler.loadHistoryFromAgentTrace has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BatchTaskManager.GetAllQueues (cognitive 16) · ×1
  • BatchTaskManager.GetAllQueues (cognitive 16) internal/handler/batch_task_manager.go:411 — BatchTaskManager.GetAllQueues has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (12 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · FofaHandler.resolveBaseURL (cognitive 16) · ×1
  • FofaHandler.resolveBaseURL (cognitive 16) REDACTED:178 — FofaHandler.resolveBaseURL has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 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.
D2 · Cognitive Complexity · FofaHandler.ParseNaturalLanguage (cognitive 16) · ×1
  • FofaHandler.ParseNaturalLanguage (cognitive 16) REDACTED:227 — FofaHandler.ParseNaturalLanguage 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.
D2 · Cognitive Complexity · KnowledgeHandler.ScanKnowledgeBase (cognitive 16) · ×1
  • KnowledgeHandler.ScanKnowledgeBase (cognitive 16) internal/handler/knowledge.go:372 — KnowledgeHandler.ScanKnowledgeBase has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 1, loops 1 (nesting depth added 7). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 386). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · TerminalHandler.RunCommandStream (cognitive 16) · ×1
  • TerminalHandler.RunCommandStream (cognitive 16) internal/handler/terminal.go:190 — TerminalHandler.RunCommandStream 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · VulnerabilityHandler.ListVulnerabilities (cognitive 16) · ×1
  • VulnerabilityHandler.ListVulnerabilities (cognitive 16) REDACTED:184 — VulnerabilityHandler.ListVulnerabilities has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 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.
D2 · Cognitive Complexity · VulnerabilityHandler.DownloadVulnerability (cognitive 16) · ×1
  • VulnerabilityHandler.DownloadVulnerability (cognitive 16) internal/handler/vulnerability_download.go:19 — VulnerabilityHandler.DownloadVulnerability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 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.
D2 · Cognitive Complexity · hitl.DecideJev (cognitive 16) · ×1
  • hitl.DecideJev (cognitive 16) internal/hitl/jev.go:137 — hitl.DecideJev has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · Client.ListModels (cognitive 16) · ×1
  • Client.ListModels (cognitive 16) internal/openai/openai.go:554 — Client.ListModels has cognitive complexity 16 (threshold 15). Drivers by points: if/else 13 (15 pts), 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.
D2 · Cognitive Complexity · workflow.parseFieldBinding (cognitive 16) · ×1
  • workflow.parseFieldBinding (cognitive 16) internal/workflow/bindings.go:15 — workflow.parseFieldBinding has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), boolean chains 3, 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.
D2 · Cognitive Complexity · workflow.findStartNodeIDs (cognitive 16) · ×1
  • workflow.findStartNodeIDs (cognitive 16) internal/workflow/graph_types.go:120 — workflow.findStartNodeIDs has cognitive complexity 16 (threshold 15). Drivers by points: loops 5 (10 pts), if/else 3 (6 pts) (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · formatter.toPrompt (cognitive 16) · ×1
  • formatter.toPrompt (cognitive 16) plugins/browser-extension/cyberstrikeai-browser-extension/lib/formatter.js:7 — formatter.toPrompt has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, ternaries 2 (3 pts), if/else 2 (nesting depth added 1). 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.
D2 · Cognitive Complexity · storage.saveConfig (cognitive 16) · ×1
  • storage.saveConfig (cognitive 16) plugins/browser-extension/cyberstrikeai-browser-extension/lib/storage.js:156 — storage.saveConfig has cognitive complexity 16 (threshold 15). Drivers by points: if/else 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · agents.bindAgentsMdListDelegation (cognitive 16) · ×1
  • agents.bindAgentsMdListDelegation (cognitive 16) web/static/js/agents.js:9 — agents.bindAgentsMdListDelegation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), error handling 2 (6 pts), boolean chains 2 (nesting depth added 6). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 13). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · assets.loadAssets (cognitive 16) · ×1
  • assets.loadAssets (cognitive 16) REDACTED:707 — assets.loadAssets has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), error handling 1 (nesting depth added 1). 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.
D2 · Cognitive Complexity · c2.C2.waitForFileDownload (cognitive 16) · ×1
  • c2.C2.waitForFileDownload (cognitive 16) web/static/js/c2.js:3140 — c2.C2.waitForFileDownload has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 5, error handling 1 (3 pts) (nesting depth added 3). None of this is in the body itself: all 16 points belong to 2 function items inside it that branch (a function literal at line 3147, check). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · chat._acBuildSvgString · ×1
  • chat._acBuildSvgString::themeFor (cognitive 16) web/static/js/chat.js:8573 — chat._acBuildSvgString::themeFor has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · dashboard.renderDashboardWebshellRecent (cognitive 16) · ×1
  • dashboard.renderDashboardWebshellRecent (cognitive 16) web/static/js/dashboard.js:605 — dashboard.renderDashboardWebshellRecent has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 4, ternaries 2, error handling 1. Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 619, 613, 634, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · hitl.resolveHitlGlobalToolWhitelist (cognitive 16) · ×1
  • hitl.resolveHitlGlobalToolWhitelist (cognitive 16) web/static/js/hitl.js:434 — hitl.resolveHitlGlobalToolWhitelist has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), error handling 2 (3 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.
D2 · Cognitive Complexity · info-collect.setFofaParseLoading (cognitive 16) · ×1
  • info-collect.setFofaParseLoading (cognitive 16) web/static/js/info-collect.js:856 — info-collect.setFofaParseLoading has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · mobile-ui.enableSheetSwipe (cognitive 16) · ×1
  • mobile-ui.enableSheetSwipe (cognitive 16) web/static/js/mobile-ui.js:1023 — mobile-ui.enableSheetSwipe has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 1. None of this is in the body itself: all 16 points belong to 3 function literals inside it that branch (lines 1040, 1051, 1029). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · modal.document.addEventListener("keydown") (cognitive 16) · ×1
  • modal.document.addEventListener("keydown") (cognitive 16) web/static/js/modal.js:187 — modal.document.addEventListener("keydown") has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (nesting depth added 3). 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.
D2 · Cognitive Complexity · monitor.formatTimelineStreamBody (cognitive 16) · ×1
  • monitor.formatTimelineStreamBody (cognitive 16) web/static/js/monitor.js:147 — monitor.formatTimelineStreamBody has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, ternaries 1 (2 pts), error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · monitor.buildTimelineSparseHint (cognitive 16) · ×1
  • monitor.buildTimelineSparseHint (cognitive 16) web/static/js/monitor.js:8027 — monitor.buildTimelineSparseHint has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 2. Of this number, 12 points are the body's own statements and 4 belong to 2 function literals inside it that branch. To reduce it, 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.
D2 · Cognitive Complexity · projects.showEditProjectModal (cognitive 16) · ×1
  • projects.showEditProjectModal (cognitive 16) web/static/js/projects.js:1956 — projects.showEditProjectModal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 3, error handling 1 (2 pts) (nesting depth added 2). Of this number, 14 points are the body's own statements and 2 belong to one function literal inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · settings.getRobotStatus (cognitive 16) · ×1
  • settings.getRobotStatus (cognitive 16) web/static/js/settings.js:328 — settings.getRobotStatus has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. Of this number, 15 points are the body's own statements and 1 belongs to one function item 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.
D2 · Cognitive Complexity · settings.readAIChannelFromMainForm (cognitive 16) · ×1
  • settings.readAIChannelFromMainForm (cognitive 16) web/static/js/settings.js:2651 — settings.readAIChannelFromMainForm has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, if/else 1. 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.
D2 · Cognitive Complexity · storage.renderOverview (cognitive 16) · ×1
  • storage.renderOverview (cognitive 16) web/static/js/storage.js:104 — storage.renderOverview has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 4, ternaries 3 (4 pts) (nesting depth added 1). 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.
D2 · Cognitive Complexity · vulnerability.saveVulnerability (cognitive 16) · ×1
  • vulnerability.saveVulnerability (cognitive 16) web/static/js/vulnerability.js:1828 — vulnerability.saveVulnerability has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, boolean chains 6, ternaries 2, error handling 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · parseAssetImportMatrix (cognitive 16) · ×1
  • parseAssetImportMatrix (cognitive 16) REDACTED:285 — parseAssetImportMatrix has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 4, other 2 (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 4 function literals inside it that branch (lines 299, 301, 293, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · renderAuditLogsPagination (cognitive 16) · ×1
  • renderAuditLogsPagination (cognitive 16) web/static/js/audit.js:367 — renderAuditLogsPagination has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 2. Of this number, 14 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · renderHitlPagination (cognitive 16) · ×1
  • renderHitlPagination (cognitive 16) web/static/js/hitl.js:139 — renderHitlPagination has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 8, boolean chains 6, if/else 2. Of this number, 14 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · (anonymous) (cognitive 16) · ×1
  • (anonymous) (cognitive 16) web/static/js/modal.js:187 — (anonymous) has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 6 (nesting depth added 3). 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.
D2 · Cognitive Complexity · bindMcpStatsTimelineEvents (cognitive 16) · ×1
  • bindMcpStatsTimelineEvents (cognitive 16) web/static/js/monitor.js:7942 — bindMcpStatsTimelineEvents has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 8. Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to 10 function items inside it that branch (a function literal at line 7961, a function literal at line 7985, (anonymous)::onclick, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · fillFactModalForm (cognitive 16) · ×1
  • fillFactModalForm (cognitive 16) web/static/js/projects.js:2339 — fillFactModalForm has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, ternaries 1 (2 pts) (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.
D2 · Cognitive Complexity · renderRoleSelectionSidebar (cognitive 16) · ×1
  • renderRoleSelectionSidebar (cognitive 16) web/static/js/roles.js:393 — renderRoleSelectionSidebar has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (6 pts), boolean chains 4, error handling 1 (3 pts), ternaries 3 (nesting depth added 3). Most of this is not in the body itself: 1 of the 16 points is its own statement and the rest belongs to 5 function items inside it that branch (a function literal at line 429, getRoleIcon, (anonymous)::onkeydown, …). The named helpers are already separate functions; the literals' work cannot be called, reviewed or tested from outside this body. To reduce it, move the named helpers out of the body to the enclosing scope and lift each literal's work into a named function there, so each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · installDomPurifyHooks (cognitive 16) · ×1
  • installDomPurifyHooks (cognitive 16) web/static/js/sanitize-markdown.js:42 — installDomPurifyHooks has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 7, loops 1 (nesting depth added 2). Most of this is not in the body itself: 3 of the 16 points are its own statements and the rest belongs to one function literal inside it that branches (line 46). The decisions are inside the literal, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literal's work into a named function or method at the enclosing scope and have the literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · initTerminal (cognitive 16) · ×1
  • initTerminal (cognitive 16) web/static/js/terminal.js:490 — initTerminal has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), error handling 3 (4 pts), boolean chains 2 (nesting depth added 3). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to 5 function literals inside it that branch (lines 516, 497, 524, …). The decisions are inside those literals, which nothing outside this body can call, review or test on its own, so splitting the enclosing body is not the move available here. To reduce it, lift the literals' work into a named function or method at the enclosing scope and have each literal call it, then reduce whichever part then reads as the largest.
D2 · Cognitive Complexity · refreshTokenUsage (cognitive 16) · ×1
  • refreshTokenUsage (cognitive 16) web/static/js/token-usage.js:28 — refreshTokenUsage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (6 pts), boolean chains 1, 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.
D2 · Cognitive Complexity · webshellFileRead (cognitive 16) · ×1
  • webshellFileRead (cognitive 16) web/static/js/webshell.js:4839 — webshellFileRead has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, ternaries 3 (4 pts), if/else 3, error handling 1 (nesting depth added 1). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to 4 function literals inside it that branch (lines 4847, 4863, 4857, …). 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.
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (3 members, 32 shared lines) · ×1
  • Near-duplicate member family (3 members, 32 shared lines) REDACTED:459 — REDACTED:459-533 | REDACTED:535-605 | REDACTED:607-669 — These 3 members are variants of one another: a block of 32 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 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 3 times.
D4 · Code Duplication · Near-duplicate member pair (36 shared lines) · ×1
  • Near-duplicate member pair (36 shared lines) REDACTED:741 — REDACTED:741-822 | REDACTED:854-952 — These two members are variants of one another: 36 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 · Near-duplicate member pair (31 shared lines) · ×1
  • Near-duplicate member pair (31 shared lines) internal/handler/markdown_agents.go:156 — internal/handler/markdown_agents.go:156-261 | internal/handler/markdown_agents.go:264-341 — These two members are variants of one another: 31 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 · Near-duplicate member pair (29 shared lines) · ×1
  • Near-duplicate member pair (29 shared lines) internal/config/config.go:1754 — internal/config/config.go:1754-1825 | internal/config/config.go:1829-1866 — These two members are variants of one another: 29 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 · Near-duplicate member pair (22 shared lines) · ×1
  • Near-duplicate member pair (22 shared lines) internal/handler/hitl.go:817 — internal/handler/hitl.go:817-847 | REDACTED:163-194 — 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 · Edited copy of a member (80 corresponding lines) · ×1
  • Edited copy of a member (80 corresponding lines) internal/handler/batch_task_manager.go:302 — internal/handler/batch_task_manager.go:302-397 | internal/handler/batch_task_manager.go:539-645 — These two members are one piece of code written twice and then edited apart: 80 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 (94 corresponding lines) · ×1
  • Edited copy of a member (94 corresponding lines) internal/handler/agent_multi_json_runner.go:15 — internal/handler/agent_multi_json_runner.go:15-120 | internal/handler/agent_single_json_runner.go:11-104 — These two members are one piece of code written twice and then edited apart: 94 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 (66 corresponding lines) · ×1
  • Edited copy of a member (66 corresponding lines) internal/handler/c2.go:476 — internal/handler/c2.go:476-549 | internal/handler/c2.go:872-937 — These two members are one piece of code written twice and then edited apart: 66 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 (71 corresponding lines) · ×1
  • Edited copy of a member (71 corresponding lines) REDACTED:111 — REDACTED:111-181 | REDACTED:240-330 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (72 corresponding lines) · ×1
  • Edited copy of a member (72 corresponding lines) REDACTED:823 — REDACTED:823-894 | REDACTED:898-975 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×1
  • Edited copy of a member (45 corresponding lines) internal/handler/multi_agent.go:448 — internal/handler/multi_agent.go:448-497 | internal/handler/single_agent.go:434-478 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (88 corresponding lines) · ×1
  • Edited copy of a member (88 corresponding lines) REDACTED:164 — REDACTED:164-264 | REDACTED:743-830 — These two members are one piece of code written twice and then edited apart: 88 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (56 corresponding lines) · ×1
  • Edited copy of a member (56 corresponding lines) internal/app/vulnerability_tools.go:100 — internal/app/vulnerability_tools.go:100-155 | REDACTED:555-621 — These two members are one piece of code written twice and then edited apart: 56 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (53 corresponding lines) · ×1
  • Edited copy of a member (53 corresponding lines) internal/update/apply.go:680 — internal/update/apply.go:680-744 | internal/update/apply.go:761-813 — These two members are one piece of code written twice and then edited apart: 53 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 (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) internal/handler/attackchain.go:56 — internal/handler/attackchain.go:56-120 | internal/handler/attackchain.go:124-172 — These two members are one piece of code written twice and then edited apart: 49 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 (57 corresponding lines) · ×1
  • Edited copy of a member (57 corresponding lines) REDACTED:326 — REDACTED:326-383 | internal/handler/skills.go:607-663 — These two members are one piece of code written twice and then edited apart: 57 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 (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) REDACTED:301 — REDACTED:301-384 | REDACTED:386-436 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×1
  • Edited copy of a member (42 corresponding lines) internal/database/project_fact_edges.go:152 — internal/database/project_fact_edges.go:152-193 | internal/database/project_fact_edges.go:196-241 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) REDACTED:107 — REDACTED:107-160 | internal/mcp/server.go:334-385 — These two members are one piece of code written twice and then edited apart: 52 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) REDACTED:544 — REDACTED:544-584 | REDACTED:586-625 — 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 (39 corresponding lines) · ×1
  • Edited copy of a member (39 corresponding lines) internal/database/asset.go:723 — internal/database/asset.go:723-764 | REDACTED:284-322 — 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 (32 corresponding lines) · ×1
  • Edited copy of a member (32 corresponding lines) internal/database/project.go:258 — internal/database/project.go:258-289 | internal/database/project.go:291-325 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×1
  • Edited copy of a member (29 corresponding lines) internal/handler/knowledge.go:241 — internal/handler/knowledge.go:241-269 | internal/handler/knowledge.go:272-302 — 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 copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) internal/handler/c2.go:361 — internal/handler/c2.go:361-388 | internal/handler/c2.go:552-579 | internal/handler/c2.go:940-962 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 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 (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) internal/handler/agent.go:2260 — internal/handler/agent.go:2260-2290 | internal/handler/agent.go:2293-2322 — 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 copy of a member (31 corresponding lines) · ×1
  • Edited copy of a member (31 corresponding lines) REDACTED:419 — REDACTED:419-449 | REDACTED:451-484 — 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 (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) internal/database/asset.go:785 — internal/database/asset.go:785-815 | internal/database/asset.go:819-845 — 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 copies of one member (3 members, 22+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 22+ corresponding lines) REDACTED:801 — REDACTED:801-822 | REDACTED:1386-1407 | REDACTED:1808-1829 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×1
  • Edited copy of a member (25 corresponding lines) internal/robot/qq.go:116 — internal/robot/qq.go:116-140 | internal/robot/qq.go:142-167 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 21+ corresponding lines) REDACTED:977 — REDACTED:977-998 | REDACTED:1000-1020 | internal/database/robot_identity.go:131-154 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 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, 20+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 20+ corresponding lines) internal/audit/service.go:117 — internal/audit/service.go:117-136 | internal/hitl/retention.go:35-54 | internal/monitor/retention.go:35-54 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) REDACTED:233 — REDACTED:233-256 | REDACTED:671-690 | REDACTED:692-711 | REDACTED:713-732 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 28+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 28+ corresponding lines) REDACTED:903 — REDACTED:903-930 | REDACTED:977-1005 | internal/database/skill_stats.go:20-47 | internal/database/skill_stats.go:90-118 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 18+ corresponding lines) internal/mcp/server.go:501 — internal/mcp/server.go:501-518 | internal/mcp/server.go:1410-1428 | internal/mcp/server.go:1519-1537 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 16+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 16+ corresponding lines) internal/database/c2_http_auth.go:46 — internal/database/c2_http_auth.go:46-61 | internal/database/project_stats.go:53-79 | REDACTED:1205-1220 | REDACTED:1222-1237 | internal/database/schema_reconcile.go:27-42 | internal/database/schema_reconcile.go:44-59 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 14+ corresponding lines) internal/openai/reasoning_payload.go:20 — internal/openai/reasoning_payload.go:20-33 | internal/openai/reasoning_payload.go:56-72 | internal/openai/reasoning_payload.go:77-94 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 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, 10+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 10+ corresponding lines) internal/handler/config.go:2801 — internal/handler/config.go:2801-2814 | internal/handler/config.go:2816-2829 | internal/handler/external_mcp.go:485-494 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 12+ corresponding lines) internal/app/asset_tools.go:382 — internal/app/asset_tools.go:382-393 | internal/handler/asset.go:239-250 | internal/handler/token_usage.go:81-92 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 9+ corresponding lines) REDACTED:295 — REDACTED:295-303 | REDACTED:324-332 | REDACTED:352-361 — 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 (7 members, 12+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 12+ corresponding lines) internal/handler/task_manager.go:76 — internal/handler/task_manager.go:76-87 | internal/handler/task_manager.go:90-103 | internal/handler/task_manager.go:106-117 | internal/handler/task_manager.go:120-131 | internal/handler/task_manager.go:187-200 | internal/handler/task_manager.go:216-229 | internal/handler/task_manager.go:232-244 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 11+ corresponding lines) internal/handler/c2.go:1227 — internal/handler/c2.go:1227-1240 | REDACTED:134-144 | REDACTED:976-989 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×1
  • Edited copy of a member (4 corresponding lines) internal/handler/agent.go:1857 — internal/handler/agent.go:1857-1860 | internal/handler/workflow_run.go:185-188 — These two members are one piece of code written twice and then edited apart: 4 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 (5 corresponding lines) · ×1
  • Edited copy of a member (5 corresponding lines) internal/database/asset.go:511 — internal/database/asset.go:511-515 | REDACTED:40-45 — These two members are one piece of code written twice and then edited apart: 5 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 · Duplicated block (78 lines × 2) · ×1
  • Duplicated block (78 lines × 2) internal/handler/batch_task_manager.go:317 — internal/handler/batch_task_manager.go:317-394 | internal/handler/batch_task_manager.go:562-639 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (83 lines × 2) · ×1
  • Duplicated block (83 lines × 2) internal/handler/multi_agent.go:299 — internal/handler/multi_agent.go:299-381 | internal/handler/single_agent.go:285-367 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:299` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (51–57 lines × 2) · ×1
  • Duplicated block (51–57 lines × 2) internal/handler/multi_agent.go:49 — internal/handler/multi_agent.go:49-105 | internal/handler/single_agent.go:38-88 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (47–52 lines × 2) · ×1
  • Duplicated block (47–52 lines × 2) internal/handler/terminal.go:65 — internal/handler/terminal.go:65-116 | internal/handler/terminal.go:191-237 — 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.
D4 · Code Duplication · Duplicated block (46 lines × 2) · ×1
  • Duplicated block (46 lines × 2) internal/handler/multi_agent.go:216 — internal/handler/multi_agent.go:216-261 | internal/handler/single_agent.go:203-248 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:216` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (39–40 lines × 2) · ×1
  • Duplicated block (39–40 lines × 2) internal/security/executor.go:1144 — internal/security/executor.go:1144-1183 | internal/security/shell_execute_stream.go:119-157 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (38 lines × 2) · ×1
  • Duplicated block (38 lines × 2) REDACTED:196 — REDACTED:196-233 | REDACTED:762-799 — 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:196` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) internal/mcp/external_manager.go:1146 — internal/mcp/external_manager.go:1146-1182 | internal/mcp/server.go:747-783 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (33–36 lines × 4) · ×1
  • Duplicated block (33–36 lines × 4) internal/knowledge/manager.go:307 — internal/knowledge/manager.go:307-342 | internal/knowledge/manager.go:413-445 | internal/knowledge/manager.go:500-532 | internal/knowledge/manager.go:557-592 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `m *Manager) GetItemsWithOptions(category` in one and `m *Manager) SearchItemsByKeyword(keyword` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) REDACTED:555 — REDACTED:555-590 | REDACTED:662-697 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (33–35 lines × 2) · ×1
  • Duplicated block (33–35 lines × 2) REDACTED:1028 — REDACTED:1028-1062 | REDACTED:1086-1118 — 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:1028` 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.
D4 · Code Duplication · Duplicated block (34 lines × 2) · ×1
  • Duplicated block (34 lines × 2) REDACTED:1171 — REDACTED:1171-1204 | REDACTED:1239-1272 — 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:1171` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:1235` calls `scanC2TaskRows` and `REDACTED:1170` 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.
D4 · Code Duplication · Duplicated block (31–34 lines × 2) · ×1
  • Duplicated block (31–34 lines × 2) REDACTED:151 — REDACTED:151-181 | REDACTED:297-330 — 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: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.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) internal/handler/c2.go:483 — internal/handler/c2.go:483-513 | internal/handler/c2.go:880-910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (25–29 lines × 3) · ×1
  • Duplicated block (25–29 lines × 3) REDACTED:258 — REDACTED:258-286 | REDACTED:352-380 | REDACTED:639-663 — 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.
D4 · Code Duplication · Duplicated block (24–28 lines × 3) · ×1
  • Duplicated block (24–28 lines × 3) REDACTED:231 — REDACTED:231-258 | REDACTED:566-589 | REDACTED:797-824 — 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 `REDACTED:231` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) REDACTED:1144 — REDACTED:1144-1170 | REDACTED:1208-1234 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:1235` calls `scanC2TaskRows` and `REDACTED:1171` 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.
D4 · Code Duplication · Duplicated block (25–27 lines × 2) · ×1
  • Duplicated block (25–27 lines × 2) internal/handler/config.go:1483 — internal/handler/config.go:1483-1509 | internal/handler/config.go:1743-1767 — 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/handler/config.go:1483` 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.
D4 · Code Duplication · Duplicated block (23–24 lines × 2) · ×1
  • Duplicated block (23–24 lines × 2) internal/database/project.go:266 — internal/database/project.go:266-289 | internal/database/project.go:303-325 — 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/database/project.go:266` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/database/project.go:302` calls `appendProjectAccessFilter` and `internal/database/project.go:265` 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.
D4 · Code Duplication · Duplicated block (10–23 lines × 3) · ×1
  • Duplicated block (10–23 lines × 3) REDACTED:1939 — REDACTED:1939-1948 | REDACTED:2014-2032 | REDACTED:2056-2078 — 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 `REDACTED:1939` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–44 lines × 2) · ×1
  • Duplicated block (43–44 lines × 2) internal/handler/multi_agent.go:167 — internal/handler/multi_agent.go:167-210 | internal/handler/single_agent.go:160-202 — before extracting anything, compare `internal/handler/multi_agent.go` and `internal/handler/single_agent.go` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 431 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/multi_agent.go:167` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/single_agent.go:159` calls `UpdateTaskStatus` and `internal/handler/multi_agent.go:166` 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.
D4 · Code Duplication · Duplicated block (30–31 lines × 2) · ×1
  • Duplicated block (30–31 lines × 2) REDACTED:353 — REDACTED:353-383 | internal/handler/skills.go:634-663 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:353` 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.
D4 · Code Duplication · Duplicated block (20–21 lines × 4) · ×1
  • Duplicated block (20–21 lines × 4) internal/handler/monitor.go:210 — internal/handler/monitor.go:210-229 | internal/handler/monitor.go:262-281 | internal/handler/monitor.go:361-381 | internal/handler/monitor.go:391-411 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×1
  • Duplicated block (20 lines × 2) internal/handler/c2.go:715 — internal/handler/c2.go:715-734 | internal/handler/c2.go:786-805 — 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/handler/c2.go:715` 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 transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (17 lines × 4) · ×1
  • Duplicated block (17 lines × 4) REDACTED:768 — REDACTED:768-784 | REDACTED:1353-1369 | REDACTED:1456-1472 | REDACTED:1775-1791 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (16–17 lines × 3) · ×1
  • Duplicated block (16–17 lines × 3) internal/database/asset.go:995 — internal/database/asset.go:995-1010 | internal/database/asset.go:1078-1093 | internal/database/asset.go:1188-1204 — 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/database/asset.go:995` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×1
  • Duplicated block (26–27 lines × 2) internal/database/batch_task.go:147 — internal/database/batch_task.go:147-173 | internal/database/batch_task.go:220-245 — 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/database/batch_task.go:147` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×1
  • Duplicated block (14–16 lines × 2) internal/handler/attackchain.go:79 — internal/handler/attackchain.go:79-94 | internal/handler/attackchain.go:136-149 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/attackchain.go:79` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) internal/workflow/resume.go:90 — internal/workflow/resume.go:90-103 | internal/workflow/runner.go:185-199 — 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.
D4 · Code Duplication · Duplicated block (7–14 lines × 2) · ×1
  • Duplicated block (7–14 lines × 2) REDACTED:357 — REDACTED:357-370 | REDACTED:419-425 — 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:357` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) REDACTED:1586 — REDACTED:1586-1597 | REDACTED:1618-1629 | REDACTED:1650-1662 — 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 `REDACTED:1586` 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.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) REDACTED:751 — REDACTED:751-763 | REDACTED:864-872 — 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:751` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) internal/update/apply.go:688 — internal/update/apply.go:688-699 | internal/update/apply.go:775-785 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `ref string) (backupDir` in one and `changed []Change) (backupDir` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) internal/database/asset.go:726 — internal/database/asset.go:726-736 | internal/database/asset.go:926-936 | internal/handler/config.go:1353-1363 | internal/handler/finalization_auto_continue.go:165-175 — there are 4 copies across 3 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 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) REDACTED:128 — REDACTED:128-138 | REDACTED:176-186 | REDACTED:267-276 — 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.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) internal/handler/attackchain.go:110 — internal/handler/attackchain.go:110-120 | internal/handler/attackchain.go:165-172 — 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/handler/attackchain.go:110` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `internal/handler/attackchain.go:162` calls `getOpenAIConfig`, `NewBuilder` and `internal/handler/attackchain.go:107` 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.
D4 · Code Duplication · Duplicated block (10 lines × 5) · ×1
  • Duplicated block (10 lines × 5) internal/agentfinalizer/decision.go:201 — internal/agentfinalizer/decision.go:201-210 | internal/agentfinalizer/decision.go:221-230 | internal/agentfinalizer/decision.go:247-256 | internal/database/asset.go:925-934 | internal/handler/config.go:1352-1361 — there are 5 copies across 3 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 5 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/agentfinalizer/decision.go:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `string` to `db *DB) GetAsset(id` in one and `contextProfile` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) internal/handler/config.go:1371 — internal/handler/config.go:1371-1379 | internal/handler/config.go:1411-1420 | internal/handler/config.go:1541-1549 | internal/handler/config.go:1604-1613 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/handler/config.go:1371` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) internal/database/batch_task.go:130 — internal/database/batch_task.go:130-139 | internal/database/batch_task.go:160-168 | internal/database/batch_task.go:232-240 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 6) · ×1
  • Duplicated block (9 lines × 6) REDACTED:471 — REDACTED:471-479 | REDACTED:546-554 | REDACTED:571-579 | REDACTED:603-611 | REDACTED:650-658 | REDACTED:674-682 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) REDACTED:988 — REDACTED:988-996 | REDACTED:1010-1018 | REDACTED:1028-1036 | REDACTED:1049-1057 | REDACTED:1335-1343 — 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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 6) · ×1
  • Duplicated block (8 lines × 6) REDACTED:1028 — REDACTED:1028-1035 | REDACTED:1086-1093 | REDACTED:1390-1397 | REDACTED:1417-1424 | REDACTED:1787-1794 | REDACTED:1853-1860 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (3–8 lines × 3) · ×1
  • Duplicated block (3–8 lines × 3) REDACTED:521 — REDACTED:521-523 | REDACTED:610-617 | REDACTED:702-709 — 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 `REDACTED:521` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×1
  • Duplicated block (7–8 lines × 2) internal/handler/terminal.go:149 — internal/handler/terminal.go:149-155 | internal/handler/terminal.go:166-173 — 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/handler/terminal.go:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) internal/database/asset.go:1000 — internal/database/asset.go:1000-1006 | internal/database/asset.go:1083-1089 | internal/database/asset.go:1145-1151 | internal/database/asset.go:1194-1200 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6 lines × 8) · ×1
  • Duplicated block (6 lines × 8) internal/handler/batch_task_mcp.go:126 — internal/handler/batch_task_mcp.go:126-131 | internal/handler/batch_task_mcp.go:287-292 | internal/handler/batch_task_mcp.go:318-323 | internal/handler/batch_task_mcp.go:359-364 | internal/handler/batch_task_mcp.go:386-391 | internal/handler/batch_task_mcp.go:439-444 | internal/handler/batch_task_mcp.go:487-492 | internal/handler/batch_task_mcp.go:541-546 — all 8 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/handler/batch_task_mcp.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.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) internal/app/project_fact_tools.go:116 — internal/app/project_fact_tools.go:116-121 | internal/app/project_fact_tools.go:185-196 | internal/app/project_fact_tools.go:289-303 | internal/app/project_fact_tools.go:327-337 | internal/app/project_fact_tools.go:357-372 — 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 `internal/app/project_fact_tools.go:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) internal/app/project_fact_tools.go:116 — internal/app/project_fact_tools.go:116-121 | internal/app/project_fact_tools.go:192-196 | internal/app/project_fact_tools.go:256-260 | internal/app/project_fact_tools.go:299-303 | internal/app/project_fact_tools.go:333-337 | internal/app/project_fact_tools.go:368-372 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/project_fact_tools.go:116` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) internal/handler/external_mcp.go:200 — internal/handler/external_mcp.go:200-204 | internal/handler/external_mcp.go:276-280 | internal/handler/external_mcp.go:331-335 | REDACTED:191-195 | REDACTED:239-243 — there are 5 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 5 sites; resolving a subset leaves the remainder to drift apart. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19 lines × 4) · ×1
  • Duplicated block (19 lines × 4) internal/app/c2_tools.go:68 — internal/app/c2_tools.go:68-89 | internal/app/c2_tools.go:247-268 | internal/app/c2_tools.go:543-561 | internal/app/c2_tools.go:698-718 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `internal/app/c2_tools.go:68` 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.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×1
  • Duplicated block (19 lines × 3) REDACTED:175 — REDACTED:175-194 | REDACTED:1690-1708 | REDACTED:1730-1748 — 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 `REDACTED:175` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) REDACTED:353 — REDACTED:353-361 | REDACTED:740-748 | REDACTED:1045-1055 | REDACTED:1621-1632 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:353` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) REDACTED:272 — REDACTED:272-277 | REDACTED:369-375 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D8 · Code Coverage · Coverage not measured · ×1
  • Coverage not measured — JavaScript/TypeScript suite — Coverage NOT MEASURED: the JavaScript/TypeScript half could not be measured — the node:test suite in runtime/pi/ ran and not one test passed (throw new ERR_MODULE_NOT_FOUND(), so the coverage would describe the failed run, not the code. Coverage is excluded from the score rather than counted as a near-zero. The named suite step is one the repository's maintainers can perform; once it passes, the real number is measured on the next scan.
R1 · Type Safety · Type Safety · ×1
  • Type Safety — 4 typed · 117 plain JS — the untyped files are plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js, plugins/browser-extension/cyberstrikeai-browser-extension/devtools.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/auth-session.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/capture.js, plugins/browser-extension/cyberstrikeai-browser-extension/lib/catalog-cache.js (+111 more).
R10 · Code Duplication · Duplicated block with local edits (131 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (131 matched lines × 2 locations) web/static/js/projects.js:83 — web/static/js/projects.js:83 · web/static/js/workflows.js:628 — the two spans are one implementation copied and then locally edited — 962 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.
R10 · Code Duplication · Duplicated block (90 lines × 2 locations) · ×1
  • Duplicated block (90 lines × 2 locations) web/static/js/c2.js:3348 — web/static/js/c2.js:3348 · web/static/js/c2.js:3975 — 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.
R10 · Code Duplication · Duplicated block with local edits (72 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (72 matched lines × 2 locations) web/static/js/audit.js:795 — web/static/js/audit.js:795 · web/static/js/webshell.js:677 — the two spans are one implementation copied and then locally edited — 528 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.
R10 · Code Duplication · Duplicated block with local edits (71 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (71 matched lines × 2 locations) web/static/js/chat-files.js:1765 — web/static/js/chat-files.js:1765 · web/static/js/chat.js:2625 — the two spans are one implementation copied and then locally edited — 462 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.
R10 · Code Duplication · Duplicated block (58 lines × 2 locations) · ×1
  • Duplicated block (58 lines × 2 locations) web/static/js/settings.js:2192 — web/static/js/settings.js:2192 · web/static/js/settings.js:4185 — all 2 copies are in the same file, 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 (56 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (56 matched lines × 2 locations) web/static/js/rbac.js:1227 — web/static/js/rbac.js:1227 · web/static/js/rbac.js:1349 — the two spans are one implementation copied and then locally edited — 398 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.
R10 · Code Duplication · Duplicated block (48 lines × 2 locations) · ×1
  • Duplicated block (48 lines × 2 locations) web/static/js/c2.js:3217 — web/static/js/c2.js:3217 · web/static/js/c2.js:4155 — 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.
R10 · Code Duplication · Duplicated block with local edits (39 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (39 matched lines × 2 locations) scripts/mobile-shot.mjs:17 — scripts/mobile-shot.mjs:17 · scripts/mobile-tap-audit.mjs:25 — the two spans are one implementation copied and then locally edited — 530 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.
R10 · Code Duplication · Duplicated block (39 lines × 2 locations) · ×1
  • Duplicated block (39 lines × 2 locations) web/static/js/webshell.js:2404 — web/static/js/webshell.js:2404 · web/static/js/webshell.js:3340 — 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.
R10 · Code Duplication · Duplicated block (37 lines × 2 locations) · ×1
  • Duplicated block (37 lines × 2 locations) web/static/js/monitor.js:7377 — web/static/js/monitor.js:7377 · web/static/js/monitor.js:7611 — 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.
R10 · Code Duplication · Duplicated block with local edits (36 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (36 matched lines × 2 locations) web/static/js/info-collect.js:495 — web/static/js/info-collect.js:495 · web/static/js/settings.js:244 — the two spans are one implementation copied and then locally edited — 353 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.
R10 · Code Duplication · Duplicated block with local edits (35 matched lines × 2 locations) · ×1
  • Duplicated block with local edits (35 matched lines × 2 locations) web/static/js/mobile-ui.js:297 — web/static/js/mobile-ui.js:297 · web/static/js/mobile-ui.js:1024 — the two spans are one implementation copied and then locally edited — 295 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.
R10 · Code Duplication · Duplicated block (28 lines × 2 locations) · ×1
  • Duplicated block (28 lines × 2 locations) web/static/js/chat.js:9193 — web/static/js/chat.js:9193 · web/static/js/workflows.js:419 — 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 (27 lines × 2 locations) · ×1
  • Duplicated block (27 lines × 2 locations) web/static/js/roles.js:139 — web/static/js/roles.js:139 · web/static/js/webshell.js:769 — 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 (25 lines × 3 locations) · ×1
  • Duplicated block (25 lines × 3 locations) web/static/js/tasks.js:2004 — web/static/js/tasks.js:2004 · web/static/js/tasks.js:2035 · web/static/js/tasks.js:2066 — all 3 copies are in the same file, 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 (24 lines × 4 locations) · ×1
  • Duplicated block (24 lines × 4 locations) web/static/js/settings.js:3480 — web/static/js/settings.js:3480 · web/static/js/settings.js:3506 · web/static/js/settings.js:3532 · web/static/js/settings.js:3558 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
R10 · Code Duplication · Duplicated block (23 lines × 2 locations) · ×1
  • Duplicated block (23 lines × 2 locations) web/static/js/chat.js:283 — web/static/js/chat.js:283 · web/static/js/settings.js:257 — 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 (22 lines × 3 locations) · ×1
  • Duplicated block (22 lines × 3 locations) web/static/js/chat.js:7802 — web/static/js/chat.js:7802 · web/static/js/chat.js:7847 · web/static/js/chat.js:7902 — all 3 copies are in the same file, 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 (22 lines × 2 locations) · ×1
  • Duplicated block (22 lines × 2 locations) web/static/js/chat.js:9161 — web/static/js/chat.js:9161 · web/static/js/workflows.js:475 — 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 (21 lines × 3 locations) · ×1
  • Duplicated block (21 lines × 3 locations) web/static/js/chat-files.js:99 — web/static/js/chat-files.js:99 · web/static/js/monitor.js:7475 · web/static/js/roles.js:71 — 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.
R10 · Code Duplication · Duplicated block (20 lines × 2 locations) · ×1
  • Duplicated block (20 lines × 2 locations) web/static/js/monitor.js:2881 — web/static/js/monitor.js:2881 · web/static/js/webshell.js:2199 — 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.
R10 · Code Duplication · Duplicated block (19 lines × 11 locations) · ×1
  • Duplicated block (19 lines × 11 locations) web/static/js/c2.js:204 — web/static/js/c2.js:204 · web/static/js/chat-files.js:65 · web/static/js/hitl.js:1361 · web/static/js/monitor.js:7441 · +7 more site(s) not listed — the 11 copies are spread across 9 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.
R2 · Cyclomatic Complexity · Complex function handleStreamEvent (cyclomatic 502, cognitive 756) · ×1
  • Complex function handleStreamEvent (cyclomatic 502, cognitive 756) web/static/js/monitor.js:2918 — handleStreamEvent has cyclomatic complexity 502 and cognitive complexity 756; 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.
R2 · Cyclomatic Complexity · Complex function loadConfig (cyclomatic 206, cognitive 263) · ×1
  • Complex function loadConfig (cyclomatic 206, cognitive 263) web/static/js/settings.js:790 — loadConfig has cyclomatic complexity 206 and cognitive complexity 263; 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.
R2 · Cyclomatic Complexity · Complex function addTimelineItem (cyclomatic 204, cognitive 257) · ×1
  • Complex function addTimelineItem (cyclomatic 204, cognitive 257) web/static/js/monitor.js:6638 — addTimelineItem has cyclomatic complexity 204 and cognitive complexity 257; 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.
R2 · Cyclomatic Complexity · Complex function processChunk (cyclomatic 193, cognitive 403) · ×1
  • Complex function processChunk (cyclomatic 193, cognitive 403) web/static/js/webshell.js:3544 — processChunk has cyclomatic complexity 193 and cognitive complexity 403; 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.
R2 · Cyclomatic Complexity · Complex function renderOneProcessDetail (cyclomatic 183, cognitive 269) · ×1
  • Complex function renderOneProcessDetail (cyclomatic 183, cognitive 269) web/static/js/chat.js:4299 — renderOneProcessDetail has cyclomatic complexity 183 and cognitive complexity 269; 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.
R2 · Cyclomatic Complexity · Complex function refreshWebshellUIOnLanguageChange (cyclomatic 140, cognitive 274) · ×1
  • Complex function refreshWebshellUIOnLanguageChange (cyclomatic 140, cognitive 274) web/static/js/webshell.js:5031 — refreshWebshellUIOnLanguageChange has cyclomatic complexity 140 and cognitive complexity 274; 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.
R2 · Cyclomatic Complexity · Complex function applySettings (cyclomatic 122, cognitive 129) · ×1
  • Complex function applySettings (cyclomatic 122, cognitive 129) web/static/js/settings.js:1908 — applySettings has cyclomatic complexity 122 and cognitive complexity 129; 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.
R2 · Cyclomatic Complexity · Complex function refreshDashboard (cyclomatic 101, cognitive 151) · ×1
  • Complex function refreshDashboard (cyclomatic 101, cognitive 151) web/static/js/dashboard.js:42 — refreshDashboard has cyclomatic complexity 101 and cognitive complexity 151; 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.
R2 · Cyclomatic Complexity · Complex function buildWebshellTimelineItemFromDetail (cyclomatic 93, cognitive 135) · ×1
  • Complex function buildWebshellTimelineItemFromDetail (cyclomatic 93, cognitive 135) web/static/js/webshell.js:2220 — buildWebshellTimelineItemFromDetail has cyclomatic complexity 93 and cognitive complexity 135; 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.
R2 · Cyclomatic Complexity · Complex function loadConversation (cyclomatic 93, cognitive 124) · ×1
  • Complex function loadConversation (cyclomatic 93, cognitive 124) web/static/js/chat.js:6381 — loadConversation has cyclomatic complexity 93 and cognitive complexity 124; 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.
R2 · Cyclomatic Complexity · Complex function selectWebshell (cyclomatic 92, cognitive 33) · ×1
  • Complex function selectWebshell (cyclomatic 92, cognitive 33) web/static/js/webshell.js:2446 — selectWebshell has cyclomatic complexity 92 and cognitive complexity 33; 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.
R2 · Cyclomatic Complexity · Complex function sendMessage (cyclomatic 80, cognitive 97) · ×1
  • Complex function sendMessage (cyclomatic 80, cognitive 97) web/static/js/chat.js:2248 — sendMessage has cyclomatic complexity 80 and cognitive complexity 97; 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.
R2 · Cyclomatic Complexity · Complex function initPage (cyclomatic 77, cognitive 81) · ×1
  • Complex function initPage (cyclomatic 77, cognitive 81) web/static/js/router.js:410 — initPage has cyclomatic complexity 77 and cognitive complexity 81; 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.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 73, cognitive 92) · ×1
  • Complex function (anonymous) (cyclomatic 73, cognitive 92) web/static/js/monitor.js:5625 — (anonymous) has cyclomatic complexity 73 and cognitive complexity 92; 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.
R2 · Cyclomatic Complexity · Complex function loadProcessDetailsPaginated (cyclomatic 70, cognitive 88) · ×1
  • Complex function loadProcessDetailsPaginated (cyclomatic 70, cognitive 88) web/static/js/monitor.js:2369 — loadProcessDetailsPaginated has cyclomatic complexity 70 and cognitive complexity 88; 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.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 64, cognitive 83) · ×1
  • Complex function (anonymous) (cyclomatic 64, cognitive 83) web/static/js/monitor.js:9573 — (anonymous) has cyclomatic complexity 64 and cognitive complexity 83; 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.
R2 · Cyclomatic Complexity · Complex function buildInlineHitlApprovalHtml (cyclomatic 60, cognitive 68) · ×1
  • Complex function buildInlineHitlApprovalHtml (cyclomatic 60, cognitive 68) web/static/js/monitor.js:4607 — buildInlineHitlApprovalHtml has cyclomatic complexity 60 and cognitive complexity 68; 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.
R2 · Cyclomatic Complexity · Complex function renderExternalMCPList (cyclomatic 54, cognitive 85) · ×1
  • Complex function renderExternalMCPList (cyclomatic 54, cognitive 85) web/static/js/settings.js:4502 — renderExternalMCPList has cyclomatic complexity 54 and cognitive complexity 85; 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.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 53, cognitive 68) · ×1
  • Complex function (anonymous) (cyclomatic 53, cognitive 68) web/static/js/c2.js:2355 — (anonymous) has cyclomatic complexity 53 and cognitive complexity 68; 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.
R2 · Cyclomatic Complexity · Complex function run (cyclomatic 53, cognitive 59) · ×1
  • Complex function run (cyclomatic 53, cognitive 59) runtime/pi/src/worker.ts:181 — run has cyclomatic complexity 53 and cognitive complexity 59; 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.
R2 · Cyclomatic Complexity · Complex function restoreHitlInlineForConversation (cyclomatic 51, cognitive 91) · ×1
  • Complex function restoreHitlInlineForConversation (cyclomatic 51, cognitive 91) web/static/js/monitor.js:5375 — restoreHitlInlineForConversation has cyclomatic complexity 51 and cognitive complexity 91; 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.
R2 · Cyclomatic Complexity · Complex function renderOneMessage (cyclomatic 50, cognitive 66) · ×1
  • Complex function renderOneMessage (cyclomatic 50, cognitive 66) web/static/js/chat.js:6531 — renderOneMessage has cyclomatic complexity 50 and cognitive complexity 66; 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.
R2 · Cyclomatic Complexity · Complex function syncVulnerabilityFiltersFromLocationHash (cyclomatic 49, cognitive 49) · ×1
  • Complex function syncVulnerabilityFiltersFromLocationHash (cyclomatic 49, cognitive 49) web/static/js/vulnerability.js:272 — syncVulnerabilityFiltersFromLocationHash has cyclomatic complexity 49 and cognitive complexity 49; 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.
R2 · Cyclomatic Complexity · Complex function assetImportRecord (cyclomatic 49, cognitive 40) · ×1
  • Complex function assetImportRecord (cyclomatic 49, cognitive 40) REDACTED:319 — assetImportRecord has cyclomatic complexity 49 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 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.
R2 · Cyclomatic Complexity · Complex function showBatchQueueDetail (cyclomatic 48, cognitive 65) · ×1
  • Complex function showBatchQueueDetail (cyclomatic 48, cognitive 65) web/static/js/tasks.js:1761 — showBatchQueueDetail has cyclomatic complexity 48 and cognitive complexity 65; 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.
R2 · Cyclomatic Complexity · Complex function renderMCPDetailModal (cyclomatic 45, cognitive 70) · ×1
  • Complex function renderMCPDetailModal (cyclomatic 45, cognitive 70) web/static/js/chat.js:5600 — renderMCPDetailModal has cyclomatic complexity 45 and cognitive complexity 70; 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.
R2 · Cyclomatic Complexity · Complex function syncModelListFetchButtons (cyclomatic 45, cognitive 60) · ×1
  • Complex function syncModelListFetchButtons (cyclomatic 45, cognitive 60) web/static/js/settings.js:3478 — syncModelListFetchButtons has cyclomatic complexity 45 and cognitive complexity 60; 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.
R2 · Cyclomatic Complexity · Complex function saveKnowledgeItem (cyclomatic 44, cognitive 49) · ×1
  • Complex function saveKnowledgeItem (cyclomatic 44, cognitive 49) REDACTED:994 — saveKnowledgeItem has cyclomatic complexity 44 and cognitive complexity 49; 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.
R2 · Cyclomatic Complexity · Complex function renderProcessDetails (cyclomatic 43, cognitive 54) · ×1
  • Complex function renderProcessDetails (cyclomatic 43, cognitive 54) web/static/js/chat.js:4069 — renderProcessDetails has cyclomatic complexity 43 and cognitive complexity 54; 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.
R2 · Cyclomatic Complexity · Complex function saveExternalMCP (cyclomatic 42, cognitive 57) · ×1
  • Complex function saveExternalMCP (cyclomatic 42, cognitive 57) web/static/js/settings.js:4734 — saveExternalMCP has cyclomatic complexity 42 and cognitive complexity 57; 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.
R2 · Cyclomatic Complexity · Complex function readTypedConfig (cyclomatic 41, cognitive 35) · ×1
  • Complex function readTypedConfig (cyclomatic 41, cognitive 35) web/static/js/workflows.js:1175 — readTypedConfig has cyclomatic complexity 41 and cognitive complexity 35; 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.
R2 · Cyclomatic Complexity · Complex function fetchChatSystemModelsForChannel (cyclomatic 40, cognitive 36) · ×1
  • Complex function fetchChatSystemModelsForChannel (cyclomatic 40, cognitive 36) web/static/js/chat.js:1547 — fetchChatSystemModelsForChannel has cyclomatic complexity 40 and cognitive complexity 36; 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.
R2 · Cyclomatic Complexity · Complex function watchdogProbe (cyclomatic 39, cognitive 34) · ×1
  • Complex function watchdogProbe (cyclomatic 39, cognitive 34) web/static/js/update.js:290 — watchdogProbe has cyclomatic complexity 39 and cognitive complexity 34; 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.
R2 · Cyclomatic Complexity · Complex function appendTimelineItem (cyclomatic 38, cognitive 57) · ×1
  • Complex function appendTimelineItem (cyclomatic 38, cognitive 57) web/static/js/webshell.js:3418 — appendTimelineItem has cyclomatic complexity 38 and cognitive complexity 57; 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.
R2 · Cyclomatic Complexity · Complex function updateNavState (cyclomatic 38, cognitive 49) · ×1
  • Complex function updateNavState (cyclomatic 38, cognitive 49) web/static/js/router.js:183 — updateNavState has cyclomatic complexity 38 and cognitive complexity 49; 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.
R2 · Cyclomatic Complexity · Complex function loadConversations (cyclomatic 38, cognitive 47) · ×1
  • Complex function loadConversations (cyclomatic 38, cognitive 47) web/static/js/chat.js:10004 — loadConversations has cyclomatic complexity 38 and cognitive complexity 47; 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.
R2 · Cyclomatic Complexity · Complex function (anonymous) (cyclomatic 37, cognitive 50) · ×1
  • Complex function (anonymous) (cyclomatic 37, cognitive 50) web/static/js/chat.js:7188 — (anonymous) has cyclomatic complexity 37 and cognitive complexity 50; 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.
R2 · Cyclomatic Complexity · Complex function addMessage (cyclomatic 37, cognitive 46) · ×1
  • Complex function addMessage (cyclomatic 37, cognitive 46) web/static/js/chat.js:3558 — addMessage has cyclomatic complexity 37 and cognitive complexity 46; 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.
R2 · Cyclomatic Complexity · Complex function resolveInlineHitlDecision (cyclomatic 37, cognitive 31) · ×1
  • Complex function resolveInlineHitlDecision (cyclomatic 37, cognitive 31) web/static/js/monitor.js:4529 — resolveInlineHitlDecision has cyclomatic complexity 37 and cognitive complexity 31; 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.
R2 · Cyclomatic Complexity · Complex function restoreWorkflowHitlInlineForConversation (cyclomatic 36, cognitive 49) · ×1
  • Complex function restoreWorkflowHitlInlineForConversation (cyclomatic 36, cognitive 49) web/static/js/monitor.js:5218 — restoreWorkflowHitlInlineForConversation has cyclomatic complexity 36 and cognitive complexity 49; 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.
R3 · Large Files · web/static/js/chat.js · ×1
  • web/static/js/chat.js: 10350 lines of code web/static/js/chat.js:1 — web/static/js/chat.js has 10350 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 · web/static/js/monitor.js · ×1
  • web/static/js/monitor.js: 9005 lines of code web/static/js/monitor.js:1 — web/static/js/monitor.js has 9005 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 · web/static/js/webshell.js · ×1
  • web/static/js/webshell.js: 5064 lines of code web/static/js/webshell.js:1 — web/static/js/webshell.js has 5064 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 · web/static/js/settings.js · ×1
  • web/static/js/settings.js: 4662 lines of code web/static/js/settings.js:1 — web/static/js/settings.js has 4662 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 · web/static/js/c2.js · ×1
  • web/static/js/c2.js: 4287 lines of code web/static/js/c2.js:1 — web/static/js/c2.js has 4287 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 · web/static/js/projects.js · ×1
  • web/static/js/projects.js: 3892 lines of code web/static/js/projects.js:1 — web/static/js/projects.js has 3892 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 · web/static/js/workflows.js · ×1
  • web/static/js/workflows.js: 2916 lines of code web/static/js/workflows.js:1 — web/static/js/workflows.js has 2916 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 · web/static/js/tasks.js · ×1
  • web/static/js/tasks.js: 2706 lines of code web/static/js/tasks.js:1 — web/static/js/tasks.js has 2706 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 · web/static/js/vulnerability.js · ×1
  • web/static/js/vulnerability.js: 2475 lines of code web/static/js/vulnerability.js:1 — web/static/js/vulnerability.js has 2475 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 · web/static/js/dashboard.js · ×1
  • web/static/js/dashboard.js: 2301 lines of code web/static/js/dashboard.js:1 — web/static/js/dashboard.js has 2301 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 · REDACTED · ×1
  • REDACTED: 2085 lines of code REDACTED:1 — REDACTED has 2085 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 · web/static/js/hitl.js · ×1
  • web/static/js/hitl.js: 1900 lines of code web/static/js/hitl.js:1 — web/static/js/hitl.js has 1900 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 · web/static/js/chat-files.js · ×1
  • web/static/js/chat-files.js: 1795 lines of code web/static/js/chat-files.js:1 — web/static/js/chat-files.js has 1795 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 · web/static/js/roles.js · ×1
  • web/static/js/roles.js: 1724 lines of code web/static/js/roles.js:1 — web/static/js/roles.js has 1724 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 · REDACTED · ×1
  • REDACTED: 1721 lines of code REDACTED:1 — REDACTED has 1721 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 · web/static/js/info-collect.js · ×1
  • web/static/js/info-collect.js: 1572 lines of code web/static/js/info-collect.js:1 — web/static/js/info-collect.js has 1572 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 · web/static/js/rbac.js · ×1
  • web/static/js/rbac.js: 1469 lines of code web/static/js/rbac.js:1 — web/static/js/rbac.js has 1469 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 · web/static/js/mobile-ui.js · ×1
  • web/static/js/mobile-ui.js: 1150 lines of code web/static/js/mobile-ui.js:1 — web/static/js/mobile-ui.js has 1150 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 · plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js · ×1
  • plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js: 1143 lines of code plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:1 — plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js has 1143 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 · web/static/js/skills.js · ×1
  • web/static/js/skills.js: 1014 lines of code web/static/js/skills.js:1 — web/static/js/skills.js has 1014 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 · web/static/js/update.js · ×1
  • web/static/js/update.js: 986 lines of code web/static/js/update.js:1 — web/static/js/update.js has 986 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 · web/static/js/auth.js · ×1
  • web/static/js/auth.js: 944 lines of code web/static/js/auth.js:1 — web/static/js/auth.js has 944 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 · web/static/js/api-docs.js · ×1
  • web/static/js/api-docs.js: 937 lines of code web/static/js/api-docs.js:1 — web/static/js/api-docs.js has 937 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 · web/static/js/audit.js · ×1
  • web/static/js/audit.js: 843 lines of code web/static/js/audit.js:1 — web/static/js/audit.js has 843 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 · web/static/js/fact-graph.js · ×1
  • web/static/js/fact-graph.js: 766 lines of code web/static/js/fact-graph.js:1 — web/static/js/fact-graph.js has 766 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 · web/static/js/chat-scroll.js · ×1
  • web/static/js/chat-scroll.js: 752 lines of code web/static/js/chat-scroll.js:1 — web/static/js/chat-scroll.js has 752 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 · web/static/js/tool-guard.js · ×1
  • web/static/js/tool-guard.js: 701 lines of code web/static/js/tool-guard.js:1 — web/static/js/tool-guard.js has 701 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 · web/static/js/router.js · ×1
  • web/static/js/router.js: 658 lines of code web/static/js/router.js:1 — web/static/js/router.js has 658 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 · web/static/js/terminal.js · ×1
  • web/static/js/terminal.js: 494 lines of code web/static/js/terminal.js:1 — web/static/js/terminal.js has 494 significant lines (blank lines excluded), over the 400-line bar, and contains logic — a file this long is usually several responsibilities in one module.
R6 · Tooling · No lint script · ×1
  • No lint script — test ✓ · lint ✗ · typecheck ✓ — read from this repository's package.json scripts and corroborated against its CI workflows. A script counts when its name or command matches the step: `test` for the suite, `lint` or `prettier` for linting, `typecheck`/`type-check`/`tsc` for type checking. ✗ therefore means no script or CI step under those names was found, NOT that the step is absent from your pipeline — a task invoked by a runner this check does not read, or named something else entirely, is not seen and is worth confirming before acting on a cross. A ✓ means the wiring is DECLARED — a script or CI step under those names exists. It is not a statement that the step passes, or that it runs at all: nothing here installs a dependency or executes a suite.
Minor — 118 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate internal/robot/discord.go:21 — `!cfg.Enabled || strings.TrimSpace(cfg.BotToken) == ""` appears character-identically in 2 files — internal/robot/discord.go, internal/robot/telegram.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:646 — `!ok || strings.TrimSpace(session.UserID) == ""` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate cmd/server/update_cli.go:48 — `!snap.Installed || snap.CheckError != ""` appears character-identically in 2 files — cmd/server/update_cli.go, internal/update/update.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/config/config.go:805 — `(r >= 'a' && r <= 'z') || (r >= '0' && r <= '9')` appears character-identically in 2 files — internal/config/config.go, internal/workflow/draft_generator.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/handler/skills.go:705 — `(r >= 'a' && r <= 'z') || (r >= '0' && r <= '9') || r == '-'` appears character-identically in 2 files — internal/handler/skills.go, internal/skillpackage/validate.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/c2/listener_http.go:412 — `err != nil || !strings.HasPrefix(absPath, absDir+string(filepath.Separator))` appears character-identically in 2 files — internal/c2/listener_http.go, internal/c2/tcp_beacon_server.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/update/recovery_evidence.go:102 — `err == nil && value == strings.ToLower(value)` appears character-identically in 2 files — internal/update/recovery_evidence.go, internal/workflow/package/manifest.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/handler/multi_agent.go:67 — `errors.Is(cause, ErrTaskCancelled) || errors.Is(cause, multiagent.ErrInterruptContinue)` appears character-identically in 2 files — internal/handler/multi_agent.go, internal/handler/single_agent.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:420 — `h.agentHandler == nil || h.agentHandler.tasks == nil` appears character-identically in 2 files — REDACTED, REDACTED. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/handler/agent.go:932 — `h.config == nil || !h.config.MultiAgent.Enabled` appears character-identically in 3 files — internal/handler/agent.go, internal/handler/multi_agent.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 internal/c2/beacon_host.go:62 — `len(label) == 0 || len(label) > 63 || label[0] == '-' || label[len(label)-1] == '-'` appears character-identically in 2 files — internal/c2/beacon_host.go, internal/database/asset.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/security/procattr_unix.go:25 — `pid <= 0 && cmd != nil && cmd.Process != nil` appears character-identically in 2 files — internal/security/procattr_unix.go, internal/security/procattr_windows.go. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate internal/llm/provider.go:7 — `provider == "claude" || provider == "anthropic"` appears character-identically in 2 files — internal/llm/provider.go, internal/multiagent/pi_model.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/handler/agent.go:2102 — `queue.Status != "completed" && queue.Status != "cancelled"` appears character-identically in 2 files — internal/handler/agent.go, internal/handler/batch_task_mcp.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/knowledge/embedding_http.go:33 — `res.StatusCode < 200 || res.StatusCode >= 300` appears character-identically in 2 files — internal/knowledge/embedding_http.go, internal/openai/claude_native.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:670 — `resp.StatusCode < 200 || resp.StatusCode >= 300` appears character-identically in 4 files — REDACTED, internal/knowledge/rerank_http.go, internal/modelmeta/context.go, internal/robot/ilink/client.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/handler/multi_agent.go:282 — `result != nil && len(result.MCPExecutionIDs) > 0` appears character-identically in 2 files — internal/handler/multi_agent.go, internal/handler/single_agent.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/handler/agent_multi_json_runner.go:90 — `result.LastAgentTraceInput != "" || result.LastAgentTraceOutput != ""` appears character-identically in 4 files — internal/handler/agent_multi_json_runner.go, internal/handler/agent_single_json_runner.go, internal/handler/multi_agent.go, internal/handler/single_agent.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:364 — `role.Icon != "" && strings.HasPrefix(role.Icon, "\\U")` appears character-identically in 2 files — REDACTED, internal/handler/skills.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:587 — `scope == RBACScopeAll || strings.TrimSpace(userID) == ""` appears character-identically in 2 files — REDACTED, internal/database/project.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/mcp/external_manager.go:830 — `snapshot != nil && snapshot.Execution != nil` appears character-identically in 2 files — internal/mcp/external_manager.go, internal/mcp/server.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/mcp/external_manager.go:813 — `snapshot == nil || snapshot.Execution == nil` appears character-identically in 2 files — internal/mcp/external_manager.go, internal/mcp/server.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/handler/multi_agent.go:80 — `ssePublishConversationID != "" && h.taskEventBus != nil` appears character-identically in 2 files — internal/handler/multi_agent.go, internal/handler/single_agent.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:192 — `statErr != nil || !info.Mode().IsRegular()` appears character-identically in 2 files — REDACTED, internal/update/apply.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/agentfinalizer/decision.go:195 — `strings.Contains(s, "no assistant text was captured") || strings.Contains(s, "未捕获到助手文本输出")` appears character-identically in 2 files — internal/agentfinalizer/decision.go, internal/multiagent/empty_response.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.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default on error · ×24
  • Silent fallback default on error internal/app/main_server_http_redirect.go:90 — `portFromListenAddr` turns a non-nil `err` into `return 443` — 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/config/config.go:908 — `normalizedURLHost` 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 REDACTED:562 — `GetResourceOwner` 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 REDACTED:933 — `messageFromRawObject` 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/handler/hitl_audit_backend.go:31 — `stringifyHitlJSON` 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/handler/project_context.go:81 — `conversationProjectID` 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 REDACTED:576 — `cmdProjects` 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 REDACTED:633 — `cmdNewProject` 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 REDACTED:666 — `cmdUnbindProject` 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 REDACTED:690 — `cmdList` 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 REDACTED:717 — `cmdSwitch` 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 REDACTED:765 — `cmdStatus` 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 REDACTED:999 — `cmdDelete` 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 REDACTED:1140 — `cmdBindUser` 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/handler/vulnerability_alert.go:176 — `cmdVulnerabilityAlerts` 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/multiagent/reasoning_trace.go:19 — `AggregatedReasoningFromTraceJSON` 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/multiagent/tool_metadata.go:85 — `HitlRejectToolResult` turns a non-nil `err` into `return `{"selectedTools":[],"_hitlRejected":true,"reason":"tool_search rejected by reviewer"}`` — 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/project/resume.go:114 — `resumeFactBody` 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/storage/category.go:396 — `pruneEmptyDirs` 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 internal/storage/cleaner.go:173 — `rootOf` 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/update/binary.go:24 — `StampBinary` turns a non-nil `err` into `return BinaryStamp{}` — 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/update/build.go:130 — `binaryRevision` 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/update/version.go:35 — `installVersion` 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/vision/path.go:65 — `normalizeAbsPath` 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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×16
  • Silent fallback default in catch REDACTED:7 — `getAssetPageSize` swallows every exception into `return 20` — 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 REDACTED:657 — `readAssetSavedViews` 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 REDACTED:1388 — `assetEditorNormalizeDomain` 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 web/static/js/audit.js:108 — `auditTimezoneShortLabel` 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 web/static/js/c2.js:55 — `activeC2ProjectId` 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 web/static/js/c2.js:73 — `c2ProjectNameMap` 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 web/static/js/c2.js:404 — `formatTaskCommand` 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 web/static/js/c2.js:987 — `C2.getListenerCallbackHost` 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 web/static/js/c2.js:997 — `C2.getListenerConfig` 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 web/static/js/chat-files.js:1350 — `chatFilesFolderNameFromRow` 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 web/static/js/chat.js:842 — `readConversationAgentModePreference` 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 web/static/js/chat.js:4695 — `getPendingMcpExecutionCount` swallows every exception into `return 0` — 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 web/static/js/chat.js:4709 — `getPendingToolExecutionSummaryCount` swallows every exception into `return 0` — 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 web/static/js/chat.js:9517 — `getConversationProjectFilter` 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 web/static/js/dashboard.js:1771 — `readDashboardSeverityStatusFilterFromStorage` 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 web/static/js/hitl.js:13 — `hitlParsePayloadObject` 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.
D29 · Static Analysis (SAST) · REDACTED · ×4
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
X9 · Subsumed condition operand · Subsumed condition operand · ×3
  • Subsumed condition operand internal/security/shell_background_io.go:72 — `strings.Contains(lower, "2>/dev/null")` can never decide this `||` — every value satisfying `strings.Contains(lower, "2>/dev/null")` also satisfies `strings.Contains(lower, ">/dev/null")`, 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.
  • Subsumed condition operand internal/security/shell_background_io.go:75 — `strings.Contains(lower, "&>>")` can never decide this `||` — every value satisfying `strings.Contains(lower, "&>>")` also satisfies `strings.Contains(lower, "&>")`, 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.
  • Subsumed condition operand internal/security/shell_noninteractive.go:113 — `strings.Contains(lower, "0</dev/null")` can never decide this `||` — every value satisfying `strings.Contains(lower, "0</dev/null")` also satisfies `strings.Contains(lower, "</dev/null")`, 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.
D29 · Static Analysis (SAST) · REDACTED · ×2
  • REDACTED
  • REDACTED
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found plugins/burp-suite/cyberstrikeai-burp-extension/pom.xml:36 — 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 `plugins/burp-suite/cyberstrikeai-burp-extension/pom.xml` makes this repository a deployable product (line 36).
D21 · Naming Consistency · `HandleWecomGET` spells `GET` where 12 names in the project spell it `Get` · ×1
  • `HandleWecomGET` spells `GET` where 12 names in the project spell it `Get` REDACTED:1413 — 12 of 13 names in project cyberstrike-ai spell the token `Get` (12 of 13; unit: names in project cyberstrike-ai containing `Get`). Peers: app.registerGetVulnerabilityTool (internal/app/vulnerability_tools.go:424); MonitorHandler.BatchGetToolNames (internal/handler/monitor.go:684); builtin.ToolGetVulnerability (internal/mcp/builtin/constants.go:9); builtin.ToolGetAsset (internal/mcp/builtin/constants.go:14); builtin.ToolGetProjectFact (internal/mcp/builtin/constants.go:22). Rename to `HandleWecomGet`. [rule N6]
D21 · Naming Consistency · `handleQQGroupATMessage` spells `AT` where 130 names in the project spell it `At` · ×1
  • `handleQQGroupATMessage` spells `AT` where 130 names in the project spell it `At` internal/robot/qq.go:142 — 130 of 131 names in project cyberstrike-ai spell the token `At` (130 of 131; unit: names in project cyberstrike-ai containing `At`). Peers: Event.CreatedAt (internal/c2/eventbus.go:21); TCPReverseListener.reportTaskResult(startedAtMS) (internal/c2/listener_tcp.go:320); TaskResultReport.StartedAt (internal/c2/types.go:219); TaskResultReport.EndedAt (internal/c2/types.go:220); AgentRun.CreatedAt (internal/database/agent_runs.go:18). Rename to `handleQQGroupAtMessage`. [rule N6]
D21 · Naming Consistency · `ResolveSKILLPath` spells `SKILL` where 30 names in the project spell it `Skill` · ×1
  • `ResolveSKILLPath` spells `SKILL` where 30 names in the project spell it `Skill` internal/skillpackage/layout.go:16 — 30 of 31 names in project cyberstrike-ai spell the token `Skill` (30 of 31; unit: names in project cyberstrike-ai containing `Skill`). Peers: DB.SaveSkillStats (internal/database/skill_stats.go:20); DB.LoadSkillStats (internal/database/skill_stats.go:50); DB.UpdateSkillStats (internal/database/skill_stats.go:90); DB.ClearSkillStats (internal/database/skill_stats.go:121); DB.ClearSkillStatsByName (internal/database/skill_stats.go:133). Rename to `ResolveSkillPath`. [rule N6]
D21 · Naming Consistency · `applyRBACToUI` spells `RBAC` where 72 names in the project spell it `Rbac` · ×1
  • `applyRBACToUI` spells `RBAC` where 72 names in the project spell it `Rbac` web/static/js/auth.js:557 — 72 of 73 names in project repository spell the token `Rbac` (72 of 73; unit: names in project repository containing `Rbac`). Peers: rbac.clearRbacResourceSelection (web/static/js/rbac.js:161); rbac.renderRbacNoRoleNotice (web/static/js/rbac.js:170); rbac.renderRbacPendingSelection (web/static/js/rbac.js:188); rbac.removeRbacPendingItem (web/static/js/rbac.js:218); rbac.removeRbacManualPending (web/static/js/rbac.js:225). Rename to `applyRbacToUI`. [rule N6]
D21 · Naming Consistency · `chatFilesIDDisplay` spells `ID` where 421 names in the project spell it `Id` · ×1
  • `chatFilesIDDisplay` spells `ID` where 421 names in the project spell it `Id` web/static/js/chat-files.js:851 — 421 of 426 names in project repository spell the token `Id` (421 of 426; unit: names in project repository containing `Id`). Peers: service-worker.getCaptures(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:12); service-worker.broadcastTab(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:23); service-worker.cleanupOldTabs(activeTabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:35); api.agentModeById (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:8); api.extractConversationId (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:106). Rename to `chatFilesIdDisplay`. [rule N6]
D21 · Naming Consistency · `chatFilesGroupHeadingID` spells `ID` where 421 names in the project spell it `Id` · ×1
  • `chatFilesGroupHeadingID` spells `ID` where 421 names in the project spell it `Id` web/static/js/chat-files.js:980 — 421 of 426 names in project repository spell the token `Id` (421 of 426; unit: names in project repository containing `Id`). Peers: service-worker.getCaptures(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:12); service-worker.broadcastTab(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:23); service-worker.cleanupOldTabs(activeTabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:35); api.agentModeById (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:8); api.extractConversationId (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:106). Rename to `chatFilesGroupHeadingId`. [rule N6]
D21 · Naming Consistency · `getKnowledgeNotEnabledHTML` spells `HTML` where 45 names in the project spell it `Html` · ×1
  • `getKnowledgeNotEnabledHTML` spells `HTML` where 45 names in the project spell it `Html` REDACTED:17 — 45 of 46 names in project repository spell the token `Html` (45 of 46; unit: names in project repository containing `Html`). Peers: markdown.mdEscapeHtml (plugins/browser-extension/cyberstrikeai-browser-extension/lib/markdown.js:3); markdown.markdownToHtml (plugins/browser-extension/cyberstrikeai-browser-extension/lib/markdown.js:68); panel.escapeHtml (plugins/browser-extension/cyberstrikeai-browser-extension/panel/panel.js:273); api-docs.escapeHtml (web/static/js/api-docs.js:1003); auth.escapeHtml (web/static/js/auth.js:697). Rename to `getKnowledgeNotEnabledHtml`. [rule N6]
D21 · Naming Consistency · `mergeMcpExecutionIDLists` spells `ID` where 421 names in the project spell it `Id` · ×1
  • `mergeMcpExecutionIDLists` spells `ID` where 421 names in the project spell it `Id` web/static/js/monitor.js:2712 — 421 of 426 names in project repository spell the token `Id` (421 of 426; unit: names in project repository containing `Id`). Peers: service-worker.getCaptures(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:12); service-worker.broadcastTab(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:23); service-worker.cleanupOldTabs(activeTabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:35); api.agentModeById (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:8); api.extractConversationId (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:106). Rename to `mergeMcpExecutionIdLists`. [rule N6]
D21 · Naming Consistency · `batchHITLPolicyLabel` spells `HITL` where 144 names in the project spell it `Hitl` · ×1
  • `batchHITLPolicyLabel` spells `HITL` where 144 names in the project spell it `Hitl` web/static/js/tasks.js:2978 — 144 of 146 names in project repository spell the token `Hitl` (144 of 146; unit: names in project repository containing `Hitl`). Peers: chat.normalizeHitlMode (web/static/js/chat.js:417); chat.normalizeHitlTimeoutForChat (web/static/js/chat.js:426); chat.defaultHitlConfig (web/static/js/chat.js:432); chat.normalizeHitlReviewer (web/static/js/chat.js:448); chat.getHitlStorageKeyByConversation (web/static/js/chat.js:500). Rename to `batchHitlPolicyLabel`. [rule N6]
D21 · Naming Consistency · `startInlineEditHITLPolicy` spells `HITL` where 144 names in the project spell it `Hitl` · ×1
  • `startInlineEditHITLPolicy` spells `HITL` where 144 names in the project spell it `Hitl` web/static/js/tasks.js:2982 — 144 of 146 names in project repository spell the token `Hitl` (144 of 146; unit: names in project repository containing `Hitl`). Peers: chat.normalizeHitlMode (web/static/js/chat.js:417); chat.normalizeHitlTimeoutForChat (web/static/js/chat.js:426); chat.defaultHitlConfig (web/static/js/chat.js:432); chat.normalizeHitlReviewer (web/static/js/chat.js:448); chat.getHitlStorageKeyByConversation (web/static/js/chat.js:500). Rename to `startInlineEditHitlPolicy`. [rule N6]
D21 · Naming Consistency · `bootID` spells `ID` where 421 names in the project spell it `Id` · ×1
  • `bootID` spells `ID` where 421 names in the project spell it `Id` web/static/js/update.js:267 — 421 of 426 names in project repository spell the token `Id` (421 of 426; unit: names in project repository containing `Id`). Peers: service-worker.getCaptures(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:12); service-worker.broadcastTab(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:23); service-worker.cleanupOldTabs(activeTabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:35); api.agentModeById (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:8); api.extractConversationId (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:106). Rename to `bootId`. [rule N6]
D21 · Naming Consistency · `caseID` spells `ID` where 421 names in the project spell it `Id` · ×1
  • `caseID` spells `ID` where 421 names in the project spell it `Id` web/static/js/vulnerability-workspace.js:45 — 421 of 426 names in project repository spell the token `Id` (421 of 426; unit: names in project repository containing `Id`). Peers: service-worker.getCaptures(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:12); service-worker.broadcastTab(tabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:23); service-worker.cleanupOldTabs(activeTabId) (plugins/browser-extension/cyberstrikeai-browser-extension/background/service-worker.js:35); api.agentModeById (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:8); api.extractConversationId (plugins/browser-extension/cyberstrikeai-browser-extension/lib/api.js:106). Rename to `caseId`. [rule N6]
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion REDACTED:1 — `(repository root)` (178110 LoC, 640 module-visible types across 57 directories) overshoots its size bounds. 1 of 3 build unit(s) (Go, Maven, npm) overshoot their size bounds, lowering Project Cohesion to 3.3/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.
D27 · Navigability · Scattered collaborators · ×1
  • Scattered collaborators — 42 % of calls cross a namespace and only 56 % of collaborators are co-located — group each feature's code into a vertical slice so a call's collaborators sit together.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Low CVE · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • 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.
P2 · Observability · Logging is not universal · ×1
  • Logging is not universal — Only 1/2 runnable modules use logging (modules with no entry point or server are excluded — they are libraries a runnable module hosts). Silent: `.`.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:5 — No static application security testing detected. For this repository's stack, add gosec / govulncheck (or golangci-lint) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 5 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P3 · Security & performance tooling · No dependency-update automation · ×1
  • No dependency-update automation runtime/pi/package.json:12 — `runtime/pi/package.json` declares packages, and nothing in the repository keeps them current: no Dependabot or Renovate configuration that schedules updates, and no dependency-review gate on pull requests. A pinned dependency stays at the version it was added at until someone notices — including after an advisory is published against it. Add a `.github/dependabot.yml` with one `package-ecosystem` entry per ecosystem the tree uses (or an enabled `renovate.json`), and gate pull requests with `actions/dependency-review-action`.
P6 · Release Hygiene · Changelog looks stale/thin · ×1
  • Changelog looks stale/thin — The changelog this check read carries 1 versioned entry, against a bar of 3. Counted as either the distinct `x.y.z` versions it names (a link's target is not counted) or its version-shaped section headings (`## [1.2.0]`, `## V14.x.x`, `## Updates in 8.0.x`), whichever is the larger — so a log sectioned by minor series counts its sections, not its individual patch numbers. Entries recorded somewhere this check does not read — release notes generated at tag time from a generator config it did not recognise, or a log kept outside the repository — are not counted here, and this row is about what is re-findable in the tree rather than about how often you release.
R7 · Dead Code · Unused module-local declaration 'WRITE_RE' · ×1
  • Unused module-local declaration 'WRITE_RE' scripts/mobile-tap-audit.mjs:67 — This top-level declaration is not exported and its name occurs nowhere else in its module — not called, read, typed against, re-exported or named by a string. Nothing outside the module can reach a non-exported binding, so this is the whole search: remove it, or use it.
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 21/30 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.
X4 · Structured logging · Interpolated log message defeats structured logging · ×1
  • Interpolated log message defeats structured logging cmd/server/main.go:170 — `Info` at line 170 is handed a message assembled at the call — `fmt.Sprintf` with values, or a string concatenated with a value — so the logger receives one finished string: the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Pass a constant message and the values as attributes instead: `slog.Info("order moved", "order_id", orderID, "status", status)` with log/slog, `logger.Info("order moved", zap.String("order_id", orderID))` with zap, `log.WithFields(log.Fields{"order_id": orderID}).Info("order moved")` with logrus, or `log.Info().Str("order_id", orderID).Msg("order moved")` with zerolog.
X5 · Nullable reference types · Null assertions (`!`) override strict null checking · ×1
  • Null assertions (`!`) override strict null checking — ~4.3 `!` null assertions per 1k TypeScript source lines — 2 assertion(s) across the 462 source line(s) of the 4 TypeScript file(s) read, which is the only code the operator asserts anything in (a `!` in a `.js` file is not this operator and was not counted, and one in a file whose null checking is off silences nothing). Densest: runtime/pi/src/worker.ts (2). Each one tells the compiler to trust the author about null, suppressing the very diagnostic `strictNullChecks` exists to produce. Many are correct: each is a claim the checker could not verify, and it is wrong only where the value can in fact be missing, so review the densest places first.
Minor — 13 finding(s)
D12 · Dependency Hygiene · Outdated · ×13
  • Outdated: github.com/bytedance/sonic — `github.com/bytedance/sonic` is required at v1.15.0 in REDACTED, but v1.15.5 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/bytedance/sonic@v1.15.5 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/gin-gonic/gin — `github.com/gin-gonic/gin` is required at v1.9.1 in REDACTED, but v1.12.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/gin-gonic/gin@v1.12.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/larksuite/oapi-sdk-go/v3 — `github.com/larksuite/oapi-sdk-go/v3` is required at v3.4.22 in REDACTED, but v3.13.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/larksuite/oapi-sdk-go/v3@v3.13.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/mattn/go-sqlite3 — `github.com/mattn/go-sqlite3` is required at v1.14.18 in REDACTED, but v1.14.53 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/mattn/go-sqlite3@v1.14.53 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/modelcontextprotocol/go-sdk — `github.com/modelcontextprotocol/go-sdk` is required at v1.3.1 in REDACTED, but v1.8.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/modelcontextprotocol/go-sdk@v1.8.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: github.com/slack-go/slack — `github.com/slack-go/slack` is required at v0.27.0 in REDACTED, but v0.36.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get github.com/slack-go/slack@v0.36.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: go.uber.org/zap — `go.uber.org/zap` is required at v1.26.0 in REDACTED, but v1.28.0 is the module's current release — so this build is missing every fix published since, including any security fix. Run `go get go.uber.org/zap@v1.28.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/crypto — `golang.org/x/crypto` is required at v0.50.0 in REDACTED, but v0.59.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/crypto@v0.59.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/net — `golang.org/x/net` is required at v0.53.0 in REDACTED, but v0.62.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/net@v0.62.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/sys — `golang.org/x/sys` is required at v0.43.0 in REDACTED, 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 REDACTED and go.sum.
  • Outdated: golang.org/x/term — `golang.org/x/term` is required at v0.42.0 in REDACTED, but v0.48.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/term@v0.48.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/text — `golang.org/x/text` is required at v0.37.0 in REDACTED, but v0.44.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/text@v0.44.0 && go mod tidy` and commit the updated REDACTED and go.sum.
  • Outdated: golang.org/x/time — `golang.org/x/time` is required at v0.14.0 in REDACTED, but v0.16.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/time@v0.16.0 && go mod tidy` and commit the updated REDACTED and go.sum.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-cba0c075e51b483492606eb59b61e512/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-cba0c075e51b483492606eb59b61e512/history-1.json --exit-code 0 --source .0artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=1481" --report-format json --report-path /tmp/watchdog-gitleaks-cba0c075e51b483492606eb59b61e512/history-2.json --exit-code 0 --source .2artifacts/raw/gitleaks-history-2.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-cba0c075e51b483492606eb59b61e512/tree.json --exit-code 0 --source .0artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .97artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .8artifacts/raw/trivy-fs.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—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. semgrep could not parse 3 file(s) — `web/static/js/chat.js`, `web/static/js/monitor.js`, `web/static/js/webshell.js` — so the PII/GDPR sweep did not cover them at all.0—
D40 · Network Egress Confinementruntime-hardening—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.0—
D41 · Kernel & Syscall Confinementruntime-hardening—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.0—
D42 · Runtime Threat Enforcementruntime-hardening—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.0—
D43 · Malicious Dependenciestrivy—trivy fs --scanners vuln --format json --quiet --severity CRITICAL,HIGH,MEDIUM,LOW --skip-dirs **/bin/** --skip-dirs **/obj/** .0artifacts/raw/trivy-fs.json

Run 01a1e8ba-110f-7b1d-8936-b9b90ed29d81 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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