Public report — shadowsocks-rust, published 29 Sep 2026. Concrete security findings (which rule fired, in which file, on which line; CVE IDs, secret matches, dependency versions) are REDACTED in this version; ask the repo owner for the full report.
Public
Codebase survey Measured under the Code Assurance Index · rubric rubric-2026.09.17 (frozen) · verify this survey Filed cd_6b0db634c2564ca8aee7d188453371ba Filed 29 September 2026, 03:45 UTC Public

Shadowsocks/shadowsocks-Rust

Measured 29 September 2026, 03:36 UTC

70% Adequate
CriticalWeakAdequateStrongExemplary

Medium · 95,150 LoC · 3 projects · rebuild ~0.9 person-years · weakest lens: Security (62%)

Findings by grade

60 critical 375 serious 24 minor 47 could not be resolved — could be critical — see Limitations

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
29 September 2026, 03:36 UTC

A measurement, not a certificate. The Code Assurance Index does not certify, approve or guarantee this codebase; it records a reproducible number and the evidence it was computed from. The standard is authored by Canine Development, who also build Watchdog — its only implementation today. That is said here so the number is checked rather than believed.

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

36/41dimensions tool-verifieddeterministic · confidence 1.0 · 5 LLM-assisted, advisory
436findings with an exact file:lineof 459 — the remainder are repo-wide signals (a dimension-level measurement, not a single line); open any file:line and verify
41/120dimensions across the health lenses95150 LoC · 3 projects — wide & deep
Chapters

Executive summary

The system holds an adequate standing with a health score of 70%, reflecting a workable asset that carries manageable but distinct risks. While the core logic is sound, the organization faces a velocity tax on every change and a security exposure that threatens operational stability. This is not a fragile system, but it is one where technical debt is quietly eroding delivery speed and increasing the cost of maintenance.

The asset is medium-sized, comprising nearly 95,000 lines of production code with a rebuild cost of approximately €130,000. The value tied up here is significant, yet the composition suggests a high degree of custom logic rather than boilerplate. This means changes are likely to be complex and require deep domain knowledge. The cost of inaction is not just financial but temporal; every modification to the weaker areas of the codebase incurs a hidden premium, slowing down feature delivery and increasing the likelihood of defects.

The most pressing theme is the velocity tax embedded in the code quality. With an average complexity score of 6.4 out of 10, the codebase imposes a 4–9% drag on every change. This is not a one-time cost but a recurring tax that compounds as the team grows. It means that simple updates take longer, resources are wasted on navigating complexity, and the team’s capacity to innovate is steadily diminished. This drag is the silent killer of productivity, making every sprint harder than it needs to be.

The second critical theme is security exposure. With a security score of 62%, the system is vulnerable to operational risks that could lead to outages or data breaches. The weakest lens here concentrates the risk, meaning that a single failure could have disproportionate business impact. Remediation in this area buys the most protection, yet it is often deprioritized in favor of feature work. This imbalance leaves the business exposed to threats that could disrupt service and damage trust.

What is genuinely good is the system’s performance, which is rated at 100%, and its architectural coherence at 84%. The code is well-structured and reliable under load, providing a solid foundation for future growth. The maturity score of 70% indicates that while documentation and onboarding could be improved, the system is not a black box. These strengths provide a stable base from which to address the identified risks.

The first focus should be on resolving the lack of Architecture Decision Records (ADRs). This single action pays for itself by clarifying design intent and reducing future decision-making overhead. It is the highest-leverage move, costing only a few engineer-days to implement while preventing years of confusion. By documenting significant decisions, the team can accelerate onboarding and reduce the risk of repeating past mistakes. This step is essential for unlocking the system’s full potential and ensuring that the velocity tax is gradually eliminated.

How the score is built — each lens's share of the headline Width is the lens's weight in the worst-heaviest fold (the weakest area pulls hardest); colour is that lens's own band. A lens fixes the score in proportion to its width.
Security 62% · 46% weightMaturity 70% · 25% weightReadiness 79% · 14% weightCode Health 83% · 8% weightArchitecture 84% · 4% weightPerformance 100% · 2% weight

Raise Security 62 → 70 (the Healthy floor) ⇒ headline 70 → ~74.

Code composition — where the lines go
Tests 100%
New since the last scan (9+)

9 finding(s) are new versus the previous scan (2026-09-12) — surfaced by this scheduled scan itself, no pull request required.

  • D4 · Duplicated block (19 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs
  • D4 · Duplicated block (8 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs
  • D5 · Off the main sequence: shadowsocks
  • D22 · Duplicate intent with divergent naming and scope. `ServerType` and `ConfigType` appear to represent the same conceptual enum (Local/Server/Manager/etc.), but are split across two modules with different method signatures. `ServerType` only has `is_local`/`is_server`, while `ConfigType` has `is_manager`/`is_online_config` as well. This forces users to import two different types for similar checks.
  • D22 · Redundant accessors for the same underlying data. `key()` and `password()` likely return the same secret material (one as bytes, one as string). `export_password()` is a third variant. This creates confusion about which method to use for serialization vs internal use.
  • D22 · Inconsistent naming for cloning/copying operations. `clone_identity_hash` and `clone_identity_keys` use the verb `clone` for returning owned data, whereas Rust idioms typically use `to_owned()` or just rely on the type system. More importantly, `ServerUser` has `clone_identity_hash` but `ServerConfig` has `clone_identity_keys`. The naming is inconsistent between the two types (`hash` vs `keys`).
  • D22 · Confusingly similar method names with different signatures. `send_to` and `send_to_manager` both send data, but take different target types (`ManagerSocketAddr` vs `ManagerAddr`) and one takes a `Context`. This suggests `send_to_manager` is a higher-level wrapper, but the naming is not distinct enough to prevent confusion.
  • D22 · Ambiguous constructor variants. `new` takes a generic key `K`, while `with_encoded_key` takes a `str`. It is unclear if `new` expects raw bytes or encoded strings, leading to potential misuse. The existence of `with_encoded_key` suggests `new` might not handle string encoding, but the naming doesn't make this distinction clear.
  • D22 · Redundant methods with unclear distinction. `get_user_by_hash` and `clone_user_by_hash` both return `ServerUser`. In Rust, `get` usually implies borrowing or returning a reference, but here both return owned `ServerUser`. The distinction between 'get' and 'clone' is semantically weak if the return type is identical.

A full-fidelity diff against the previous run's complete recorded findings — line-move tolerant: a finding that only shifted line counts as unchanged, only genuinely new titles/files surface here.

Rebuild cost & value ~ Modeled — €42,000–€210,000
Cost to rebuild€42,000–€210,000 (0.4–1.3 person-years (697–2,211 h), ~1–2 engineers)
Domain complexityStandard — harder problems cost more per line
Quality factor1.0× (at 70% quality) — the last 20% of quality is most of the work
Size & shapeMedium · effort split not classified (source measured from disk; the effort-tier breakdown is a C#-only syntax walk)

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

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

Top priorities

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

1
Resolve the 1 No ADRs found finding(s) in ADR Quality.
+3.5 pts · Low effort · ADR Quality
2
Resolve the 1 No network policy finding(s) in Network Egress Confinement.
+2.1 pts · Low effort · Network Egress Confinement
3
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
+3.5 pts · Medium effort · Architecture documentation

Diagnosis — what's actually going on

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

Architecture — module dependency graph

Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways — a layering smell or cycle. A clean layered graph has none.

arch shadowsocks shadowsocks shadowsocks-rust shadowsocks-rust shadowsocks-service shadowsocks-service shadowsocks-rust->shadowsocks-service shadowsocks-service->shadowsocks

Architecture — module dependency matrix

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

172 modules, 459 dependencies. 5 dependency cycles across 19 modules, marked above the diagonal.

Showing the 40 most-connected modules; 132 more are not drawn.

Module dependency matrix. The row depends on the column; the number is how many type pairs create the dependency. A cell above the diagonal is part of a dependency cycle.
depends on →1 shadowsocks.net.option2 shadowsocks.dns_resolver.resolver3 shadowsocks.plugin4 shadowsocks.relay.udprelay.options5 shadowsocks.context6 shadowsocks.relay.udprelay.proxy_socket7 shadowsocks.manager.error8 shadowsocks.relay.socks59 shadowsocks.config10 shadowsocks.net.udp11 shadowsocks_service.acl12 shadowsocks_service.config13 shadowsocks_service.local.redir.redir_ext14 shadowsocks_service.manager.server15 shadowsocks_service.net.outbound16 shadowsocks.net.sys.unix.bsd.freebsd17 shadowsocks.net.tcp18 shadowsocks_service.local.context19 shadowsocks_service.server.context20 shadowsocks_service.local.dns.client_cache21 shadowsocks_service.local.loadbalancing.server_data22 shadowsocks_service.server.tcprelay23 shadowsocks_service.server.udprelay24 shadowsocks_service.local.loadbalancing.ping_balancer25 shadowsocks_service.local.net.tcp.auto_proxy_stream26 shadowsocks_service.server.server27 shadowsocks_service.local.dns.server28 shadowsocks_service.local.http.http_client29 shadowsocks_service.local.net.udp.association30 shadowsocks_service.local.redir.tcprelay31 shadowsocks_service.local.tun.tcp32 shadowsocks_service.local.http.server33 shadowsocks_service.local.redir.udprelay34 shadowsocks_service.local.tun35 shadowsocks_service.local.tunnel.udprelay36 shadowsocks_service.local.redir.server37 shadowsocks_service.local.socks.server.server38 shadowsocks_service.local.tunnel.server39 shadowsocks_service.local.socks.server40 shadowsocks_service.local
1 shadowsocks.net.option
2 shadowsocks.dns_resolver.resolver2
3 shadowsocks.plugin4
4 shadowsocks.relay.udprelay.options1
5 shadowsocks.context12
6 shadowsocks.relay.udprelay.proxy_socket21112
7 shadowsocks.manager.error1
8 shadowsocks.relay.socks521
9 shadowsocks.config11
10 shadowsocks.net.udp21111
11 shadowsocks_service.acl121
12 shadowsocks_service.config11263
13 shadowsocks_service.local.redir.redir_ext122
14 shadowsocks_service.manager.server41224
15 shadowsocks_service.net.outbound131
16 shadowsocks.net.sys.unix.bsd.freebsd31211
17 shadowsocks.net.tcp221111
18 shadowsocks_service.local.context2111121
19 shadowsocks_service.server.context1111121
20 shadowsocks_service.local.dns.client_cache11111
21 shadowsocks_service.local.loadbalancing.server_data1111
22 shadowsocks_service.server.tcprelay111113
23 shadowsocks_service.server.udprelay12223
24 shadowsocks_service.local.loadbalancing.ping_balancer5244
25 shadowsocks_service.local.net.tcp.auto_proxy_stream221121
26 shadowsocks_service.server.server211412211
27 shadowsocks_service.local.dns.server651111513
28 shadowsocks_service.local.http.http_client12221
29 shadowsocks_service.local.net.udp.association2151153
30 shadowsocks_service.local.redir.tcprelay1111122
31 shadowsocks_service.local.tun.tcp11122
32 shadowsocks_service.local.http.server11331
33 shadowsocks_service.local.redir.udprelay11121111
34 shadowsocks_service.local.tun2111
35 shadowsocks_service.local.tunnel.udprelay312221
36 shadowsocks_service.local.redir.server211111
37 shadowsocks_service.local.socks.server.server61331
38 shadowsocks_service.local.tunnel.server12111
39 shadowsocks_service.local.socks.server2111
40 shadowsocks_service.local41111111
Dependency, pointing down the layeringAbove the diagonal — part of a cycleThe module itself
shadowsocks.net.option…dns_resolver.resolvershadowsocks.plugin…elay.udprelay.optionsshadowsocks.context…udprelay.proxy_socket…owsocks.manager.error…dowsocks.relay.socks5shadowsocks.configshadowsocks.net.udp…adowsocks_service.acl…wsocks_service.config…local.redir.redir_ext…ervice.manager.server…_service.net.outbound….sys.unix.bsd.freebsdshadowsocks.net.tcp…service.local.context…ervice.server.context…ocal.dns.client_cache…balancing.server_data…rvice.server.tcprelay…rvice.server.udprelay…lancing.ping_balancer…tcp.auto_proxy_stream…service.server.server…vice.local.dns.server…ocal.http.http_client…l.net.udp.association….local.redir.tcprelay…service.local.tun.tcp…ice.local.http.server….local.redir.udprelay…cks_service.local.tun…local.tunnel.udprelay…ce.local.redir.server…l.socks.server.server…e.local.tunnel.server…ce.local.socks.server…owsocks_service.localshadowsocks.net.option1…dns_resolver.resolver2shadowsocks.plugin3…elay.udprelay.options4shadowsocks.context5…udprelay.proxy_socket6…owsocks.manager.error7…dowsocks.relay.socks58shadowsocks.config9shadowsocks.net.udp10…adowsocks_service.acl11…wsocks_service.config12…local.redir.redir_ext13…ervice.manager.server14…_service.net.outbound15….sys.unix.bsd.freebsd16shadowsocks.net.tcp17…service.local.context18…ervice.server.context19…ocal.dns.client_cache20…balancing.server_data21…rvice.server.tcprelay22…rvice.server.udprelay23…lancing.ping_balancer24…tcp.auto_proxy_stream25…service.server.server26…vice.local.dns.server27…ocal.http.http_client28…l.net.udp.association29….local.redir.tcprelay30…service.local.tun.tcp31…ice.local.http.server32….local.redir.udprelay33…cks_service.local.tun34…local.tunnel.udprelay35…ce.local.redir.server36…l.socks.server.server37…e.local.tunnel.server38…ce.local.socks.server39…owsocks_service.local402411221112121112111112111263122412241313121122111121111211111121111111111111113122235244221121211412211651111513122212151153111112211122113311112111121113122212111116133112111211141111111+132 more modules (most-connected shown)

At a glance — Code Health · 83% · Strong ·

At a glance — Architecture · 84% · Adequate · gated by D26 ·

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

At a glance — Readiness · 79% · Strong ·

At a glance — Security · 62% · Adequate · gated by D29, D31, D36 ·

At a glance — Performance · 100% · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A05:2021 — Security Misconfiguration71High / Critical
A03:2021 — Injection58High / Critical
A02:2021 — Cryptographic Failures1High / Critical

Roadmap

First, resolve the missing architectural decision records by documenting significant choices with their context and consequences in a standard directory structure. Next, address the 56 medium-severity infrastructure and container security findings, prioritizing fixes in the shadowsocks-rust configuration, REDACTED, and deployment manifests. Finally, enhance documentation quality by adding a testing section to the root README and expanding the thin summaries in the service and core crates directories to include clear installation and usage guidance.

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

Do thisHelpsEffortDimension
Resolve the 1 No ADRs found finding(s) in ADR Quality.+3.5 ptsLowADR Quality
Resolve the 1 No network policy finding(s) in Network Egress Confinement.+2.1 ptsLowNetwork Egress Confinement
Record significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).+3.5 ptsMediumArchitecture documentation
Resolve the 56 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (44), REDACTED (5), REDACTED (5).+3.1 ptsMediumIaC & Container Security
Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED, REDACTED.+1.5 ptsLowStatic Analysis (SAST)
Improve Documentation Quality — currently 6.0/10.+2.8 ptsMediumDocumentation Quality
Add a 'Testing' section to the root README — how to run the test suite.+2.8 ptsMediumDocumentation (README)
Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED.+1.3 ptsLowSecret Scanning

File quality

Per-file score 0–10 — a quality signature. Of 86 files carrying findings, judged against the Production bar: 5% slop · 67% mixed · 28% near-clean.

FileScoreBandWorst signal
REDACTED0.2SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.1SlopIaC & Container Security: High IaC: REDACTED
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED2.8SlopIaC & Container Security: High IaC: REDACTED
REDACTED4.1MixedIaC & Container Security: High IaC: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.5MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.6MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
crates/shadowsocks-service/src/local/tun/tcp.rs6.0MixedExplicit Debt: FixmeComment
crates/shadowsocks-service/src/acl/mod.rs6.0MixedExplicit Debt: FixmeComment
crates/shadowsocks-service/src/local/http/http_service.rs6.0MixedExplicit Debt: FixmeComment
crates/shadowsocks-service/src/local/net/udp/association.rs6.0MixedExplicit Debt: FixmeComment
crates/shadowsocks-service/src/local/tun/mod.rs6.0MixedExplicit Debt: XxxComment
crates/shadowsocks-service/src/server/udprelay.rs6.0MixedExplicit Debt: FixmeComment
crates/shadowsocks-service/src/manager/server.rs6.0MixedExplicit Debt: TodoComment
crates/shadowsocks/src/net/sys/unix/mod.rs6.0MixedExplicit Debt: FixmeComment

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

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

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

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

Could not be resolved — 47

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

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

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

What we checked — 41 dimensions across the health lenses
D1D2D3D4D5D9D12D13D14D15D17D19D20D21D22D26D28D29D30D31D34D35D36D40D41D43D44AX10AX3AX4AX9M1M2M3M4P1P2P3P4P6PF3

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, 436 of 459 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
  2. Is there a tool behind the number? Every score below names the method that produced it — Roslyn, git, a scanner, or (for a handful of documentation/naming dimensions) an LLM labelled sampled · advisory — not a narrative.
  3. Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog 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 · trivy · checkovSecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3 · 3.2.533✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurementLocal LLM◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a0eb3c-4d9e-752b-8dc8-66e224a101de.

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.

  • D6 Cohesion (LCOM4) — not measured this run — Watchdog 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 the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D8 Code Coverage — not measured this run — Watchdog 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. Coverage NOT MEASURED: test source is present (.rs, .rb) but the built-in coverage collector has no runner for this repository's ecosystem — so this suite was never executed by it. Not scored — this is a gap in the analyzer's language coverage, not a defect in the repo. To have real coverage read, produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or SimpleCov — `require "simplecov"` in your `spec_helper.rb`/`test_helper.rb`, which writes `coverage/.resultset.json` (or lcov via `simplecov-lcov`)) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures. You can widen what we reach: optional: produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`, or SimpleCov — `require "simplecov"` in your `spec_helper.rb`/`test_helper.rb`, which writes `coverage/.resultset.json` (or lcov via `simplecov-lcov`)) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures — then the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog 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. Test source is present (.rs, .rb) and this repository declares a Cargo test suite (repository root, 24 test files), but it was not re-run: the analyzer environment could not run it. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • 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 (123 contributor(s) across 3455 commit(s) sampled, automation and bot accounts excluded). One of them holds 86% of the history; the other 122 hold 0.1% 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.
  • AX1 Captive dependencies — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • AX2 Stateful singletons — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • AX6 Interface segregation — not measured this run — Watchdog 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 is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing 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.
  • C1 Data Protection — not measured this run — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 — Watchdog 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 finds retry-prone mutations by walking the repository's declared types, and NONE was loaded on this run, so it had nothing to look at. That is a limit of the analyzer's reach — it reads .NET projects — not a finding that this repository has no command handlers or message consumers.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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 — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • P10 Library API & versioning — not measured this run — Watchdog 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 NuGet packaging and C# public API only, and no .NET project was loaded for this repository, 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.
  • PF1 Benchmark discipline — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • PF2 Allocation hygiene — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • S1 Web-Security Posture — not measured this run — Watchdog 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 — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X10 Duplicated predicate — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X12 Unreachable branch — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X13 Undrained process stream — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X14 Bypassable address classification — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X15 Unvalidated length from an untrusted reader — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X16 Unfloored truncation loop — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X17 Uncapped recursion over a caller-supplied document — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X18 Disposal-pattern correctness — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X19 Unrestored process-global state — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X2 Cancellation propagation — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X20 Mistyped argument guard — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X21 Side-effecting pattern guard — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X22 Contradicted release guard — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X23 Unguarded diagnostic materialisation — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X24 Document value interpolated into markup unescaped — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X25 Inert configuration knob — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X26 Unsynchronised callback handoff — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X27 Collection changed while being enumerated — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X28 Index access outside its own emptiness guard — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X29 Per-element action decided by a fixed element — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X3 Exception handling — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X30 Support guard that admits what it rejects — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X32 Type resolved by simple name across every loaded assembly — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X4 Structured logging — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X5 Nullable reference types — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X6 Hand-rolled structured-format parsing — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing 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.
  • X7 Silent fallback defaults — not measured this run — Watchdog 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 is implemented over the C# syntax tree, and no C# was loaded on this run, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

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

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — 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.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • 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 Secret Scanning: Secret detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • 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 is judged by an LLM over a bounded sample of docs — it reads what is written, not whether the docs match the running system, and it is advisory, not a measurement. Its critique rows are drawn from a closed category vocabulary and each row means the same thing in every run, so two scans can be compared row by row; the SET that fires is still a sample, and does not repeat exactly. Measured on one frozen input, six scans at one engine SHA: 2-5 critique rows per scan, 8 distinct rows across the six, 3 of those 8 seen in only one scan. So a D19 row is evidence about the documentation, but a COUNT of D19 rows is not a quantity — never read a change in it as an improvement or a regression.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D21 Naming Consistency: Naming quality is an LLM judgement over a bounded sample — it assesses clarity/consistency of the names it sees, not domain-correctness, and is advisory.
  • D22 Internal API Consistency: API-surface coherence is an LLM judgement over a sample of the public surface — consistency of intent across the whole API is approximated, not exhaustively verified.
  • 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.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D31 IaC & Container Security: IaC scanning checks Dockerfiles/Terraform/Kubernetes against best-practice rules — it cannot see the live cloud account, runtime configuration, or drift between the committed config and what is actually deployed.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D40 Network Egress Confinement: Egress confinement is read from committed Kubernetes manifests — a policy applied out-of-band (cluster-default deny, a service mesh, or a cloud firewall/security group off-repo) is invisible, and a present NetworkPolicy is declared config, not proof the cluster admission-controller actually enforces it at runtime.
  • D41 Kernel & Syscall Confinement: Syscall/MAC confinement is read from committed manifests — a profile applied by a cluster-wide PodSecurity default or a mutating webhook off-repo isn't seen, and a declared seccomp/AppArmor profile is config presence, not proof the node's kernel actually loaded and enforced it.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a REDACTED (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • 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: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

The LLM boundary

LLM-set scores this run (5): D19, D21, D22, D26, M4 (model: Local LLM). For these, a model reads a bounded sample and sets the numeric score; each names its own sample and method on its card. They are sampled and advisory by design: they vary at the margins between runs and are never a deterministic measurement. Every other score in this report is tool-computed at confidence 1.0.

Dimensions

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

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

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

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

21 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was Config::load_from_ssconfig at 142. A further 3 method(s) were over the threshold but excluded as flat dispatchers (a long switch/match over independent cases: many branches, almost no nesting), the largest being ErrorKind::description at 23 — they are counted neither in the figure above nor in this dimension's score. 2 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold functions was excluded, so the exclusion is disclosed nowhere in the file itself: src/daemonize/daemonize/error.rs (ErrorKind::description at 23), src/logging/tracing.rs (shadowsocks_rust::logging::tracing::make_syslog_writer at 20). 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.

Config::load_from_ssconfig (cyclomatic 142) · ×3crates/shadowsocks-service/src/config.rs:1748
shadowsocks_rust::service::local::create (cyclomatic 82) · ×3src/service/local.rs:588
shadowsocks_service::server::run (cyclomatic 26) · ×2crates/shadowsocks-service/src/server/mod.rs:33
PingBalancerContext::check_once (cyclomatic 23) · ×2crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:386
Server::new (cyclomatic 65)crates/shadowsocks-service/src/local/mod.rs:92

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

What to do

  1. Resolve the 3 Config finding(s) in Cyclomatic Complexity — start with REDACTED (3). — One of this dimension's main actionable groups (3 warning-level).
  2. Resolve the 3 shadowsocks_rust finding(s) in Cyclomatic Complexity — start with local.rs, server.rs, manager.rs. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 2 shadowsocks_service finding(s) in Cyclomatic Complexity — start with mod.rs, server.rs. — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive Complexity4.0 / 10Weak✓ 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 4.0 / 10 · rule-coverage 100% · ceiling Prevented

50 method(s) exceeded the cognitive complexity threshold of 15; the worst was Config::load_from_ssconfig at 353.

shadowsocks_service::local::dns::server::should_forward_by_response (cognitive 49) · ×6crates/shadowsocks-service/src/local/dns/server.rs:640
shadowsocks_rust::service::local::create (cognitive 109) · ×4src/service/local.rs:588
UdpRedirSocket::bind (cognitive 19) · ×4crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:43
Config::load_from_ssconfig (cognitive 353) · ×3crates/shadowsocks-service/src/config.rs:1748
UdpAssociationContext::dispatch_packet (cognitive 32) · ×3crates/shadowsocks-service/src/local/net/udp/association.rs:377

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

What to do

  1. Resolve the 6 shadowsocks_service finding(s) in Cognitive Complexity — start with server.rs (2), mod.rs (2), openbsd.rs. — One of this dimension's main actionable groups (6 warning-level).
  2. Resolve the 4 shadowsocks_rust finding(s) in Cognitive Complexity — start with local.rs, server.rs, manager.rs. — One of this dimension's main actionable groups (4 warning-level).
  3. Resolve the 4 UdpRedirSocket finding(s) in Cognitive Complexity — start with freebsd.rs, openbsd.rs, linux.rs. — One of this dimension's main actionable groups (4 warning-level).
  4. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes9.4 / 10Stronggated by 22 serious findings✓ 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 9.4 / 10 · rule-coverage 100% · ceiling Prevented

22 god class(es) detected.

FileTooLong: src/config.rs · ×7crates/shadowsocks-service/src/config.rs
FunctionTooLong: shadowsocks_rust::service::local::define_command_line_options · ×7src/service/local.rs:86
MethodTooLong: Config.load_from_ssconfig · ×4crates/shadowsocks-service/src/config.rs:1748
TooManyFields: SSConfig · ×2crates/shadowsocks-service/src/config.rs:290
ClassTooLong: Configcrates/shadowsocks-service/src/config.rs:1511

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

What to do

  1. Resolve the 7 FileTooLong finding(s) in God Classes — start with REDACTED (2), local.rs, server.rs. — One of this dimension's main actionable groups (7 warning-level).
  2. Resolve the 7 FunctionTooLong finding(s) in God Classes — start with local.rs (2), server.rs (2), manager.rs (2). — One of this dimension's main actionable groups (7 warning-level).
  3. Resolve the 4 MethodTooLong finding(s) in God Classes — start with REDACTED (2), mod.rs, tcp.rs. — One of this dimension's main actionable groups (4 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication9.1 / 10Stronggated by 194 serious findings✓ Tool-verified

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

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

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

182 duplicated block group(s) detected. A further 12 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.

Duplicated block (8 lines × 2) · ×14crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:459
Duplicated block (9 lines × 2) · ×10crates/shadowsocks/src/net/sys/unix/mod.rs:136
Duplicated block (6 lines × 2) · ×10crates/shadowsocks/src/net/udp.rs:329
Duplicated block (10 lines × 2) · ×8crates/shadowsocks/src/relay/udprelay/crypto_io.rs:78
Duplicated block (14 lines × 2) · ×7crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:323

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

What to do

  1. Resolve the 14 Duplicated block (8 lines × 2) finding(s) in Code Duplication — start with proxy_socket.rs (2), ping_balancer.rs (2), mod.rs (2). — One of this dimension's main actionable groups (14 warning-level).
  2. Resolve the 10 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with mod.rs (3), ping_balancer.rs (3), aead.rs (2). — One of this dimension's main actionable groups (10 warning-level).
  3. Resolve the 10 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with udp.rs (2), REDACTED (2), freebsd.rs (2). — One of this dimension's main actionable groups (10 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling7.3 / 10Strong✓ 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 7.3 / 10 · rule-coverage 100% · ceiling Prevented

3 production modules (Cargo), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 1 module(s) off the main sequence.

Off the main sequence: shadowsocks

What to do

  1. Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
  2. Enforce Coupling in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.

Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.

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

743 test methods: 722 unit, 21 integration, 0 BDD, 0 e2e. The Rust suite contributes 743 `#[test]` function(s) across 24 file(s) declaring at least one; its unit/integration split is Cargo's own — 9 of those file(s) are integration-test targets under a crate's tests/ directory, and the rest are #[test] functions compiled into the crate they test.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D12 · Dependency Hygiene10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether dependencies are current, secure, and not bloated.

Method: Manifest scan via dotnet list package across all projects; worst-signal-per-package deduction (saturating for vulnerabilities, capped-linear for deprecation/outdated) per KLoC. Exhaustive, deterministic.

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

0 outdated, 0 yanked direct Cargo dependencies. Only DIRECT edges are graded: a transitive crate cannot be moved past what its parent's requirement admits, so reporting one would be advice its owner cannot take. A newer release is reported only where this repository's OWN requirement already admits it, so the remedy is `cargo update` and never a manifest edit — which means a release outside the declared range is deliberately NOT charged, because a written-down constraint is a decision rather than a defect. Note that a bare requirement is a CARET, and for a 0.x crate its ceiling is the minor. Whether any crate is UNMAINTAINED is not graded — crates.io publishes no maintenance status, and release age does not stand in for one. Known CVEs in this dependency graph are D30's question, read from Cargo.lock there.

✓ On the Gold path — maintain.

Detailed fixes: d12_recommendation.md.

D13 · Secret Scanning5.0 / 10Adequate✓ Tool-verified

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 5.0 / 10 · rule-coverage 100% · ceiling Prevented

1 secret(s) detected.

REDACTED

What to do

  1. Resolve the 1 Leaked secret finding(s) in Secret Scanning — start with REDACTED. — One of this dimension's main actionable groups (1 issue-level).
  2. Enforce Secret Scanning in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

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 448 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's Cargo.lock closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. This repository publishes itself under MIT, which is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.9 / 10Stronggated by 1 serious finding✓ 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 9.9 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: crates/shadowsocks-service/src/server/mod.rs (2×26=52)

Hotspot: crates/shadowsocks-service/src/server/mod.rscrates/shadowsocks-service/src/server/mod.rs:33

What to do

  1. Resolve the 1 Hotspot finding(s) in Churn × Complexity Hotspots — start with mod.rs. — One of this dimension's main actionable groups (1 warning-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 14 serious findings✓ Tool-verified

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

14 deducted task-comment markers across 95150 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.

FixmeComment · ×9crates/shadowsocks-service/src/acl/mod.rs:227
XxxComment · ×3crates/shadowsocks-service/src/local/context.rs:73
TodoComment · ×2crates/shadowsocks-service/src/manager/server.rs:492

What to do

  1. Resolve the 9 FixmeComment finding(s) in Explicit Debt — start with mod.rs (2), http_service.rs, association.rs. — One of this dimension's main actionable groups (9 warning-level).
  2. Resolve the 3 XxxComment finding(s) in Explicit Debt — start with mod.rs (2), context.rs. — One of this dimension's main actionable groups (3 warning-level).
  3. Resolve the 2 TodoComment finding(s) in Explicit Debt — start with server.rs, mod.rs. — One of this dimension's main actionable groups (2 warning-level).
  4. Enforce Explicit Debt in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D19 · Documentation QualityAdequate◐ Sampled · advisory

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

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

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

The repository's root README (shadowsocks) and the selinux/README.md are both well written for their respective directories: the root one describes shadowsocks-rust as a Rust port of shadowsocks with release channels, crates.io, Homebrew, snap, Docker, Kubernetes, and a detailed install-and-run guide; the selinux/README is an internal SELinux policy guide that compiles, installs, applies file contexts, verifies the policy, and troubleshoots. The two README.md files for crates/shadowsocks-service and crates/shadowsocks are thin per-directory summaries of their respective projects (a shadowsocks service port) with no install/usage guidance.

What to do

  1. Improve Documentation Quality — currently 6.0/10. — The repository's root README (shadowsocks) and the selinux/README.md are both well written for their respective directories: the root one describes shadowsocks-rust as a Rust port of shadowsocks with release channels, crates.io, Homebrew, snap, Docker, Kubernetes, and a detailed install-and-run guide; the selinux/README is an internal SELinux policy guide that compiles, installs, applies file contexts, verifies the policy, and troubleshoots. The two README.md files for crates/shadowsocks-service and crates/shadowsocks are thin per-directory summaries of their respective projects (a shadowsocks service port) with no install/usage guidance.

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: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

  1. Resolve the 1 No ADRs found finding(s) in ADR Quality. — 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 ConsistencyExemplary◐ Sampled · advisory

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

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

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

0 naming inconsistencies across 0 sampled symbols.

✓ On the Gold path — maintain.

Detailed fixes: d21_recommendation.md.

D22 · Internal API ConsistencyWeak◐ Sampled · advisory

What it measures: Whether the internal API surface is consistent and coherent.

Method: Judged by language model at low temperature over a sample of the public API surface (IsPackable or .Contracts types). Sampled, advisory; confidence discounted by model uncertainty.

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

6 API inconsistencies across a 400-member sample of 241 exposed types.

Duplicate intent with divergent naming and scope. `ServerType` and `ConfigType` appear to represent the same conceptual enum (Local/Server/Manager/etc.), but are split across two modules with different method signatures. `ServerType` only has `is_local`/`is_server`, while `ConfigType` has `is_manager`/`is_online_config` as well. This forces users to import two different types for similar checks.
Redundant accessors for the same underlying data. `key()` and `password()` likely return the same secret material (one as bytes, one as string). `export_password()` is a third variant. This creates confusion about which method to use for serialization vs internal use.
Inconsistent naming for cloning/copying operations. `clone_identity_hash` and `clone_identity_keys` use the verb `clone` for returning owned data, whereas Rust idioms typically use `to_owned()` or just rely on the type system. More importantly, `ServerUser` has `clone_identity_hash` but `ServerConfig` has `clone_identity_keys`. The naming is inconsistent between the two types (`hash` vs `keys`).
Confusingly similar method names with different signatures. `send_to` and `send_to_manager` both send data, but take different target types (`ManagerSocketAddr` vs `ManagerAddr`) and one takes a `Context`. This suggests `send_to_manager` is a higher-level wrapper, but the naming is not distinct enough to prevent confusion.
Ambiguous constructor variants. `new` takes a generic key `K`, while `with_encoded_key` takes a `str`. It is unclear if `new` expects raw bytes or encoded strings, leading to potential misuse. The existence of `with_encoded_key` suggests `new` might not handle string encoding, but the naming doesn't make this distinction clear.

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

What to do

  1. Resolve the 1 Duplicate intent with divergent naming and scope. `ServerType` and… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Redundant accessors for the same underlying data. `key()` and… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 Inconsistent naming for cloning/copying operations.… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).

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

D26 · Project Cohesion0.0 / 10Critical✓ 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, LLM-independent.

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

2 of 3 build units (Cargo) flagged as possibly oversized/incoherent.

Split crates/shadowsocks
Split crates/shadowsocks-service

What to do

  1. Resolve the 1 Split crates/shadowsocks finding(s) in Project Cohesion. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 Split crates/shadowsocks-service finding(s) in Project Cohesion. — 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.

D28 · Secrets (history)10.0 / 10Exemplary○ Nothing flagged

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

Method: Secret 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 10.0 / 10 · rule-coverage 100% · ceiling Documented

gitleaks scanned the full history AND the current working tree and found no secrets.

✓ On the Gold path — maintain.

Detailed fixes: d28_recommendation.md.

D29 · Static Analysis (SAST)1.2 / 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 1.2 / 10 · rule-coverage 100% · ceiling Documented

58 finding(s): 0 critical, 54 high, 3 medium, 1 low. 43 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 7 file(s) — `crates/shadowsocks-service/src/local/tun/tcp.rs` (line 121, lines 148–151, line 151), `docker/docker-entrypoint.sh` (line 14, line 16), `k8s/chart/templates/config.yaml`, `REDACTED`, `k8s/chart/templates/hpa.yaml`, … (+2 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them. Separately, one or more rules could not re-parse an embedded snippet in 2 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 5 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (3), REDACTED, REDACTED. — One of this dimension's main actionable groups (5 issue-level).
  2. Resolve the 2 REDACTED finding(s) in Static Analysis (SAST) — start with REDACTED (2). — One of this dimension's main actionable groups (2 issue-level).
  3. No action in Static Analysis (SAST) — all 43 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 (43 issue-level, 0 of them charged here).

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

D30 · Dependency Vulnerabilities10.0 / 10Exemplary○ Nothing flagged

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, 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.

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

No known-vulnerable dependencies in any ecosystem this repository declares.

✓ On the Gold path — maintain.

Detailed fixes: d30_recommendation.md.

D31 · IaC & Container Security2.5 / 10Critical✓ Tool-verified

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

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

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

71 finding(s): 0 critical, 5 high, 56 medium, 10 low.

REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 56 Medium IaC finding(s) in IaC & Container Security — start with REDACTED (44), REDACTED (5), REDACTED (5). — One of this dimension's main actionable groups (56 warning-level).
  2. Resolve the 5 High IaC finding(s) in IaC & Container Security — start with REDACTED (2), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (5 issue-level).
  3. Resolve the 10 Low IaC finding(s) in IaC & Container Security — start with REDACTED (7), REDACTED (2), REDACTED. — One of this dimension's main actionable groups (10 recommendation-level).

Detailed fixes: d31_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

1 of 123 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is crates/shadowsocks-service/src/local/http/tokio_rt.rs. Counted over 123 of the 201 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned files with no living knowledge

✓ On the Gold path — maintain.

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

D35 · Change Coupling9.7 / 10Stronggated by 4 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 9.7 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: proxy_listener.rs↔client.rs 80%; bsd.rs↔freebsd.rs 73%; proxy_listener.rs↔proxy_socket.rs 60%

Change coupling: proxy_listener.rs ↔ client.rs · ×4crates/shadowsocks/src/relay/tcprelay/proxy_listener.rs

What to do

  1. Resolve the 4 Change coupling finding(s) in Change Coupling — start with proxy_listener.rs (2), bsd.rs, client.rs. — One of this dimension's main actionable groups (4 warning-level).

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

D36 · Supply-chain Provenance & Signing0.0 / 10Critical✓ Tool-verified

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

  1. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
  3. Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).

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

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

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

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

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

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

No network policy

What to do

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

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

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

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

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

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

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

No seccomp profile
No AppArmor/SELinux confinement

What to do

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

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

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. Scored 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. SCORED, not informational.

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 1 platform declaration(s) and 0 dependency declaration(s). This dimension reads what the repository says about ITSELF — a pinned target framework, a version file, a capped requires-python, a Rust toolchain pin, a framework major a constraint cannot move off. A FLOOR is deliberately never charged: `requires-python = ">=3.8"` states what the package SUPPORTS, not what it runs on, and a well-maintained library declares exactly that while running its own CI on a current release. The end-of-life facts are FROZEN and dated, so this dimension needs no network and answers identically inside a closed scan fence; as the table ages it loses recall and never precision, because a statement about support that ended in the past cannot become false. The OS layer of a container image is D31's question and the toolchain a CI workflow installs is D29's; this row is neither.

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition9.3 / 10Exemplary✓ 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.

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
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.

AX4 · Dependency direction10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.

Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.

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.

M1 · Documentation (README)8.7 / 10Strong✓ Tool-verified

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

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

What to do

  • Add a 'Testing' section to the root README — how to run the test suite.
  • Add an 'Architecture' / 'How it works' section to the root README — the high-level shape.
M2 · Architecture documentation2.0 / 10Critical✓ 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 significant decisions one document per decision — dated, stating the context, the decision and its consequences — and keep them together wherever your design docs already live (a conventional `docs/adr/` tree, with each file named `NNNN-title` in whatever markup those docs already use, is the most discoverable form).
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

P2 · Observability7.0 / 10Strong✓ 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.

What to do

  • Consider OpenTelemetry tracing/metrics (opentelemetry with tracing-opentelemetry) and a health-check endpoint (a /health route on your axum/actix router) for operability.
P3 · Security & performance tooling7.0 / 10Strong✓ Tool-verified

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

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

What to do

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

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

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

  • Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.

What to do

  • Add an approval/environment gate (required reviewers / protection rules) before production promotion.
P6 · Release Hygiene10.0 / 10Exemplary✓ 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.

PF3 · Async & latency hygiene10.0 / 10Exemplary✓ 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 the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin) or inside a Java method returning a Reactor Mono/Flux — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

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 Health83%StrongSolid.
Architecture84%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity70%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness79%StrongSolid.
Security62%Adequate — gated by D29, D31, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance100%ExemplaryStrongest area.
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.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 75 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — 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
  • AX2 Stateful singletons — 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
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AX8 Test isolation — no test/production split to check
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • AXR1 Runtime accessibility — docker build failed (exit 1) — DEPRECATED: The legacy builder is deprecated and will be removed in a future release. Install the buildx component to build images with BuildKit: https://docs.docker.com/go/bui…; runtime evidence skipped This is a statement about this run, not a statement about your application: nothing here says the surface is inaccessible, only that it was never rendered.
  • 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.
  • D10 Test Quality — ~1073 lines of test source are present (.rs, .rb) but no test cases reached the test census for this repository — no test root we could resolve declared them, or the files we read declare no cases in a test framework we recognise — so skipped/assertion-free tests couldn't be counted. Not scored — this is a gap in the analyzer, not a finding about this repository.
  • D11 Test Reliability — Test reliability not included — the .rs suite was found but not re-run
  • 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.
  • 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. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — No inline comments to assess — comment value is not applicable here.
  • D25 ADR Conformance — no ADRs to check
  • D27 Navigability — symbol resolution incomplete — too few calls resolved to assess navigability
  • D32 Data Compliance (PII/GDPR) — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that.
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D42 Runtime Threat Enforcement — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.
  • D6 Cohesion (LCOM4) — D6 reads a CS/VB/GO/SCALA/SWIFT/DART/JAVA/PY/KT/TS/TSX/MTS/CTS/JS/JSX/MJS/CJS/PHP class graph only — this repository's production source is .rb, .rs, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not included — suite not readable by the collector
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (47 value object(s))
  • ED2 Event/command shape — not scored — deciding whether a command has more than one competing handler requires resolving the call graph, and a call made through an inferred or generic receiver has no resolvable owner in the source. Reported as guidance rather than measured
  • ED5 Idempotency — This check finds retry-prone mutations (command handlers and message/event consumers) by walking the repository's declared types, and none was loaded here, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C# syntax, and none was loaded for this repository. 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
  • P10 Library API & versioning — 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'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python, Ruby, Rust source, so there is no service whose uptime a failing dependency could take down
  • 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 — no coverage report found on disk — produce a coverage report in a standard format (lcov — `cargo install cargo-llvm-cov`, then `cargo llvm-cov --lcov --output-path lcov.info`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • PF1 Benchmark discipline — 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
  • PF2 Allocation hygiene — 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
  • 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.
  • X1 Async correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X10 Duplicated predicate — 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
  • X12 Unreachable branch — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X13 Undrained process stream — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X14 Bypassable address classification — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X15 Unvalidated length from an untrusted reader — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X16 Unfloored truncation loop — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X17 Uncapped recursion over a caller-supplied document — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X18 Disposal-pattern correctness — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X19 Unrestored process-global state — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X21 Side-effecting pattern guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X22 Contradicted release guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X23 Unguarded diagnostic materialisation — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X24 Document value interpolated into markup unescaped — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X25 Inert configuration knob — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X26 Unsynchronised callback handoff — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X27 Collection changed while being enumerated — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X28 Index access outside its own emptiness guard — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X29 Per-element action decided by a fixed element — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X3 Exception handling — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X30 Support guard that admits what it rejects — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check reads C# syntax; no C# was loaded for this repository, so it has nothing to report. That is a limit of the analyzer, not a finding about your code.
  • X4 Structured logging — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — 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
  • X7 Silent fallback defaults — 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
  • X9 Subsumed condition operand — 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 — 60 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
  • + 18 more in this group — see findings.md.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D31 · IaC & Container Security · High IaC · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D13 · Secret Scanning · Leaked secret · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
Serious — 375 finding(s)
D31 · IaC & Container Security · Medium IaC · ×56
  • 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
  • + 31 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×14
  • Duplicated block (8 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:459 — crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:459-466 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:534-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:193 — crates/shadowsocks/src/relay/tcprelay/aead.rs:193-200 | crates/shadowsocks/src/relay/tcprelay/stream.rs:139-146 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/stream.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 42 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 (8 lines × 2) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:241 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:241-248 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:392-399 — both copies are in the same file, so extract the 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) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:448 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:448-455 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:493-500 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/dns/server.rs:215 — crates/shadowsocks-service/src/local/dns/server.rs:215-222 | crates/shadowsocks-service/src/local/http/server.rs:64-71 — 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) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:398 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:398-405 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:524-531 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:408 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:408-415 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:535-542 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/mod.rs:125 — crates/shadowsocks-service/src/local/mod.rs:125-132 | crates/shadowsocks-service/src/manager/mod.rs:36-43 — `crates/shadowsocks-service/src/local/mod.rs` and `crates/shadowsocks-service/src/manager/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (8 lines × 2) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:80 — crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:80-87 | crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:99-106 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:123 — crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:123-130 | crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:144-151 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/redir/tcprelay/mod.rs:66 — crates/shadowsocks-service/src/local/redir/tcprelay/mod.rs:66-73 | crates/shadowsocks-service/src/local/tun/tcp.rs:606-613 — 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) crates/shadowsocks-service/src/local/socks/server/socks4/tcprelay.rs:145 — crates/shadowsocks-service/src/local/socks/server/socks4/tcprelay.rs:145-152 | crates/shadowsocks-service/src/local/socks/server/socks5/tcprelay.rs:280-287 — 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) src/service/local.rs:653 — src/service/local.rs:653-660 | src/service/server.rs:356-363 — before extracting anything, compare `src/service/local.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 342 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 (8 lines × 2) crates/shadowsocks-service/src/local/net/udp/association.rs:329 — crates/shadowsocks-service/src/local/net/udp/association.rs:329-336 | crates/shadowsocks-service/src/server/udprelay.rs:463-470 — 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.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×10
  • Duplicated block (9 lines × 2) crates/shadowsocks/src/net/sys/unix/mod.rs:136 — crates/shadowsocks/src/net/sys/unix/mod.rs:136-144 | crates/shadowsocks/src/net/sys/windows/mod.rs:557-565 — 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) crates/shadowsocks/src/relay/socks5.rs:611 — crates/shadowsocks/src/relay/socks5.rs:611-619 | crates/shadowsocks/src/relay/socks5.rs:678-686 — both copies are in the same file, so extract the 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) crates/shadowsocks/src/relay/udprelay/aead.rs:125 — crates/shadowsocks/src/relay/udprelay/aead.rs:125-133 | crates/shadowsocks/src/relay/udprelay/stream.rs:101-109 — 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) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:440 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:440-448 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:551-559 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:473 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:473-481 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:579-587 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5234 — crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5234-5242 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5339-5347 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/manager/mod.rs:49 — crates/shadowsocks-service/src/manager/mod.rs:49-57 | crates/shadowsocks-service/src/server/mod.rs:83-91 — `crates/shadowsocks-service/src/manager/mod.rs` and `crates/shadowsocks-service/src/server/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 31 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (9 lines × 2) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:454 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:454-462 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:487-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.
  • Duplicated block (9 lines × 2) crates/shadowsocks-service/src/local/tun/mod.rs:230 — crates/shadowsocks-service/src/local/tun/mod.rs:230-238 | crates/shadowsocks-service/src/local/tun/mod.rs:257-265 — both copies are in the same file, so extract the 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) crates/shadowsocks/src/relay/udprelay/aead.rs:61 — crates/shadowsocks/src/relay/udprelay/aead.rs:61-69 | crates/shadowsocks/src/relay/udprelay/stream.rs:55-63 — 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 (6 lines × 2) · ×10
  • Duplicated block (6 lines × 2) crates/shadowsocks/src/net/udp.rs:329 — crates/shadowsocks/src/net/udp.rs:329-334 | crates/shadowsocks/src/net/udp.rs:374-379 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:381 — crates/shadowsocks/src/relay/tcprelay/aead.rs:381-386 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:709-714 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (6 lines × 2) crates/shadowsocks-service/src/config.rs:3083 — crates/shadowsocks-service/src/config.rs:3083-3088 | crates/shadowsocks-service/src/config.rs:3119-3124 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/net/tcp/auto_proxy_stream.rs:181 — crates/shadowsocks-service/src/local/net/tcp/auto_proxy_stream.rs:181-186 | crates/shadowsocks-service/src/local/net/tcp/auto_proxy_stream.rs:221-226 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:269 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:269-274 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:275-280 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (6 lines × 2) crates/shadowsocks-service/src/local/tun/udp.rs:134 — crates/shadowsocks-service/src/local/tun/udp.rs:134-139 | crates/shadowsocks-service/src/local/tun/udp.rs:144-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.
  • Duplicated block (6 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:105 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:105-110 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:162-167 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:74 — crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:74-79 | crates/shadowsocks/src/relay/udprelay/aead_2022.rs:150-155 — 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 (6 lines × 2) crates/shadowsocks-service/src/local/http/config.rs:155 — crates/shadowsocks-service/src/local/http/config.rs:155-160 | REDACTED:124-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) crates/shadowsocks-service/src/local/socks/socks4.rs:226 — crates/shadowsocks-service/src/local/socks/socks4.rs:226-231 | crates/shadowsocks-service/src/local/socks/socks4.rs:235-240 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D17 · Explicit Debt · FixmeComment · ×9
  • FixmeComment crates/shadowsocks-service/src/acl/mod.rs:227 — // FIXME: If this line is not a valid regex, how can we know without actually compile it? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks-service/src/local/http/http_service.rs:120 — // FIXME: What STATUS should I return for connection error? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks-service/src/local/net/udp/association.rs:629 — // FIXME: client_packet_id overflowed. What's the proper way to handle this? — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks-service/src/local/socks/client/socks5/udp_client.rs:57 — // FIXME: domain-name relay address would require resolving via — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks-service/src/local/tun/tcp.rs:521 — // FIXME: It should follow system's setting. 7200 is Linux's default. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks-service/src/server/udprelay.rs:771 — // FIXME: server_packet_id overflowed. There is no way to recover from this error. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks/src/net/sys/unix/mod.rs:81 — // FIXME: Linux Kernel doesn't support setting TCP Keep Alive. (MPTCP) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment crates/shadowsocks/src/plugin/obfs_proxy.rs:35 — // FIXME: Not compatible in Windows — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • FixmeComment src/monitor/other.rs:8 — // FIXME: What can I do ... — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×8
  • Duplicated block (10 lines × 2) crates/shadowsocks/src/relay/udprelay/crypto_io.rs:78 — crates/shadowsocks/src/relay/udprelay/crypto_io.rs:78-87 | crates/shadowsocks/src/relay/udprelay/crypto_io.rs:116-125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:294 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:294-303 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:346-355 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/http/config.rs:66 — crates/shadowsocks-service/src/local/http/config.rs:66-75 | REDACTED:58-67 — 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 (10 lines × 2) crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5220 — crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5220-5229 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:5333-5342 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/net/http_stream.rs:67 — crates/shadowsocks-service/src/net/http_stream.rs:67-76 | crates/shadowsocks-service/src/net/outbound/tls.rs:108-117 — 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 (10 lines × 2) src/service/local.rs:87 — src/service/local.rs:87-96 | src/service/server.rs:34-44 — before extracting anything, compare `src/service/local.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 342 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 (10 lines × 2) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:459 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:459-468 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:565-574 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:560 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:560-569 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:588-597 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · FileTooLong · ×7
  • FileTooLong: src/config.rs crates/shadowsocks-service/src/config.rs — FileTooLong — 2074 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 1574 over it, 4.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: src/config.rs crates/shadowsocks/src/config.rs — FileTooLong — 776 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 276 over it, 1.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: service/local.rs src/service/local.rs — FileTooLong — 775 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 275 over it, 1.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: dns/server.rs crates/shadowsocks-service/src/local/dns/server.rs — FileTooLong — 653 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 153 over it, 1.31× 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: loadbalancing/ping_balancer.rs crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs — FileTooLong — 651 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 151 over it, 1.30× 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: relay/socks5.rs crates/shadowsocks/src/relay/socks5.rs — FileTooLong — 566 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 66 over it, 1.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: server/udprelay.rs crates/shadowsocks-service/src/server/udprelay.rs — FileTooLong — 517 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted). The bar is 500 significant lines; this is 17 over it, 1.03× 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.
D3 · God Classes · FunctionTooLong · ×7
  • FunctionTooLong: shadowsocks_rust::service::local::define_command_line_options src/service/local.rs:86 — FunctionTooLong — shadowsocks_rust::service::local::define_command_line_options runs 392 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 292 over it, 3.92× 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: shadowsocks_rust::service::local::create src/service/local.rs:588 — FunctionTooLong — shadowsocks_rust::service::local::create runs 273 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: shadowsocks_rust::service::server::define_command_line_options src/service/server.rs:33 — FunctionTooLong — shadowsocks_rust::service::server::define_command_line_options runs 207 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 107 over it, 2.07× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: shadowsocks_rust::service::manager::define_command_line_options src/service/manager.rs:35 — FunctionTooLong — shadowsocks_rust::service::manager::define_command_line_options runs 189 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 89 over it, 1.89× 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: shadowsocks_rust::service::server::create src/service/server.rs:292 — FunctionTooLong — shadowsocks_rust::service::server::create runs 166 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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: shadowsocks_rust::service::manager::create src/service/manager.rs:273 — FunctionTooLong — shadowsocks_rust::service::manager::create runs 150 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 50 over it, 1.50× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: shadowsocks_service::server::run crates/shadowsocks-service/src/server/mod.rs:33 — FunctionTooLong — shadowsocks_service::server::run runs 115 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:323 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:323-336 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:485-498 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/linux/mod.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 263 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:219 — crates/shadowsocks/src/relay/tcprelay/aead.rs:219-232 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:418-431 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (14 lines × 2) crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:218 — crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:218-231 | crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:246-259 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) crates/shadowsocks/src/relay/udprelay/aead_2022.rs:581 — crates/shadowsocks/src/relay/udprelay/aead_2022.rs:581-594 | crates/shadowsocks/src/relay/udprelay/aead_2022.rs:687-700 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:293 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:293-306 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:299-312 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (14 lines × 2) crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:70 — crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:70-83 | crates/shadowsocks-service/src/local/tunnel/udprelay.rs:60-73 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs` and `crates/shadowsocks-service/src/local/tunnel/udprelay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (14 lines × 2) crates/shadowsocks/src/dns_resolver/hickory_dns_resolver.rs:149 — crates/shadowsocks/src/dns_resolver/hickory_dns_resolver.rs:149-162 | crates/shadowsocks/src/dns_resolver/hickory_dns_resolver.rs:174-187 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D2 · Cognitive Complexity · shadowsocks_service · ×6
  • shadowsocks_service::local::dns::server::should_forward_by_response (cognitive 49) crates/shadowsocks-service/src/local/dns/server.rs:640 — shadowsocks_service::local::dns::server::should_forward_by_response has cognitive complexity 49 (threshold 15). Drivers by points: if/else 14 (39 pts), loops 2 (6 pts), match/switch 1 (3 pts), boolean chains 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.
  • shadowsocks_service::server::run (cognitive 43) crates/shadowsocks-service/src/server/mod.rs:33 — shadowsocks_service::server::run has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (37 pts), loops 3, match/switch 1 (2 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • shadowsocks_service::local::dns::server::should_forward_by_query (cognitive 26) crates/shadowsocks-service/src/local/dns/server.rs:588 — shadowsocks_service::local::dns::server::should_forward_by_query has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (24 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.
  • shadowsocks_service::dns::build_dns_resolver (cognitive 22) crates/shadowsocks-service/src/dns/mod.rs:11 — shadowsocks_service::dns::build_dns_resolver has cognitive complexity 22 (threshold 15). Drivers by points: if/else 4 (11 pts), match/switch 4 (10 pts), boolean chains 1 (nesting depth added 13). 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.
  • shadowsocks_service::local::redir::udprelay::sys::unix::openbsd::get_destination_addr (cognitive 19) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:239 — shadowsocks_service::local::redir::udprelay::sys::unix::openbsd::get_destination_addr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • shadowsocks_service::local::http::utils::get_keep_alive_val (cognitive 16) crates/shadowsocks-service/src/local/http/utils.rs:72 — shadowsocks_service::local::http::utils::get_keep_alive_val has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (11 pts), loops 2 (5 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.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×6
  • Duplicated block (13 lines × 2) crates/shadowsocks/src/net/udp.rs:115 — crates/shadowsocks/src/net/udp.rs:115-127 | crates/shadowsocks/src/net/udp.rs:138-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.
  • Duplicated block (13 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:244 — crates/shadowsocks/src/relay/tcprelay/aead.rs:244-256 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:437-449 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (13 lines × 2) crates/shadowsocks-service/src/config.rs:1818 — crates/shadowsocks-service/src/config.rs:1818-1830 | crates/shadowsocks-service/src/config.rs:1858-1870 — both copies are in the same file, so extract the 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 (13 lines × 2) crates/shadowsocks-service/src/local/dns/server.rs:147 — crates/shadowsocks-service/src/local/dns/server.rs:147-159 | crates/shadowsocks-service/src/local/tunnel/server.rs:101-113 — 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 (13 lines × 2) crates/shadowsocks-service/src/local/loadbalancing/server_data.rs:99 — crates/shadowsocks-service/src/local/loadbalancing/server_data.rs:99-111 | crates/shadowsocks-service/src/server/mod.rs:124-136 — 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 (13 lines × 2) crates/shadowsocks-service/src/net/http_stream.rs:87 — crates/shadowsocks-service/src/net/http_stream.rs:87-99 | crates/shadowsocks-service/src/net/outbound/tls.rs:128-140 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×6
  • Duplicated block (7 lines × 2) crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:165 — crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:165-171 | crates/shadowsocks/src/relay/tcprelay/crypto_io.rs:178-184 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/config.rs:3091 — crates/shadowsocks-service/src/config.rs:3091-3097 | crates/shadowsocks-service/src/config.rs:3127-3133 — both copies are in the same file, so extract the 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) crates/shadowsocks-service/src/local/context.rs:121 — crates/shadowsocks-service/src/local/context.rs:121-127 | crates/shadowsocks-service/src/server/context.rs:75-81 — 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) crates/shadowsocks-service/src/local/net/udp/association.rs:268 — crates/shadowsocks-service/src/local/net/udp/association.rs:268-274 | crates/shadowsocks-service/src/server/udprelay.rs:413-419 — 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) crates/shadowsocks-service/src/local/dns/server.rs:441 — crates/shadowsocks-service/src/local/dns/server.rs:441-447 | crates/shadowsocks-service/src/local/fake_dns/udp_server.rs:51-57 — 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) crates/shadowsocks-service/src/config.rs:2141 — crates/shadowsocks-service/src/config.rs:2141-2147 | crates/shadowsocks-service/src/config.rs:2250-2256 — both copies are in the same file, so extract the 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 (5 lines × 2) · ×6
  • Duplicated block (5 lines × 2) crates/shadowsocks-service/src/config.rs:1947 — crates/shadowsocks-service/src/config.rs:1947-1951 | crates/shadowsocks-service/src/config.rs:1958-1962 — both copies are in the same file, so extract the 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 (5 lines × 2) crates/shadowsocks-service/src/config.rs:2005 — crates/shadowsocks-service/src/config.rs:2005-2009 | crates/shadowsocks-service/src/config.rs:2016-2021 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/shadowsocks-service/src/local/mod.rs:141 — crates/shadowsocks-service/src/local/mod.rs:141-145 | crates/shadowsocks-service/src/local/mod.rs:155-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (5 lines × 2) crates/shadowsocks-service/src/manager/mod.rs:53 — crates/shadowsocks-service/src/manager/mod.rs:53-57 | crates/shadowsocks-service/src/manager/mod.rs:66-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.
  • Duplicated block (5 lines × 2) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:72 — crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:72-76 | crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:115-119 — both copies are in the same file, so extract the 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 (5 lines × 2) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:91 — crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:91-95 | crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:136-140 — both copies are in the same file, so extract the 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 (6 lines × 4) · ×6
  • Duplicated block (6 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:114 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:114-119 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:171-176 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:140-145 | crates/shadowsocks/src/net/sys/windows/mod.rs:122-127 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:123 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:123-128 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:180-185 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:149-154 | crates/shadowsocks/src/net/sys/windows/mod.rs:131-136 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:130 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:130-135 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:187-192 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:156-161 | crates/shadowsocks/src/net/sys/windows/mod.rs:138-143 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:137 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:137-142 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:194-199 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:163-168 | crates/shadowsocks/src/net/sys/windows/mod.rs:145-150 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:173 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:173-178 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:229-234 | crates/shadowsocks/src/net/sys/unix/others.rs:122-127 | crates/shadowsocks/src/net/sys/windows/mod.rs:185-190 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 4) crates/shadowsocks-service/src/local/socks/socks4.rs:127 — crates/shadowsocks-service/src/local/socks/socks4.rs:127-132 | crates/shadowsocks-service/src/local/socks/socks4.rs:137-142 | crates/shadowsocks/src/relay/socks5.rs:373-378 | crates/shadowsocks/src/relay/socks5.rs:383-388 — 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.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×5
  • Duplicated block (16 lines × 2) crates/shadowsocks/src/manager/protocol.rs:204 — crates/shadowsocks/src/manager/protocol.rs:204-219 | crates/shadowsocks/src/manager/protocol.rs:238-253 — both copies are in the same file, so extract the 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 (16 lines × 2) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:854 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:854-869 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:893-908 — both copies are in the same file, so extract the 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 (16 lines × 2) crates/shadowsocks-service/src/local/socks/server/server.rs:64 — crates/shadowsocks-service/src/local/socks/server/server.rs:64-79 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:51-66 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/server.rs` and `crates/shadowsocks-service/src/local/tunnel/tcprelay.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) src/service/manager.rs:344 — src/service/manager.rs:344-359 | src/service/server.rs:439-454 — before extracting anything, compare `src/service/manager.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 327 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 (16 lines × 2) src/service/manager.rs:495 — src/service/manager.rs:495-510 | src/service/server.rs:537-552 — before extracting anything, compare `src/service/manager.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 327 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 (9 lines × 3) · ×5
  • Duplicated block (9 lines × 3) crates/shadowsocks-service/src/local/dns/server.rs:212 — crates/shadowsocks-service/src/local/dns/server.rs:212-220 | crates/shadowsocks-service/src/local/socks/server/server.rs:62-70 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:49-57 — before extracting anything, compare `crates/shadowsocks-service/src/local/dns/server.rs` and `crates/shadowsocks-service/src/local/socks/server/server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (9 lines × 3) crates/shadowsocks-service/src/local/http/http_client.rs:347 — crates/shadowsocks-service/src/local/http/http_client.rs:347-355 | crates/shadowsocks-service/src/local/http/http_client.rs:379-387 | crates/shadowsocks-service/src/local/http/http_client.rs:398-406 — 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 (9 lines × 3) crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2918 — crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2918-2926 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:3199-3207 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:16436-16444 — 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 (9 lines × 3) src/service/local.rs:883 — src/service/local.rs:883-891 | src/service/manager.rs:355-363 | src/service/server.rs:450-458 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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) src/service/local.rs:1058 — src/service/local.rs:1058-1066 | src/service/manager.rs:533-541 | src/service/server.rs:575-583 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (8 lines × 3) · ×5
  • Duplicated block (8 lines × 3) crates/shadowsocks/src/config.rs:170 — crates/shadowsocks/src/config.rs:170-177 | crates/shadowsocks/src/config.rs:1158-1165 | crates/shadowsocks/src/config.rs:1339-1346 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (8 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs:274 — crates/shadowsocks/src/relay/tcprelay/aead.rs:274-281 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:461-468 | crates/shadowsocks/src/relay/tcprelay/stream.rs:164-171 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (8 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs:405 — crates/shadowsocks/src/relay/tcprelay/aead.rs:405-412 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:733-740 | crates/shadowsocks/src/relay/tcprelay/stream.rs:251-258 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (8 lines × 3) crates/shadowsocks-service/src/local/http/server.rs:71 — crates/shadowsocks-service/src/local/http/server.rs:71-78 | crates/shadowsocks-service/src/local/socks/server/server.rs:72-79 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:59-66 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/server.rs` and `crates/shadowsocks-service/src/local/tunnel/tcprelay.rs` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 3) crates/shadowsocks-service/src/local/mod.rs:149 — crates/shadowsocks-service/src/local/mod.rs:149-156 | crates/shadowsocks-service/src/manager/mod.rs:60-67 | crates/shadowsocks-service/src/server/mod.rs:93-100 — `crates/shadowsocks-service/src/local/mod.rs` and `crates/shadowsocks-service/src/manager/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D2 · Cognitive Complexity · shadowsocks_rust · ×4
  • shadowsocks_rust::service::local::create (cognitive 109) src/service/local.rs:588 — shadowsocks_rust::service::local::create has cognitive complexity 109 (threshold 15). Drivers by points: if/else 58 (79 pts), match/switch 14 (25 pts), boolean chains 4, loops 1 (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.
  • shadowsocks_rust::service::server::create (cognitive 63) src/service/server.rs:292 — shadowsocks_rust::service::server::create has cognitive complexity 63 (threshold 15). Drivers by points: if/else 34 (42 pts), match/switch 11 (18 pts), loops 1 (2 pts), boolean chains 1 (nesting depth added 16). 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.
  • shadowsocks_rust::service::manager::create (cognitive 50) src/service/manager.rs:273 — shadowsocks_rust::service::manager::create has cognitive complexity 50 (threshold 15). Drivers by points: if/else 34 (37 pts), match/switch 8 (10 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.
  • shadowsocks_rust::config::get_default_config_path (cognitive 21) src/config.rs:15 — shadowsocks_rust::config::get_default_config_path has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UdpRedirSocket · ×4
  • UdpRedirSocket::bind (cognitive 19) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:43 — UdpRedirSocket::bind has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 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.
  • UdpRedirSocket::bind (cognitive 19) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:45 — UdpRedirSocket::bind has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (17 pts), match/switch 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.
  • UdpRedirSocket::bind (cognitive 17) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:61 — UdpRedirSocket::bind has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (2 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.
  • UdpRedirSocket::bind (cognitive 17) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:42 — UdpRedirSocket::bind has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 1 (2 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.
D3 · God Classes · MethodTooLong · ×4
  • MethodTooLong: Config.load_from_ssconfig crates/shadowsocks-service/src/config.rs:1748 — MethodTooLong — load_from_ssconfig runs 547 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 447 over it, 5.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: Config.fmt crates/shadowsocks-service/src/config.rs:3001 — MethodTooLong — fmt runs 301 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 201 over it, 3.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.
  • MethodTooLong: Server.new crates/shadowsocks-service/src/local/mod.rs:92 — MethodTooLong — new runs 299 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) in one body. The bar is 100 significant lines; this is 199 over it, 2.99× 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: TcpTun.new crates/shadowsocks-service/src/local/tun/tcp.rs:259 — MethodTooLong — new runs 154 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted) 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.
D35 · Change Coupling · Change coupling · ×4
  • Change coupling: proxy_listener.rs ↔ client.rs crates/shadowsocks/src/relay/tcprelay/proxy_listener.rs — `crates/shadowsocks/src/relay/tcprelay/proxy_listener.rs` and `crates/shadowsocks/src/relay/tcprelay/proxy_stream/client.rs` 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `85cf58ab` chore: replace once_cell::sync::Lazy with std::sync::LazyLock (#1963); `a04e92c1` feat(shadowsocks): add more Debug implementations (#1656); `c9c59f96` feat(plugin): Support SIP003u, Plugin UDP mode — run `git show` on any of them.
  • Change coupling: bsd.rs ↔ freebsd.rs crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/bsd.rs — `crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/bsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` change together 73% of the time (8 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `e691853f` add support for OpenBSD/pf (#1567); `4006cdec` feat(local): redir *bsd pfvar.h bindgen (at that commit the file was still `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/bsd.rs`); `8817e04d` enable dual-stack for redir sockets (at that commit the file was still `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/bsd.rs`) — run `git show` on any of them.
  • Change coupling: proxy_listener.rs ↔ proxy_socket.rs crates/shadowsocks/src/relay/tcprelay/proxy_listener.rs — `crates/shadowsocks/src/relay/tcprelay/proxy_listener.rs` and `crates/shadowsocks/src/relay/udprelay/proxy_socket.rs` change together 60% of the time (6 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) with no explicit dependency — the edge is real but nothing declares it. Read the pair before acting: if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE — the registration is the link, and it is meant not to be an import — and the thing to add is a comment on each side naming the other, not a merge; if they simply belong together, co-locate them; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 6 shared commits counted here, the most recent 3 are `85cf58ab` chore: replace once_cell::sync::Lazy with std::sync::LazyLock (#1963); `a04e92c1` feat(shadowsocks): add more Debug implementations (#1656); `c9c59f96` feat(plugin): Support SIP003u, Plugin UDP mode — run `git show` on any of them.
  • Change coupling: client.rs ↔ server.rs crates/shadowsocks/src/relay/tcprelay/proxy_stream/client.rs — `crates/shadowsocks/src/relay/tcprelay/proxy_stream/client.rs` and `crates/shadowsocks/src/relay/tcprelay/proxy_stream/server.rs` change together 53% of the time (8 of the 15 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) with no explicit dependency between them. They sit in the same directory, but in this ecosystem each file is its own module — a sibling reference still needs an import — so the missing import edge is real: the coupling runs through shared behaviour, not a declared dependency. If they duplicate structure, extract the common part into one unit; otherwise the coupling is hidden and worth breaking. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `12c4ff25` feat: add MakeSocketProtect and docs, reformatted; `a04e92c1` feat(shadowsocks): add more Debug implementations (#1656); `2048cb1d` AEAD-2022 TCP protocol breaking changes — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×4
  • Duplicated block (12 lines × 2) crates/shadowsocks/src/relay/socks5.rs:886 — crates/shadowsocks/src/relay/socks5.rs:886-897 | crates/shadowsocks/src/relay/socks5.rs:899-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.
  • Duplicated block (12 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:574 — crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:574-585 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:590-601 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) crates/shadowsocks-service/src/local/http/http_client.rs:344 — crates/shadowsocks-service/src/local/http/http_client.rs:344-355 | crates/shadowsocks-service/src/local/http/http_client.rs:395-406 — both copies are in the same file, so extract the 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 (12 lines × 2) crates/shadowsocks-service/src/local/net/udp/association.rs:485 — crates/shadowsocks-service/src/local/net/udp/association.rs:485-496 | crates/shadowsocks-service/src/server/udprelay.rs:575-586 — 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.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×4
  • Duplicated block (11 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:418 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:418-428 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:561-571 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:580-590 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (11 lines × 3) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:43 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:43-53 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:63-73 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:326-336 — 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 (11 lines × 3) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:141 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:141-151 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:157-167 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:143-153 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (11 lines × 3) crates/shadowsocks/src/manager/protocol.rs:101 — crates/shadowsocks/src/manager/protocol.rs:101-111 | crates/shadowsocks/src/manager/protocol.rs:209-219 | crates/shadowsocks/src/manager/protocol.rs:243-253 — 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 (6 lines × 3) · ×4
  • Duplicated block (6 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:75 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:75-80 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:132-137 | crates/shadowsocks/src/net/sys/windows/mod.rs:83-88 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:82 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:82-87 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:139-144 | crates/shadowsocks/src/net/sys/windows/mod.rs:90-95 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:89 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:89-94 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:146-151 | crates/shadowsocks/src/net/sys/windows/mod.rs:97-102 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:96 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:96-101 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:153-158 | crates/shadowsocks/src/net/sys/windows/mod.rs:104-109 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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.
D1 · Cyclomatic Complexity · Config · ×3
  • Config::load_from_ssconfig (cyclomatic 142) crates/shadowsocks-service/src/config.rs:1748 — Config::load_from_ssconfig has cyclomatic complexity 142 (threshold 15). Of this number, 139 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. This file is where this pass's cyclomatic complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 21 functions over the threshold — including the worst — and 202 of the 450 points over it (45%), 3× the next-largest file (src/service/local.rs at 67). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Config::fmt (cyclomatic 74) crates/shadowsocks-service/src/config.rs:3001 — Config::fmt has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent 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 file is where this pass's cyclomatic complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 21 functions over the threshold — including the worst — and 202 of the 450 points over it (45%), 3× the next-largest file (src/service/local.rs at 67). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Config::check_integrity (cyclomatic 31) crates/shadowsocks-service/src/config.rs:2850 — Config::check_integrity 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. This file is where this pass's cyclomatic complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 21 functions over the threshold — including the worst — and 202 of the 450 points over it (45%), 3× the next-largest file (src/service/local.rs at 67). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D1 · Cyclomatic Complexity · shadowsocks_rust · ×3
  • shadowsocks_rust::service::local::create (cyclomatic 82) src/service/local.rs:588 — shadowsocks_rust::service::local::create has cyclomatic complexity 82 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
  • shadowsocks_rust::service::server::create (cyclomatic 47) src/service/server.rs:292 — shadowsocks_rust::service::server::create has cyclomatic complexity 47 (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.
  • shadowsocks_rust::service::manager::create (cyclomatic 46) src/service/manager.rs:273 — shadowsocks_rust::service::manager::create has cyclomatic complexity 46 (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.
D17 · Explicit Debt · XxxComment · ×3
  • XxxComment crates/shadowsocks-service/src/local/context.rs:73 — // XXX: It should be enough for a normal user. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment crates/shadowsocks-service/src/local/tun/mod.rs:110 — // XXX: tun2 set IFF_NO_PI by default. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • XxxComment crates/shadowsocks/src/plugin/mod.rs:133 — // XXX: Is there an easy way to test if UDP port was listening? (no ICMP!) — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · Config · ×3
  • Config::load_from_ssconfig (cognitive 353) crates/shadowsocks-service/src/config.rs:1748 — Config::load_from_ssconfig has cognitive complexity 353 (threshold 15). Drivers by points: if/else 78 (182 pts), match/switch 52 (157 pts), loops 4 (11 pts), boolean chains 3 (nesting depth added 216). Of this number, 347 points are the body's own statements and 6 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. This file is where this pass's cognitive complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 50 functions over the threshold — including the worst — and 549 of the 1214 points over it (45%), 5.7× the next-largest file (crates/shadowsocks-service/src/local/mod.rs at 96). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Config::fmt (cognitive 180) crates/shadowsocks-service/src/config.rs:3001 — Config::fmt has cognitive complexity 180 (threshold 15). Drivers by points: match/switch 31 (97 pts), if/else 40 (71 pts), loops 3 (8 pts), boolean chains 4 (nesting depth added 102). 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. This file is where this pass's cognitive complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 50 functions over the threshold — including the worst — and 549 of the 1214 points over it (45%), 5.7× the next-largest file (crates/shadowsocks-service/src/local/mod.rs at 96). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
  • Config::check_integrity (cognitive 61) crates/shadowsocks-service/src/config.rs:2850 — Config::check_integrity has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (45 pts), boolean chains 8, loops 3 (6 pts), match/switch 1 (2 pts) (nesting depth added 31). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This file is where this pass's cognitive complexity CONCENTRATES: crates/shadowsocks-service/src/config.rs holds 3 of the 50 functions over the threshold — including the worst — and 549 of the 1214 points over it (45%), 5.7× the next-largest file (crates/shadowsocks-service/src/local/mod.rs at 96). No single row can show this, because each is measured only against the threshold: reducing this one file moves this dimension further than any other file in the repository.
D2 · Cognitive Complexity · UdpAssociationContext · ×3
  • UdpAssociationContext::dispatch_packet (cognitive 32) crates/shadowsocks-service/src/local/net/udp/association.rs:377 — UdpAssociationContext::dispatch_packet has cognitive complexity 32 (threshold 15). Drivers by points: if/else 7 (19 pts), match/switch 7 (12 pts), loops 1 (nesting depth added 17). Of this number, 26 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.
  • UdpAssociationContext::dispatch_packet (cognitive 25) crates/shadowsocks-service/src/server/udprelay.rs:503 — UdpAssociationContext::dispatch_packet has cognitive complexity 25 (threshold 15). Drivers by points: match/switch 6 (14 pts), if/else 4 (10 pts), loops 1 (nesting depth added 14). Of this number, 22 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
  • UdpAssociationContext::send_received_outbound_packet (cognitive 19) crates/shadowsocks-service/src/server/udprelay.rs:664 — UdpAssociationContext::send_received_outbound_packet has cognitive complexity 19 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 5 (8 pts), boolean chains 1 (nesting depth added 7). 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 · AccessControl · ×3
  • AccessControl::load_from_file (cognitive 20) crates/shadowsocks-service/src/acl/mod.rs:351 — AccessControl::load_from_file has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (10 pts), match/switch 3 (9 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.
  • AccessControl::check_outbound_blocked (cognitive 18) crates/shadowsocks-service/src/acl/mod.rs:607 — AccessControl::check_outbound_blocked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 1 (3 pts), match/switch 2 (3 pts) (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.
  • AccessControl::check_target_bypassed (cognitive 16) crates/shadowsocks-service/src/acl/mod.rs:555 — AccessControl::check_target_bypassed has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 1 (3 pts), match/switch 2 (3 pts) (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×3
  • Duplicated block (20 lines × 2) crates/shadowsocks/src/net/sys/unix/linux/mod.rs:64 — crates/shadowsocks/src/net/sys/unix/linux/mod.rs:64-83 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:327-346 — both copies are in the same file, so extract the 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 (20 lines × 2) crates/shadowsocks/src/net/sys/unix/mod.rs:38 — crates/shadowsocks/src/net/sys/unix/mod.rs:38-57 | crates/shadowsocks/src/net/sys/windows/mod.rs:439-458 — 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 (20 lines × 2) src/service/local.rs:662 — src/service/local.rs:662-681 | src/service/server.rs:364-383 — before extracting anything, compare `src/service/local.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 342 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 (19 lines × 3) · ×3
  • Duplicated block (19 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:364 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:364-382 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:507-525 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:526-544 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (19 lines × 3) crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:247 — crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:247-265 | crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:154-172 | crates/shadowsocks-service/src/local/tunnel/udprelay.rs:121-139 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs` and `crates/shadowsocks-service/src/local/tunnel/udprelay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 3) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:327 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:327-345 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:339-357 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:334-352 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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) · ×3
  • Duplicated block (15 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:59 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:59-73 | crates/shadowsocks/src/net/sys/windows/mod.rs:67-81 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/windows/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:237 — crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:237-251 | crates/shadowsocks/src/net/sys/windows/mod.rs:262-276 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` and `crates/shadowsocks/src/net/sys/windows/mod.rs` as WHOLE FILES: this scan already matched 13 separate duplicated blocks between them, totalling at least 85 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (15 lines × 2) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:241 — crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:241-255 | crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:259-273 — both copies are in the same file, so extract the 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 (13 lines × 3) · ×3
  • Duplicated block (13 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:302 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:302-314 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:453-465 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:464-476 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (13 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:344 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:344-356 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:487-499 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:506-518 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (13 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:385 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:385-397 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:528-540 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:547-559 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (11 lines × 2) · ×3
  • Duplicated block (11 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:154 — crates/shadowsocks/src/relay/tcprelay/aead.rs:154-164 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:224-234 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (11 lines × 2) crates/shadowsocks-service/src/local/tun/mod.rs:318 — crates/shadowsocks-service/src/local/tun/mod.rs:318-328 | crates/shadowsocks-service/src/local/tun/mod.rs:359-369 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:228 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:228-238 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:379-389 — both copies are in the same file, so extract the 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 (10 lines × 3) · ×3
  • Duplicated block (10 lines × 3) crates/shadowsocks-service/src/local/mod.rs:313 — crates/shadowsocks-service/src/local/mod.rs:313-322 | crates/shadowsocks-service/src/local/mod.rs:348-357 | crates/shadowsocks-service/src/local/mod.rs:426-435 — 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 (10 lines × 3) crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2892 — crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2892-2901 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:3149-3158 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:16402-16411 — 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 (10 lines × 3) src/service/local.rs:87 — src/service/local.rs:87-96 | src/service/manager.rs:36-46 | src/service/server.rs:34-44 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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.
D1 · Cyclomatic Complexity · shadowsocks_service · ×2
  • shadowsocks_service::server::run (cyclomatic 26) crates/shadowsocks-service/src/server/mod.rs:33 — shadowsocks_service::server::run 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.
  • shadowsocks_service::local::dns::server::should_forward_by_response (cyclomatic 20) crates/shadowsocks-service/src/local/dns/server.rs:640 — shadowsocks_service::local::dns::server::should_forward_by_response 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 · PingBalancerContext · ×2
  • PingBalancerContext::check_once (cyclomatic 23) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:386 — PingBalancerContext::check_once 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.
  • PingBalancerContext::check_best_server (cyclomatic 16) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:505 — PingBalancerContext::check_best_server 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.
D17 · Explicit Debt · TodoComment · ×2
  • TodoComment crates/shadowsocks-service/src/manager/server.rs:492 — // TODO: Complete this after discussion. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment crates/shadowsocks/src/dns_resolver/mod.rs:102 — // TODO: Try another address after FIXED_DELAY if one of the IPs is unreachable. — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `// REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
D2 · Cognitive Complexity · Server · ×2
  • Server::new (cognitive 111) crates/shadowsocks-service/src/local/mod.rs:92 — Server::new has cognitive complexity 111 (threshold 15). Drivers by points: if/else 43 (81 pts), match/switch 11 (22 pts), loops 5 (8 pts) (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
  • Server::run (cognitive 16) crates/shadowsocks-service/src/server/server.rs:191 — Server::run has cognitive complexity 16 (threshold 15). Drivers by points: match/switch 3 (9 pts), if/else 5, loops 1 (2 pts) (nesting depth added 7). 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 · PingBalancerContext · ×2
  • PingBalancerContext::check_once (cognitive 35) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:386 — PingBalancerContext::check_once has cognitive complexity 35 (threshold 15). Drivers by points: if/else 17 (25 pts), boolean chains 5, loops 3 (5 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.
  • PingBalancerContext::check_best_server (cognitive 25) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:505 — PingBalancerContext::check_best_server has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · shadowsocks · ×2
  • shadowsocks::relay::udprelay::aead_2022::decrypt_message (cognitive 25) crates/shadowsocks/src/relay/udprelay/aead_2022.rs:245 — shadowsocks::relay::udprelay::aead_2022::decrypt_message has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 4 (8 pts), loops 1 (4 pts) (nesting depth added 13). 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.
  • shadowsocks::config::password_to_keys (cognitive 23) crates/shadowsocks/src/config.rs:495 — shadowsocks::config::password_to_keys has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (13 pts), match/switch 3 (8 pts), 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 · Tun · ×2
  • Tun::run (cognitive 25) crates/shadowsocks-service/src/local/tun/mod.rs:156 — Tun::run has cognitive complexity 25 (threshold 15). Drivers by points: if/else 5 (13 pts), match/switch 6 (11 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.
  • Tun::handle_tun_frame (cognitive 20) crates/shadowsocks-service/src/local/tun/mod.rs:270 — Tun::handle_tun_frame has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (9 pts), match/switch 6 (8 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 · ×2
  • Manager::handle_add (cognitive 22) crates/shadowsocks-service/src/manager/server.rs:466 — Manager::handle_add has cognitive complexity 22 (threshold 15). Drivers by points: match/switch 10 (17 pts), if/else 3, loops 1 (2 pts) (nesting depth added 8). 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.
  • Manager::handle_stat (cognitive 17) crates/shadowsocks-service/src/manager/server.rs:639 — Manager::handle_stat has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (8 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.
D3 · God Classes · TooManyFields · ×2
  • TooManyFields: SSConfig crates/shadowsocks-service/src/config.rs:290 — TooManyFields — 43 stored fields. The bar is 30 stored fields; this is 13 over it, 1.43× 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 crates/shadowsocks-service/src/config.rs:1511 — TooManyFields — 34 stored fields beside 9 methods. 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.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:301 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:301-361 | crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:384-433 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:452-504 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:527-576 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:463-523 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:546-595 — 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) crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:162 — crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:162-188 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:154-180 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:182-209 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:176-202 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:204-230 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:178-221 — 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 · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (4 members, 50+ identical tokens) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:226 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:226-256 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:377-407 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:444-465 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:488-510 — 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) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:116 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:116-127 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:132-143 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:108-119 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:118-129 — 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 · Duplicated block (34 lines × 3) · ×2
  • Duplicated block (34 lines × 3) src/service/local.rs:239 — src/service/local.rs:239-272 | src/service/manager.rs:126-159 | src/service/server.rs:163-196 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (34 lines × 3) src/service/local.rs:522 — src/service/local.rs:522-555 | src/service/manager.rs:234-267 | src/service/server.rs:253-286 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (24 lines × 2) · ×2
  • Duplicated block (24 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:338 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:338-361 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:500-523 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/linux/mod.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 263 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (24 lines × 2) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:220 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:220-243 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:162-185 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 77 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 (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:169 — crates/shadowsocks/src/relay/tcprelay/aead.rs:169-187 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:240-258 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (19 lines × 2) crates/shadowsocks/src/relay/tcprelay/aead.rs:412 — crates/shadowsocks/src/relay/tcprelay/aead.rs:412-430 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:740-758 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (17 lines × 3) · ×2
  • Duplicated block (17 lines × 3) crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:169 — crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:169-185 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:183-199 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:211-227 — 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 (17 lines × 3) src/service/local.rs:501 — src/service/local.rs:501-517 | src/service/manager.rs:158-174 | src/service/server.rs:195-211 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (17 lines × 2) · ×2
  • Duplicated block (17 lines × 2) crates/shadowsocks/src/relay/udprelay/aead_2022.rs:259 — crates/shadowsocks/src/relay/udprelay/aead_2022.rs:259-275 | crates/shadowsocks/src/relay/udprelay/aead_2022.rs:281-297 — both copies are in the same file, so extract the 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 (17 lines × 2) src/service/manager.rs:513 — src/service/manager.rs:513-529 | src/service/server.rs:555-571 — before extracting anything, compare `src/service/manager.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 327 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 (16 lines × 3) · ×2
  • Duplicated block (16 lines × 3) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:309 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:309-324 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:315-330 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:316-331 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (16 lines × 3) src/service/local.rs:964 — src/service/local.rs:964-979 | src/service/manager.rs:472-487 | src/service/server.rs:514-529 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (14 lines × 3) · ×2
  • Duplicated block (14 lines × 3) crates/shadowsocks-service/src/config.rs:2083 — crates/shadowsocks-service/src/config.rs:2083-2096 | crates/shadowsocks-service/src/config.rs:2397-2410 | crates/shadowsocks-service/src/config.rs:2645-2658 — 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 (14 lines × 3) src/service/local.rs:983 — src/service/local.rs:983-996 | src/service/manager.rs:491-504 | src/service/server.rs:533-546 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (11 lines × 4) · ×2
  • Duplicated block (11 lines × 4) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:45 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:45-55 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:63-73 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:44-54 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:47-57 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (11 lines × 4) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:117 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:117-127 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:133-143 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:109-119 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:119-129 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (8 lines × 4) · ×2
  • Duplicated block (8 lines × 4) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:308 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:308-315 | crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:391-398 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:470-477 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:553-560 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/linux/mod.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 263 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) crates/shadowsocks-service/src/local/dns/server.rs:261 — crates/shadowsocks-service/src/local/dns/server.rs:261-270 | crates/shadowsocks-service/src/local/http/server.rs:117-124 | crates/shadowsocks-service/src/local/socks/server/server.rs:122-129 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:96-103 — before extracting anything, compare `crates/shadowsocks-service/src/local/dns/server.rs` and `crates/shadowsocks-service/src/local/socks/server/server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×2
  • Duplicated block (7 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs:155 — crates/shadowsocks/src/relay/tcprelay/aead.rs:155-161 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:213-219 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:225-231 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (7 lines × 3) crates/shadowsocks-service/src/local/mod.rs:113 — crates/shadowsocks-service/src/local/mod.rs:113-119 | crates/shadowsocks-service/src/manager/mod.rs:26-32 | crates/shadowsocks-service/src/server/mod.rs:54-60 — `crates/shadowsocks-service/src/local/mod.rs` and `crates/shadowsocks-service/src/manager/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×2
  • Duplicated block (5 lines × 5) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:236 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:236-240 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:363-367 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:283-287 | crates/shadowsocks/src/net/sys/unix/others.rs:89-93 | crates/shadowsocks/src/net/sys/windows/mod.rs:473-477 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 5) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:230 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:230-234 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:357-361 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:277-281 | crates/shadowsocks/src/net/sys/unix/others.rs:83-87 | crates/shadowsocks/src/net/sys/windows/mod.rs:467-471 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 3) · ×2
  • Duplicated block (5 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:317 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:317-321 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:468-472 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:479-483 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 3) crates/shadowsocks/src/manager/protocol.rs:96 — crates/shadowsocks/src/manager/protocol.rs:96-100 | crates/shadowsocks/src/manager/protocol.rs:204-208 | crates/shadowsocks/src/manager/protocol.rs:238-242 — 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.
D1 · Cyclomatic Complexity · Server · ×1
  • Server::new (cyclomatic 65) crates/shadowsocks-service/src/local/mod.rs:92 — Server::new has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · TcpTun · ×1
  • TcpTun::new (cyclomatic 27) crates/shadowsocks-service/src/local/tun/tcp.rs:259 — TcpTun::new 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 · ServerConfig · ×1
  • ServerConfig::from_url (cyclomatic 23) crates/shadowsocks/src/config.rs:853 — ServerConfig::from_url has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (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 · DecryptedReader · ×1
  • DecryptedReader::poll_read_header (cyclomatic 19) crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:260 — DecryptedReader::poll_read_header 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 · AccessControl · ×1
  • AccessControl::load_from_file (cyclomatic 19) crates/shadowsocks-service/src/acl/mod.rs:351 — AccessControl::load_from_file has cyclomatic complexity 19 (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 · OnlineConfigService · ×1
  • OnlineConfigService::run_once_impl (cyclomatic 19) crates/shadowsocks-service/src/local/online_config/mod.rs:104 — OnlineConfigService::run_once_impl has cyclomatic complexity 19 (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 · HttpService · ×1
  • HttpService::serve_connection (cyclomatic 18) crates/shadowsocks-service/src/local/http/http_service.rs:54 — HttpService::serve_connection has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · UdpAssociationContext · ×1
  • UdpAssociationContext::dispatch_packet (cyclomatic 18) crates/shadowsocks-service/src/local/net/udp/association.rs:377 — UdpAssociationContext::dispatch_packet has cyclomatic complexity 18 (threshold 15). Of this number, 14 points are the body's own statements and 4 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 · HttpClient · ×1
  • HttpClient::send_request (cyclomatic 17) crates/shadowsocks-service/src/local/http/http_client.rs:153 — HttpClient::send_request has cyclomatic complexity 17 (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 · Tun · ×1
  • Tun::handle_tun_frame (cyclomatic 17) crates/shadowsocks-service/src/local/tun/mod.rs:270 — Tun::handle_tun_frame has cyclomatic complexity 17 (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 · UdpServer · ×1
  • UdpServer::run (cyclomatic 16) crates/shadowsocks-service/src/server/udprelay.rs:147 — UdpServer::run 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, 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×1
  • Hotspot: crates/shadowsocks-service/src/server/mod.rs crates/shadowsocks-service/src/server/mod.rs:33 — crates/shadowsocks-service/src/server/mod.rs changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in shadowsocks_service::server::run at line 33. 1 of those changes was a fix/bug commit, and the other 1 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, 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-07-01..2026-09-29, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-01 10:27:31 +08:00' --until='2026-09-29 10:27:31 +08:00' --full-history --no-merges -- crates/shadowsocks-service/src/server/mod.rs`: 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.
D2 · Cognitive Complexity · TcpTun · ×1
  • TcpTun::new (cognitive 67) crates/shadowsocks-service/src/local/tun/tcp.rs:259 — TcpTun::new has cognitive complexity 67 (threshold 15). Drivers by points: if/else 12 (40 pts), loops 6 (13 pts), match/switch 2 (8 pts), boolean chains 6 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ServerConfig · ×1
  • ServerConfig::from_url (cognitive 39) crates/shadowsocks/src/config.rs:853 — ServerConfig::from_url has cognitive complexity 39 (threshold 15). Drivers by points: match/switch 16 (30 pts), if/else 5 (7 pts), loops 1 (2 pts) (nesting depth added 17). 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 · UdpServer · ×1
  • UdpServer::run (cognitive 30) crates/shadowsocks-service/src/server/udprelay.rs:147 — UdpServer::run has cognitive complexity 30 (threshold 15). Drivers by points: match/switch 5 (12 pts), if/else 4 (11 pts), loops 4 (7 pts) (nesting depth added 17). Of this number, 27 points are the body's own statements and 3 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 · OnlineConfigService · ×1
  • OnlineConfigService::run_once_impl (cognitive 29) crates/shadowsocks-service/src/local/online_config/mod.rs:104 — OnlineConfigService::run_once_impl has cognitive complexity 29 (threshold 15). Drivers by points: match/switch 9 (13 pts), if/else 7 (12 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HttpService · ×1
  • HttpService::serve_connection (cognitive 28) crates/shadowsocks-service/src/local/http/http_service.rs:54 — HttpService::serve_connection has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (14 pts), match/switch 7 (13 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 · DecryptedReader · ×1
  • DecryptedReader::poll_read_header (cognitive 26) crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:260 — DecryptedReader::poll_read_header has cognitive complexity 26 (threshold 15). Drivers by points: if/else 13 (15 pts), match/switch 5 (10 pts), boolean chains 1 (nesting depth added 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.
D2 · Cognitive Complexity · UdpRedirInboundWriter · ×1
  • UdpRedirInboundWriter::send_to (cognitive 24) crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:93 — UdpRedirInboundWriter::send_to has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 6 (10 pts), boolean chains 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 · HttpClient · ×1
  • HttpClient::send_request (cognitive 22) crates/shadowsocks-service/src/local/http/http_client.rs:153 — HttpClient::send_request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (12 pts), match/switch 6 (7 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 · TcpListener · ×1
  • TcpListener::bind_redir (cognitive 20) crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:22 — TcpListener::bind_redir has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (14 pts), match/switch 3 (6 pts) (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · EncryptedWriter · ×1
  • EncryptedWriter::poll_write_encrypted (cognitive 20) crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:651 — EncryptedWriter::poll_write_encrypted has cognitive complexity 20 (threshold 15). Drivers by points: if/else 3 (8 pts), match/switch 3 (8 pts), loops 2 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FakeDnsManager · ×1
  • FakeDnsManager::open (cognitive 19) crates/shadowsocks-service/src/local/fake_dns/manager.rs:150 — FakeDnsManager::open has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (15 pts), match/switch 3, boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PingBalancerBuilder · ×1
  • PingBalancerBuilder::find_best_idx (cognitive 19) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:107 — PingBalancerBuilder::find_best_idx has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · genipset.generate_ipset (cognitive 19) · ×1
  • genipset.generate_ipset (cognitive 19) configs/genipset.py:17 — genipset.generate_ipset has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 2 (3 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 · DnsResolver · ×1
  • DnsResolver::resolve (cognitive 18) crates/shadowsocks-service/src/local/dns/dns_resolver.rs:107 — DnsResolver::resolve has cognitive complexity 18 (threshold 15). Drivers by points: match/switch 6 (10 pts), if/else 5 (8 pts) (nesting depth added 7). 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 · PacketFilter · ×1
  • PacketFilter::udp_natlook (cognitive 18) crates/shadowsocks-service/src/local/redir/sys/unix/bsd_pf.rs:208 — PacketFilter::udp_natlook has cognitive complexity 18 (threshold 15). Drivers by points: if/else 4 (9 pts), match/switch 3 (6 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 · CopyBuffer · ×1
  • CopyBuffer::poll_copy (cognitive 17) crates/shadowsocks/src/relay/tcprelay/utils.rs:51 — CopyBuffer::poll_copy has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · RedirUdpServer · ×1
  • RedirUdpServer::run (cognitive 16) crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:236 — RedirUdpServer::run has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (9 pts), match/switch 2 (5 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.
D22 · Internal API Consistency · Duplicate intent with divergent naming and scope. `ServerType` and `ConfigType` appear to represent the same conceptual enum (Local/Server/Manager/etc.), but are split across two modules with different method signatures. `ServerType` only has `is_local`/`is_server`, while `ConfigType` has `is_manager`/`is_online_config` as well. This forces users to import two different types for similar checks. · ×1
  • Duplicate intent with divergent naming and scope. `ServerType` and `ConfigType` appear to represent the same conceptual enum (Local/Server/Manager/etc.), but are split across two modules with different method signatures. `ServerType` only has `is_local`/`is_server`, while `ConfigType` has `is_manager`/`is_online_config` as well. This forces users to import two different types for similar checks. — Unify into a single `ServerType` or `ConfigType` enum. If separation is required by module boundaries, ensure `ServerType` exposes the same predicates as `ConfigType` or that `ConfigType` delegates to `ServerType`. (signatures: shadowsocks.config.ServerType.is_local(): bool | shadowsocks.config.ServerType.is_server(): bool | shadowsocks_service.config.ConfigType.is_local(): bool | shadowsocks_service.config.ConfigType.is_server(): bool | shadowsocks_service.config.ConfigType.is_manager(): bool | shadowsocks_service.config.ConfigType.is_online_config(): bool)
D22 · Internal API Consistency · Redundant accessors for the same underlying data. `key()` and `password()` likely return the same secret material (one as bytes, one as string). `export_password()` is a third variant. This creates confusion about which method to use for serialization vs internal use. · ×1
  • Redundant accessors for the same underlying data. `key()` and `password()` likely return the same secret material (one as bytes, one as string). `export_password()` is a third variant. This creates confusion about which method to use for serialization vs internal use. — Keep `password()` for string access and `key()` for binary access if distinct types are needed, but remove `export_password()` if it duplicates `password()`, or rename it to `to_export_string()` if it performs specific formatting (e.g., URL encoding) distinct from simple string conversion. (signatures: shadowsocks.config.ServerConfig.key(): &[u8] | shadowsocks.config.ServerConfig.password(): str | shadowsocks.config.ServerConfig.export_password(): String)
D22 · Internal API Consistency · Inconsistent naming for cloning/copying operations. `clone_identity_hash` and `clone_identity_keys` use the verb `clone` for returning owned data, whereas Rust idioms typically use `to_owned()` or just rely on the type system. More importantly, `ServerUser` has `clone_identity_hash` but `ServerConfig` has `clone_identity_keys`. The naming is inconsistent between the two types (`hash` vs `keys`). · ×1
  • Inconsistent naming for cloning/copying operations. `clone_identity_hash` and `clone_identity_keys` use the verb `clone` for returning owned data, whereas Rust idioms typically use `to_owned()` or just rely on the type system. More importantly, `ServerUser` has `clone_identity_hash` but `ServerConfig` has `clone_identity_keys`. The naming is inconsistent between the two types (`hash` vs `keys`). — Standardize on `to_owned_identity_hash()` and `to_owned_identity_keys()` or simply `identity_hash_owned()` to clearly indicate ownership transfer, and ensure consistent naming between `ServerUser` and `ServerConfig`. (signatures: shadowsocks.config.ServerUser.clone_identity_hash(): Bytes | shadowsocks.config.ServerUser.identity_hash(): &[u8] | shadowsocks.config.ServerConfig.clone_identity_keys(): Bytes | shadowsocks.config.ServerConfig.identity_keys(): &[Bytes])
D22 · Internal API Consistency · Confusingly similar method names with different signatures. `send_to` and `send_to_manager` both send data, but take different target types (`ManagerSocketAddr` vs `ManagerAddr`) and one takes a `Context`. This suggests `send_to_manager` is a higher-level wrapper, but the naming is not distinct enough to prevent confusion. · ×1
  • Confusingly similar method names with different signatures. `send_to` and `send_to_manager` both send data, but take different target types (`ManagerSocketAddr` vs `ManagerAddr`) and one takes a `Context`. This suggests `send_to_manager` is a higher-level wrapper, but the naming is not distinct enough to prevent confusion. — Rename `send_to_manager` to `send_to_addr` or `send_with_context` to distinguish it from the lower-level `send_to` which uses a socket address. (signatures: shadowsocks.manager.datagram.ManagerDatagram.send_to_manager(buf: &[u8], context: Context, target: ManagerAddr): Result | shadowsocks.manager.datagram.ManagerDatagram.send_to(buf: &[u8], target: ManagerSocketAddr): Result)
D22 · Internal API Consistency · Ambiguous constructor variants. `new` takes a generic key `K`, while `with_encoded_key` takes a `str`. It is unclear if `new` expects raw bytes or encoded strings, leading to potential misuse. The existence of `with_encoded_key` suggests `new` might not handle string encoding, but the naming doesn't make this distinction clear. · ×1
  • Ambiguous constructor variants. `new` takes a generic key `K`, while `with_encoded_key` takes a `str`. It is unclear if `new` expects raw bytes or encoded strings, leading to potential misuse. The existence of `with_encoded_key` suggests `new` might not handle string encoding, but the naming doesn't make this distinction clear. — Rename `new` to `new_raw` or `new_from_bytes` if it expects raw bytes, and keep `with_encoded_key` or rename it to `new_from_string` for clarity. (signatures: shadowsocks.config.ServerUser.with_encoded_key(name: N, key: str): Result | shadowsocks.config.ServerUser.new(name: N, key: K): Self)
D22 · Internal API Consistency · Redundant methods with unclear distinction. `get_user_by_hash` and `clone_user_by_hash` both return `ServerUser`. In Rust, `get` usually implies borrowing or returning a reference, but here both return owned `ServerUser`. The distinction between 'get' and 'clone' is semantically weak if the return type is identical. · ×1
  • Redundant methods with unclear distinction. `get_user_by_hash` and `clone_user_by_hash` both return `ServerUser`. In Rust, `get` usually implies borrowing or returning a reference, but here both return owned `ServerUser`. The distinction between 'get' and 'clone' is semantically weak if the return type is identical. — If one returns a reference and one returns an owned value, the return types should reflect that (e.g., `&ServerUser` vs `ServerUser`). If both return owned values, keep only one (e.g., `get_user_by_hash`) and remove the other, or rename to `fetch_user_by_hash` if it implies a more expensive operation. (signatures: shadowsocks.config.ServerUserManager.get_user_by_hash(user_hash: &[u8]): ServerUser | shadowsocks.config.ServerUserManager.clone_user_by_hash(user_hash: &[u8]): ServerUser)
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D3 · God Classes · ClassTooLong · ×1
  • ClassTooLong: Config crates/shadowsocks-service/src/config.rs:1511 — ClassTooLong — 1130 significant lines (blank, comment-only and punctuation-only lines excluded, and inline test code — #[cfg(test)] modules and bare #[test] functions — not counted), 9 methods, 3 blocks, lines 1511-3444. The bar is 400 significant lines; this is 730 over it, 2.83× 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.
D3 · God Classes · TooManyMethods · ×1
  • TooManyMethods: ServerConfig crates/shadowsocks/src/config.rs:405 — TooManyMethods — 35 methods. The bar is 30 methods; this is 5 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (5 members, 16 shared lines) · ×1
  • Near-duplicate member family (5 members, 16 shared lines) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:229 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:229-249 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:356-376 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:276-296 | crates/shadowsocks/src/net/sys/unix/others.rs:82-103 | crates/shadowsocks/src/net/sys/windows/mod.rs:466-486 — These 5 members are variants of one another: a block of 16 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 5 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 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 42 shared lines) · ×1
  • Near-duplicate member family (4 members, 42 shared lines) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:43 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:43-109 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:61-125 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:42-101 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:45-111 — These 4 members are variants of one another: a block of 42 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 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 · Near-duplicate member family (3 members, 134 shared lines) · ×1
  • Near-duplicate member family (3 members, 134 shared lines) src/service/local.rs:588 — src/service/local.rs:588-1054 | src/service/manager.rs:273-529 | src/service/server.rs:292-571 — These 3 members are variants of one another: a block of 134 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 family (3 members, 131 shared lines) · ×1
  • Near-duplicate member family (3 members, 131 shared lines) src/service/local.rs:86 — src/service/local.rs:86-585 | src/service/manager.rs:35-270 | src/service/server.rs:33-289 — These 3 members are variants of one another: a block of 131 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 family (3 members, 19 shared lines) · ×1
  • Near-duplicate member family (3 members, 19 shared lines) crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2891 — crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:2891-2926 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:3148-3207 | crates/shadowsocks-service/src/local/redir/sys/unix/pfvar_bindgen_macos.rs:16401-16444 — These 3 members are variants of one another: a block of 19 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 (44 shared lines) · ×1
  • Near-duplicate member pair (44 shared lines) crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:386 — crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:386-502 | crates/shadowsocks-service/src/local/loadbalancing/ping_balancer.rs:505-603 — These two members are variants of one another: 44 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 (22 corresponding lines) · ×1
  • Edited copy of a member (22 corresponding lines) crates/shadowsocks/src/relay/udprelay/crypto_io.rs:74 — crates/shadowsocks/src/relay/udprelay/crypto_io.rs:74-102 | crates/shadowsocks/src/relay/udprelay/crypto_io.rs:113-136 — 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 · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (5 members, 50+ identical tokens) crates/shadowsocks-service/src/local/dns/server.rs:514 — crates/shadowsocks-service/src/local/dns/server.rs:514-529 | crates/shadowsocks-service/src/local/fake_dns/server.rs:124-137 | crates/shadowsocks-service/src/local/redir/server.rs:131-144 | crates/shadowsocks-service/src/local/socks/server/mod.rs:194-209 | crates/shadowsocks-service/src/local/tunnel/server.rs:157-170 — These 5 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 5 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 5 times.
D4 · Code Duplication · Duplicated block (42 lines × 3) · ×1
  • Duplicated block (42 lines × 3) src/service/local.rs:893 — src/service/local.rs:893-934 | src/service/manager.rs:419-460 | src/service/server.rs:460-501 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (41 lines × 2) · ×1
  • Duplicated block (41 lines × 2) crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:45 — crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:45-85 | crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:221-261 — both copies are in the same file, so extract the 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 (40 lines × 2) · ×1
  • Duplicated block (40 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:394 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:394-433 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:556-595 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/linux/mod.rs` as WHOLE FILES: this scan already matched 21 separate duplicated blocks between them, totalling at least 263 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (39 lines × 3) · ×1
  • Duplicated block (39 lines × 3) src/service/local.rs:286 — src/service/local.rs:286-324 | src/service/manager.rs:197-235 | src/service/server.rs:216-254 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (37–38 lines × 2) · ×1
  • Duplicated block (37–38 lines × 2) crates/shadowsocks-service/src/local/dns/server.rs:290 — crates/shadowsocks-service/src/local/dns/server.rs:290-326 | crates/shadowsocks-service/src/local/fake_dns/tcp_server.rs:98-135 — 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.
D4 · Code Duplication · Duplicated block (36 lines × 2) · ×1
  • Duplicated block (36 lines × 2) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:48 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:48-83 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:50-85 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 166 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 (31 lines × 4) · ×1
  • Duplicated block (31 lines × 4) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:77 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:77-107 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:93-123 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:69-99 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:79-109 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:152 — crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:152-182 | crates/shadowsocks-service/src/local/tunnel/udprelay.rs:119-149 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs` and `crates/shadowsocks-service/src/local/tunnel/udprelay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (29 lines × 3) · ×1
  • Duplicated block (29 lines × 3) src/service/local.rs:853 — src/service/local.rs:853-881 | src/service/manager.rs:314-342 | src/service/server.rs:399-427 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (27 lines × 2) · ×1
  • Duplicated block (27 lines × 2) crates/shadowsocks-service/src/config.rs:2163 — crates/shadowsocks-service/src/config.rs:2163-2189 | crates/shadowsocks-service/src/config.rs:2272-2298 — both copies are in the same file, so extract the 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 lines × 2) · ×1
  • Duplicated block (25 lines × 2) src/service/local.rs:628 — src/service/local.rs:628-652 | src/service/server.rs:331-355 — before extracting anything, compare `src/service/local.rs` and `src/service/server.rs` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 342 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 (24 lines × 3) · ×1
  • Duplicated block (24 lines × 3) src/service/local.rs:594 — src/service/local.rs:594-617 | src/service/manager.rs:278-301 | src/service/server.rs:297-320 — before extracting anything, compare `src/service/local.rs` and `src/service/manager.rs` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 278 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 (22–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) crates/shadowsocks-service/src/local/mod.rs:95 — crates/shadowsocks-service/src/local/mod.rs:95-117 | crates/shadowsocks-service/src/server/mod.rs:37-58 — `crates/shadowsocks-service/src/local/mod.rs` and `crates/shadowsocks-service/src/server/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 45 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:100 — crates/shadowsocks-service/src/local/redir/udprelay/mod.rs:100-122 | crates/shadowsocks-service/src/server/udprelay.rs:668-688 — 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.
D4 · Code Duplication · Duplicated block (22 lines × 3) · ×1
  • Duplicated block (22 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:278 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:278-299 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:429-450 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:440-461 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (22 lines × 2) · ×1
  • Duplicated block (22 lines × 2) crates/shadowsocks-service/src/config.rs:2200 — crates/shadowsocks-service/src/config.rs:2200-2221 | crates/shadowsocks-service/src/config.rs:2347-2368 — both copies are in the same file, so extract the 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 (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs:389 — crates/shadowsocks/src/relay/tcprelay/aead.rs:389-409 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:687-707 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:717-737 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) crates/shadowsocks-service/src/local/mod.rs:674 — crates/shadowsocks-service/src/local/mod.rs:674-694 | crates/shadowsocks-service/src/local/mod.rs:699-719 — both copies are in the same file, so extract the 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 (20–21 lines × 2) · ×1
  • Duplicated block (20–21 lines × 2) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:66 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:66-86 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs:47-66 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/macos.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 74 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 (20 lines × 3) · ×1
  • Duplicated block (20 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:151 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:151-170 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:207-226 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:183-202 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (12–19 lines × 2) · ×1
  • Duplicated block (12–19 lines × 2) crates/shadowsocks/src/relay/udprelay/aead_2022.rs:430 — crates/shadowsocks/src/relay/udprelay/aead_2022.rs:430-448 | crates/shadowsocks/src/relay/udprelay/aead_2022.rs:611-622 — both copies are in the same file, so extract the 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 (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) crates/shadowsocks-service/src/local/socks/server/socks4/tcprelay.rs:97 — crates/shadowsocks-service/src/local/socks/server/socks4/tcprelay.rs:97-113 | crates/shadowsocks-service/src/local/socks/server/socks5/tcprelay.rs:239-257 — 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.
D4 · Code Duplication · Duplicated block (18 lines × 3) · ×1
  • Duplicated block (18 lines × 3) crates/shadowsocks/src/relay/tcprelay/aead.rs:282 — crates/shadowsocks/src/relay/tcprelay/aead.rs:282-299 | crates/shadowsocks/src/relay/tcprelay/aead_2022.rs:469-486 | crates/shadowsocks/src/relay/tcprelay/stream.rs:172-189 — before extracting anything, compare `crates/shadowsocks/src/relay/tcprelay/aead.rs` and `crates/shadowsocks/src/relay/tcprelay/aead_2022.rs` as WHOLE FILES: this scan already matched 11 separate duplicated blocks between them, totalling at least 144 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 (14–16 lines × 6) · ×1
  • Duplicated block (14–16 lines × 6) crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:173 — crates/shadowsocks-service/src/local/redir/tcprelay/sys/unix/linux.rs:173-188 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:166-180 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:195-209 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:187-202 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs:215-230 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:208-221 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/linux.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 135 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 (13–15 lines × 5) · ×1
  • Duplicated block (13–15 lines × 5) crates/shadowsocks-service/src/local/dns/server.rs:515 — crates/shadowsocks-service/src/local/dns/server.rs:515-529 | crates/shadowsocks-service/src/local/fake_dns/server.rs:125-137 | crates/shadowsocks-service/src/local/redir/server.rs:132-144 | crates/shadowsocks-service/src/local/socks/server/mod.rs:195-209 | crates/shadowsocks-service/src/local/tunnel/server.rs:158-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 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 5 times.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:163 — crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:163-177 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs:192-206 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:187-201 | crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs:206-219 — before extracting anything, compare `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/freebsd.rs` and `crates/shadowsocks-service/src/local/redir/udprelay/sys/unix/openbsd.rs` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 166 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 (14–15 lines × 2) · ×1
  • Duplicated block (14–15 lines × 2) crates/shadowsocks/src/relay/udprelay/crypto_io.rs:149 — crates/shadowsocks/src/relay/udprelay/crypto_io.rs:149-162 | crates/shadowsocks/src/relay/udprelay/crypto_io.rs:192-206 — both copies are in the same file, so extract the 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–14 lines × 3) · ×1
  • Duplicated block (12–14 lines × 3) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:253 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:253-264 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:380-393 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:300-313 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (13–14 lines × 2) · ×1
  • Duplicated block (13–14 lines × 2) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:198 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:198-211 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:326-338 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) crates/shadowsocks-service/src/config.rs:2412 — crates/shadowsocks-service/src/config.rs:2412-2422 | crates/shadowsocks-service/src/config.rs:2584-2596 — both copies are in the same file, so extract the 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–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) crates/shadowsocks-service/src/local/redir/tcprelay/mod.rs:42 — crates/shadowsocks-service/src/local/redir/tcprelay/mod.rs:42-54 | crates/shadowsocks-service/src/local/tun/tcp.rs:583-594 — 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.
D4 · Code Duplication · Duplicated block (9–11 lines × 3) · ×1
  • Duplicated block (9–11 lines × 3) crates/shadowsocks-service/src/local/dns/server.rs:261 — crates/shadowsocks-service/src/local/dns/server.rs:261-271 | crates/shadowsocks-service/src/local/socks/server/server.rs:122-130 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:96-104 — before extracting anything, compare `crates/shadowsocks-service/src/local/dns/server.rs` and `crates/shadowsocks-service/src/local/socks/server/server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) crates/shadowsocks-service/src/local/dns/server.rs:390 — crates/shadowsocks-service/src/local/dns/server.rs:390-398 | crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs:67-76 | crates/shadowsocks-service/src/local/tunnel/udprelay.rs:57-66 — before extracting anything, compare `crates/shadowsocks-service/src/local/socks/server/socks5/udprelay.rs` and `crates/shadowsocks-service/src/local/tunnel/udprelay.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 74 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×1
  • Duplicated block (9–10 lines × 2) crates/shadowsocks-service/src/config.rs:1467 — crates/shadowsocks-service/src/config.rs:1467-1476 | crates/shadowsocks-service/src/manager/server.rs:388-396 — 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.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:308 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:308-314 | crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:391-397 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:459-465 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:534-540 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:470-476 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:553-559 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) crates/shadowsocks-service/src/local/mod.rs:137 — crates/shadowsocks-service/src/local/mod.rs:137-142 | crates/shadowsocks-service/src/manager/mod.rs:48-54 | crates/shadowsocks-service/src/server/mod.rs:82-88 — `crates/shadowsocks-service/src/local/mod.rs` and `crates/shadowsocks-service/src/manager/mod.rs` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 4 separate duplicated blocks between them, totalling at least 30 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6 lines × 5) · ×1
  • Duplicated block (6 lines × 5) crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:244 — crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs:244-249 | crates/shadowsocks/src/net/sys/unix/bsd/macos.rs:371-376 | crates/shadowsocks/src/net/sys/unix/linux/mod.rs:291-296 | crates/shadowsocks/src/net/sys/unix/others.rs:98-103 | crates/shadowsocks/src/net/sys/windows/mod.rs:481-486 — before extracting anything, compare `crates/shadowsocks/src/net/sys/unix/bsd/freebsd.rs` and `crates/shadowsocks/src/net/sys/unix/bsd/macos.rs` as WHOLE FILES: this scan already matched 24 separate duplicated blocks between them, totalling at least 227 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 (5 lines × 4) · ×1
  • Duplicated block (5 lines × 4) crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:241 — crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:241-245 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:392-396 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:448-452 | crates/shadowsocks/src/relay/udprelay/proxy_socket.rs:493-497 — 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 (5 lines × 10) · ×1
  • Duplicated block (5 lines × 10) crates/shadowsocks-service/src/local/socks/socks4.rs:264 — crates/shadowsocks-service/src/local/socks/socks4.rs:264-268 | crates/shadowsocks-service/src/local/socks/socks4.rs:359-363 | crates/shadowsocks/src/relay/socks5.rs:327-331 | crates/shadowsocks/src/relay/socks5.rs:559-563 | crates/shadowsocks/src/relay/socks5.rs:633-637 | crates/shadowsocks/src/relay/socks5.rs:698-702 | crates/shadowsocks/src/relay/socks5.rs:759-763 | crates/shadowsocks/src/relay/socks5.rs:818-822 | crates/shadowsocks/src/relay/socks5.rs:919-923 | crates/shadowsocks/src/relay/socks5.rs:969-973 — there are 10 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 10 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) crates/shadowsocks-service/src/local/dns/server.rs:263 — crates/shadowsocks-service/src/local/dns/server.rs:263-271 | crates/shadowsocks-service/src/local/fake_dns/tcp_server.rs:67-75 | crates/shadowsocks-service/src/local/http/server.rs:117-125 | crates/shadowsocks-service/src/local/socks/server/server.rs:122-130 | crates/shadowsocks-service/src/local/tunnel/tcprelay.rs:96-104 — before extracting anything, compare `crates/shadowsocks-service/src/local/dns/server.rs` and `crates/shadowsocks-service/src/local/socks/server/server.rs` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 39 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: shadowsocks — shadowsocks: abstractness 0.12, instability 0.00, distance 0.88 — zone of pain — concrete and depended on by 1 project(s), so it's rigid to change.
Minor — 24 finding(s)
D31 · IaC & Container Security · Low IaC · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — 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/`.
D26 · Project Cohesion · Split crates/shadowsocks · ×1
  • Split crates/shadowsocks — A large shadow-socks relay stack whose namespaces are all named transports/protocols (udprelay/tcprelay/dns_resolver) and a plugin namespace is spread across 16 unrelated namespaces. Suggested: split into `crates/shadowsocks/relay` for transport families, `crates/shadowsocks/plugin` for the single plugin, and any remaining namespaces
D26 · Project Cohesion · Split crates/shadowsocks-service · ×1
  • Split crates/shadowsocks-service — A huge shadow-socks service whose namespaces are all named local/tun/net/outbound/online_config/dns/loadbalancing/redir with no coherent cohesion. Suggested: split into `crates/shadowsocks-service/local` for tun-local networking and load-balanced DNS, leaving net/outbound/server as the main outbound layer
D29 · Static Analysis (SAST) · REDACTED · ×1
  • REDACTED
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 1 of 123 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated and example/demo trees and test files identified by path convention, largest first; 123 of the 201 production source files in this repository met that bar). None is large enough to earn a read-through of its own, so this row stands in for the per-file rows rather than raising one each — most significant first: crates/shadowsocks-service/src/local/http/tokio_rt.rs. Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D40 · Network Egress Confinement · No network policy · ×1
  • No network policy — No Kubernetes NetworkPolicy (or Cilium policy) found. Without one, every pod can talk to every other pod and reach out to the internet by default. Add a default-deny policy and open only the flows you need.
D41 · Kernel & Syscall Confinement · No seccomp profile · ×1
  • No seccomp profile — Workloads do not set a seccomp profile (RuntimeDefault or a Localhost profile). Seccomp blocks the syscalls a container never needs, shrinking the kernel attack surface a container escape would use.
D41 · Kernel & Syscall Confinement · No AppArmor/SELinux confinement · ×1
  • No AppArmor/SELinux confinement — Workloads declare no AppArmor or SELinux profile. A mandatory-access-control profile confines what a compromised container can touch on the host, complementing seccomp's syscall filter.
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.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — Deployment is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever reaches the release trigger goes to production unreviewed, so a mistaken merge or tag is live before anyone can stop it.

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/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1229657779e447cf8b9ec95a68b5b9d6/history.json --exit-code 0 --source .0artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-1229657779e447cf8b9ec95a68b5b9d6/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/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off .58artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive .0artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy config --format json --quiet .71artifacts/raw/trivy-config.json
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.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — The repository ships application workloads but no cluster-governance resources (CRDs, admission webhooks, or a committed policy engine). Runtime threat-detection (Falco/Tetragon) and admission control (Kyverno/OPA-Gatekeeper/PodSecurity) are cluster-OPERATOR controls owned by the platform, not shipped by an application repo/chart — nothing for this repo to assess.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive .0artifacts/raw/osv-scanner.json

Run 01a0eb3c-4d9e-752b-8dc8-66e224a101de · 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