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

permissionlesstech/bitchat

Measured 23 October 2026, 05:32 UTC, at code version 5e9287f

No regression since the last survey

A regression is a drop of 0.5 points or more in the score, or of 2.5 or more out of 10 in a dimension, since the last survey.

CAI score 50out of 100 Adequate
CriticalWeakAdequateStrongExemplary
No change since the last survey

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

A medium codebase: 75,109 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 0.9 person-years · Weakest lens: Event-Driven, 40

Findings by how serious they are

25 critical 525 serious 46 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
23 October 2026, 05:32 UTC

A measurement, not a certificate. The Code Assurance Index records a number together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee the code. The standard was written by Canine Development, which also builds Watchdog. It is open to any tool that implements it, and today Watchdog is the only one that does.

The score is deterministic, which means the same code always gets the same score. Watchdog works it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸

63of 67 dimensions measured by tools. The other 4 are advisory notes from an AI model, which explain the code but don't count towards the score.
578of 596 findings point to an exact file and line, so you can open each one in the code. The other 18 concern the repository as a whole, such as missing documentation.
67dimensions across 7 lenses, read from 75,109 lines of product code in 5 projects.
Chapters

Executive summary

permissionlesstech/bitchat scores 50 out of 100 and is rated Adequate, while five of its seven lenses score higher still: Architecture at 94, rated Exemplary, Security and Compliance at 81 and Performance at 80, both rated Strong, and Maturity at 65 and Code Health at 59, both rated Adequate.

The score is lower than those five because the weakest lens counts most, and here that is Event-Driven, which scores 40 and is rated Weak. Its Handler temporal coupling dimension scores 1 out of 10, and until that reaches 4, Event-Driven can't be rated higher than Adequate. The first actions are to replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource and to adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash, and if Event-Driven rose to 70, the score would rise from 50 to about 58.

25 findings are critical: 15 in Static Analysis (SAST), five in Handler temporal coupling, three in Change Coupling, one in Dependency Vulnerabilities and one in Outbox / dual-write.

Watchdog couldn't measure 15 dimensions in this code, among them Navigability, Platform End-of-Life and Data Protection, so they are left out of the score. The product code is 75,109 lines, which would take an estimated 0.9 person-years, around €130,000, to rebuild.

A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.

How the score is built: what each lens counts for The lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
Event-Driven 40 · counts for 46%Production Readiness 49 · counts for 25%Code Health 59 · counts for 14%Maturity 65 · counts for 8%Performance 80 · counts for 4%Security and Compliance 81 · counts for 2%Architecture 94 · counts for 1%

If Event-Driven rose from 40 to 70, the lowest score rated Strong, the score would rise from 50 to about 58.

Code composition: what the lines of code are
Product code 54%Tests 46%
New since the last survey: 6 findings

These 6 critical or serious findings weren't in the previous survey, on 9 October 2026.

Watchdog compares every finding with the previous survey's. A finding that has only moved to another line in the same file counts as the same finding, so only new findings appear here. Advisory notes from the AI model are left out, because the model words them afresh in every survey.

Fixed since the last survey: 4 findings

These 4 critical or serious findings were in the previous survey, on 9 October 2026, and are gone from this one.

  • Code Duplication · Edited copy of a member (18 corresponding lines) bitchat/Protocols/Geohash.swift
  • Code Duplication · Edited copy of a member (13 corresponding lines) bitchat/Services/VerificationService.swift
  • Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) bitchat/Services/Board/BoardStore.swift
  • Supply-chain Provenance & Signing REDACTED
Rebuild cost: about €130,000 · Estimate
Cost to rebuild€43,000 to €220,000, for 721 to 2,288 hours of work, about 0.9 person-years for 1 to 2 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 50. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeMedium: 75,109 lines of product code

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

Top priorities

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

1
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
Raises the score by about 9 points · Medium effort · Handler temporal coupling
2
Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
Raises the score by about 4 points · Medium effort · Outbox / dual-write
3
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.
Raises the score by about 4 points · Medium effort · Security & performance tooling

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €130,000 to build again, about 0.9 person-years of work. Its weakest lens is Event-Driven, at 40 (Weak). Event-Driven is about whether the parts of the system can rely on the messages they send each other. Because the weakest lens counts most in the score, work on Event-Driven also moves the score most.
Based on: the rebuild estimate · the Event-Driven grade · how much each lens counts
What to do: Start with the Event-Driven actions in Top priorities.
If you do one thing first · First action
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource. Of all the actions in this report, it raises the score most for the work it takes: about 9 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 7.1 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 105,426 lines over the last 90 days, which is about 427,561 lines a year. At that pace, the extra work comes to an estimated 23.9 to 143.5 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — 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 BitFoundation BitFoundation BitLogger BitLogger BitFoundation->BitLogger Tor Tor Tor->BitLogger arti-bitchat arti-bitchat bitchat bitchat bitchat->BitFoundation bitchat->BitLogger bitchat->Tor

Architecture: which parts of the code depend on which

The code is divided into modules, groups of code that each handle one part of the product, and a module depends on another when it uses code from it. The table lists the modules both down the side and across the top, in an order where each module should only use modules listed above it. A number in a cell means the module on that row uses the module in that column, and it counts the pairs of building blocks (types) that connect them. The one thing to look for is a mark above the diagonal line. It means two or more modules use each other in a loop (a dependency cycle), so none of them can be changed, tested or released on its own.

8 modules, with 6 dependencies between them. One loop runs through 3 of the modules, marked above the diagonal.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 arti_bitchat2 arti_bitchat.socks3 scripts.validate_georelays4 localPackages~BitFoundation~BitFoundation5 scripts6 repository7 localPackages~Arti8 localPackages~BitLogger
1 arti_bitchat
2 arti_bitchat.socks
3 scripts.validate_georelays
4 localPackages~BitFoundation~BitFoundation26
5 scripts2
6 repository2902
7 localPackages~Arti3
8 localPackages~BitLogger4
Uses a module listed above itPart of a loopThe module itself
1 arti_bitchat2 arti_bitchat.socks3 scripts.validate_georelays4 localPackages~BitFoundation~BitFoundation5 scripts6 repository7 localPackages~Arti8 localPackages~BitLoggerarti_bitchat1arti_bitchat.socks2scripts.validate_georelays3localPackages~BitFoundation~BitFoundation4scripts5repository6localPackages~Arti7localPackages~BitLogger8262290234

At a glance — Code Health · 59% · Adequate · gated by D2, X4 ·

At a glance — Architecture · 94% · Exemplary ·

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

At a glance — Readiness · 49% · Weak · gated by P3 ·

At a glance — Security · 81% · Strong ·

At a glance — Event-Driven · 40% · Weak · gated by ED1 ·

At a glance — Performance · 80% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures22High / Critical
A05:2025 — Injection15High / Critical

Roadmap

First, replace synchronous waits in handlers with async patterns to prevent blocking on resources. Second, implement the transactional outbox pattern to ensure database writes and message publishes commit atomically, eliminating lost events. Third, integrate static analysis tooling into the CI pipeline to fail builds on security regressions. Finally, adopt structured logging practices and resolve the missing architecture decision record to improve observability and documentation.

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

Do thisHelpsEffortDimension
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.+8.9 ptsMediumHandler temporal coupling
Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.+4.0 ptsMediumOutbox / dual-write
Add a SAST step to CI running what this repository's stack ships: CodeQL's Swift pack (Swift/Xcode) — or `semgrep --config=auto`, which runs on any language — so a security regression fails the build instead of landing.+3.6 ptsMediumSecurity & performance tooling
Resolve the 1 No ADRs found finding(s) in ADR Quality.+1.5 ptsLowADR Quality
Interpolated log message defeats structured logging+2.0 ptsMediumStructured logging
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.+1.4 ptsMediumDeployment & Rollback
Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.+1.4 ptsMediumRelease Hygiene
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.+1.3 ptsMediumArchitecture documentation

File quality

Per-file score 0–10 — a quality signature. Of 127 files carrying findings, judged against the Production bar: 4% slop · 72% mixed · 24% near-clean.

FileScoreBandWorst signal
REDACTED2.5SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopStatic Analysis (SAST): High: REDACTED
REDACTED3.0SlopDependency Vulnerabilities: High CVE: REDACTED
bitchat/ViewModels/ChatViewModel.swift3.5SlopChange Coupling: Boundary-crossing change coupling: ChatViewModel.swift ↔ ShareViewController.swift
bitchat/Views/ContentView.swift3.9SlopChange Coupling: Boundary-crossing change coupling: ContentView.swift ↔ ShareViewController.swift
REDACTED4.8MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
REDACTED5.8MixedStatic Analysis (SAST): High: REDACTED
bitchat/Services/BLE/BLEService.swift6.0MixedExplicit Debt: TodoComment
bitchat/Services/VerificationService.swift6.3MixedCode Duplication: Edited copy of a member (13 corresponding lines)
bitchat/ViewModels/ChatMessageFormatter.swift7.0MixedCyclomatic Complexity: ChatMessageFormatter.formatMessageAsText (cyclomatic 95)
bitchat/Services/Courier/MessageOutboxStore.swift7.0MixedCyclomatic Complexity: MessageOutboxStore.retryDeferredLoad (cyclomatic 43)
bitchat/Sync/GossipSyncManager.swift7.0MixedCyclomatic Complexity: GossipSyncManager._handleRequestSync (cyclomatic 37)
bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift7.0MixedCyclomatic Complexity: BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded (cyclomatic 35)
bitchat/ViewModels/ChatMediaTransferCoordinator.swift7.0MixedCyclomatic Complexity: ChatMediaTransferCoordinator.handleTransferEvent (cyclomatic 21)
bitchat/Services/Gateway/BridgeService.swift7.0MixedCyclomatic Complexity: BridgeService.handleRendezvousEvent (cyclomatic 21)
bitchat/Nostr/NostrRelayManager.swift7.0MixedCyclomatic Complexity: ParsedInbound.init (cyclomatic 20)
bitchat/Noise/NoiseSession.swift7.0MixedCode Duplication: Duplicated block (17 lines × 2)
bitchat/Nostr/XChaCha20Poly1305Compat.swift7.0MixedCode Duplication: Duplicated block (10 lines × 2)
bitchatTests/EndToEnd/PublicChatE2ETests.swift7.0MixedTest Quality: No assertions: simplePublicMessage

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

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

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

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

Could not be resolved — 16

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. 63 of 67 evaluated dimensions are computed purely by tools and static analysis (confidence 1.0); 4 documentation/naming judgement(s) are LLM-assisted and labelled advisory. Overall confidence is 1.0 — 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 — 67 dimensions across the health lenses
D1D2D3D4D5D6D8D9D10D11D12D13D14D15D16D17D19D20D21D22D26D28D29D30D34D35D36D37D43AX10AX3AX4AX8AX9ED1ED4M1M2M3M4P1P10P2P3P4P6PF2PF3X1X12X13X14X15X17X19X21X22X23X24X25X26X27X28X29X3X30X4

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, 578 of 596 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 · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ 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 01a1673e-d026-7b11-942e-1c359c6195e0.

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.

  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Swift Package.swift/Package.resolved, but the licence verdict published here was taken over its crate dependencies. Nothing was read about its SwiftPM dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D27 Navigability — 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. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — 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. `bitchat/Features/voice/PTTBurstPlayer.swift`, `bitchat/Noise/NoiseSessionManager.swift`, `bitchat/Services/CashuTokenDecoder.swift`, `bitchat/ViewModels/ChatLiveVoiceCoordinator.swift`, `bitchat/ViewModels/ChatMediaTransferCoordinator.swift`, … (+10 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — 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 dimension reads a project's own statement about the platform it runs on: a TargetFramework in a .NET project file, a .nvmrc or .python-version, a capped requires-python, a Rust toolchain file or Cargo.toml rust-version, a .go-version, .java-version, .ruby-version, .tool-versions or .sdkmanrc, a go.mod go directive, a Maven or Gradle Java level or toolchain, a Gemfile's ruby directive, a mix.exs elixir requirement, a rebar.config minimum_otp_vsn, a pubspec.yaml SDK constraint, a build.sbt scalaVersion, or a framework major pinned by a dependency constraint. This repository carries none of them, so nothing about its platform was established. That is a gap in this analyzer's coverage, NOT a finding that the platform is supported — a language whose runtime is declared elsewhere (Package.swift, a Dockerfile) is simply not read here yet.
  • 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 reads Microsoft.Extensions.DependencyInjection registrations in C# and Spring beans in Java/Kotlin only, and this repository defines its own container in bitchat/Services/NotificationStreamAssembler.swift, whose lifetimes are not modelled yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • 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.
  • AXB1 Runtime evidence locked — no reproducible boot — 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. Subject: a native UI project (bitchat.xcodeproj/project.pbxproj). The Runtime Evidence tier boots an app only via docker-compose, an Aspire AppHost, a Dockerfile, an npm dev script, a web service's own toolchain entry point (cargo, go, dotnet, Python, Spring Boot), or an Android app's own Gradle wrapper (run on an emulator); an Apple or Flutter app needs a host it lacks. None applied, so no live runtime a11y/egress/header evidence was collected. You can widen what we reach: add a docker-compose.yml (or an Aspire AppHost) that brings the app up with its dependencies. Watchdog then boots it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
  • C1 Data Protection — not measured this run — 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.
  • 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 reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, Rust, Swift, c is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — 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 C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, Rust, Swift, c is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in 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.
  • 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 reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, 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.
  • 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 reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Python, Rust, Swift is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.

Repo exclusion declarations: 6 pattern(s) declared (.gitattributes linguist-generated/vendored, .editorconfig generated_code) excluded 0 source file(s) from code-quality scoring. Declarations are the repo's own visible statement that a tree is machine-written or vendored — auditable in any diff, honored by GitHub the same way.

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.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D8 Code Coverage: Coverage is measured by building and running the test suite inside Watchdog's isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
  • 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.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D11 Test Reliability: Flakiness is inferred from history/markers — Watchdog runs the suite once (for coverage), not the repeated runs under varied conditions that reveal nondeterminism, so a flaky test never recorded as failing is invisible here.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 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.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • 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.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • 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 (4): D19, D21, D22, 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 Complexity5.9 / 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 5.9 / 10 · rule-coverage 100% · ceiling Prevented

100 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was ChatMessageFormatter.formatMessageAsText at 95. 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 MessageType.description at 18 — they are counted neither in the figure above nor in this dimension's score. 3 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: localPackages/BitFoundation/Sources/BitFoundation/MessageType.swift (MessageType.description at 18), bitchat/Sync/SyncTypeFlags.swift (SyncTypeFlags.bitIndex at 17), bitchat/Models/CommandInfo.swift (CommandInfo.description at 16). They are named here because the per-file figures other dimensions report are taken BEFORE this exclusion, so such a file can show a high maximum complexity elsewhere in this report and nothing here, with nothing to reconcile the two.

ChatMessageFormatter.formatMessageAsText (cyclomatic 95)bitchat/ViewModels/ChatMessageFormatter.swift:17
MimeType.matches (cyclomatic 60)bitchat/Services/BLE/MimeType.swift:114
NoiseSessionManager.handleIncomingHandshakeWithResult (cyclomatic 54)bitchat/Noise/NoiseSessionManager.swift:526
BinaryProtocol.decodeCore (cyclomatic 48)localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:267
MessageOutboxStore.retryDeferredLoad (cyclomatic 43)bitchat/Services/Courier/MessageOutboxStore.swift:470

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

What to do

  1. Bring the 1 body over 60 down to 60 or less in Cyclomatic Complexity — start with ChatMessageFormatter.formatMessageAsText (cyclomatic 95). — Refactoring it lifts Cyclomatic Complexity from 5.9 to about 6.4/10.
  2. 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 Complexity3.4 / 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 3.4 / 10 · rule-coverage 100% · ceiling Prevented

137 method(s) exceeded the cognitive complexity threshold of 15; the worst was ChatMessageFormatter.formatMessageAsText at 286.

ChatMessageFormatter.formatMessageAsText (cognitive 286)bitchat/ViewModels/ChatMessageFormatter.swift:17
NoiseSessionManager.handleIncomingHandshakeWithResult (cognitive 94)bitchat/Noise/NoiseSessionManager.swift:526
MeshPeerList.body (cognitive 92)bitchat/Views/MeshPeerList.swift:39
MessageOutboxStore.save (cognitive 76)bitchat/Services/Courier/MessageOutboxStore.swift:256
GossipSyncManager._handleRequestSync (cognitive 74)bitchat/Sync/GossipSyncManager.swift:418

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

What to do

  1. Bring the 1 body over 120 down to 120 or less in Cognitive Complexity — start with ChatMessageFormatter.formatMessageAsText (cognitive 286). — Refactoring it lifts Cognitive Complexity from 3.4 to about 4.8/10.
  2. 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 Classes7.7 / 10Strong✓ Tool-verified

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

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

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

73 god class(es) detected.

MethodTooLong: ChatMessageFormatter.formatMessageAsText · ×19bitchat/ViewModels/ChatMessageFormatter.swift:17
FileTooLong: BLE/BLEService.swift · ×17bitchat/Services/BLE/BLEService.swift
ClassTooLong: BLEService · ×17bitchat/Services/BLE/BLEService.swift:182
TooManyMethods: ChatViewModel · ×14bitchat/ViewModels/ChatViewModel.swift:125
FunctionTooLong: TorManager.swift.arti_start · ×6localPackages/Arti/Sources/TorManager.swift:18

What to do

  1. Resolve the 19 MethodTooLong finding(s) in God Classes — start with ChatViewModel.swift (2), MessageOutboxStore.swift (2), ChatMessageFormatter.swift. — One of this dimension's main actionable groups (19 warning-level).
  2. Resolve the 17 FileTooLong finding(s) in God Classes — start with BLEService.swift, ChatMediaTransferCoordinator.swift, ChatViewModel.swift. — One of this dimension's main actionable groups (17 warning-level).
  3. Resolve the 17 ClassTooLong finding(s) in God Classes — start with BLEService.swift, ChatViewModel.swift, NostrRelayManager.swift. — One of this dimension's main actionable groups (17 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.5 / 10Stronggated by 84 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.5 / 10 · rule-coverage 100% · ceiling Verified

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

Duplicated block (5 lines × 2) · ×10bitchat/Services/BLE/BLEService.swift:5085
Duplicated block (11 lines × 2) · ×7bitchat/Nostr/NostrEmbeddedBitChat.swift:22
Duplicated block (12 lines × 2) · ×6bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121
Duplicated block (10 lines × 2) · ×4bitchat/Nostr/XChaCha20Poly1305Compat.swift:21
Duplicated block (9 lines × 2) · ×4bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:218

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

What to do

  1. Resolve the 10 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with ChatMessageFormatter.swift (2), BLEService.swift, CommandProcessor.swift. — One of this dimension's main actionable groups (10 warning-level).
  2. Resolve the 7 Duplicated block (11 lines × 2) finding(s) in Code Duplication — start with NostrEmbeddedBitChat.swift (2), BLEService.swift, BoardStore.swift. — One of this dimension's main actionable groups (7 warning-level).
  3. Resolve the 6 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with BLEService+LinkLayerCentralRole.swift, CourierStore.swift, ChatPrivateConversationCoordinator.swift. — One of this dimension's main actionable groups (6 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 · Coupling8.4 / 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 8.4 / 10 · rule-coverage 100% · ceiling Prevented

5 production modules (Cargo+SwiftPM), 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: BitLogger

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.

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

What it measures: Whether a class's methods are focused on a single responsibility.

Method: LCOM4 cohesion per production class with at least two methods: connected components of methods sharing state or calls, computed syntactically. Deterministic, not a proxy.

Coverage: Exhaustive · type-level: LCOM4 cohesion computed over every production class — the population is all types, not a name convention.

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

5 of 148 classes have LCOM4 above 3.

Low cohesion: ChatViewModel (LCOM4 35) · ×5bitchat/ViewModels/ChatViewModel.swift:125

What to do

  1. Resolve the 5 Low cohesion finding(s) in Cohesion (LCOM4) — start with ChatViewModel.swift, XChaCha20Poly1305Compat.swift, VerificationService.swift. — One of this dimension's main actionable groups (5 warning-level).
  2. Enforce Cohesion (LCOM4) in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D8 · Code Coverage9.7 / 10Exemplary✓ Tool-verified

What it measures: How much of the code is actually exercised by tests.

Method: Coverage from coverlet runs or committed reports (Cobertura/OpenCover/lcov), computed per-file with structured exclusions for generated, trivial, and glue code. When the suite can't be built/run in-image AND no report is committed, coverage is reported NOT-MEASURED (excluded from the score) with the precondition to make it measurable — never a LoC-ratio proxy folded in as if measured. Deterministic.

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

Line coverage 71.9%. Measured from the Swift suite (.: no coverage export; localPackages/BitFoundation: no coverage export; localPackages/BitLogger: `swift test --enable-code-coverage` over 2 production file(s)).

✓ On the Gold path — maintain.

Detailed fixes: d8_recommendation.md.

D9 · Test Distribution9.6 / 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 9.6 / 10 · rule-coverage 100% · ceiling Documented

2500 test methods: 2411 unit, 17 integration, 0 BDD, 72 e2e. The Python suite contributes 20 test function(s) across 3 file(s) declaring at least one — every `def test…` in a file pytest or unittest would collect, which is those frameworks' own definition of a case; a parametrize table counts once, so this is a floor. Its tier split is read from file names and paths only.

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality9.7 / 10Stronggated by 53 serious findings✓ Tool-verified

What it measures: Whether the tests truly assert behaviour rather than just running the code.

Method: Per-test assertions, skips, and mock references analyzed via Roslyn; structured skip-reason tags (BUG:/ENV:) separate documented deferrals from debt. Deterministic.

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

0 skipped, 53 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2480 tests.

No assertions: garbagePayloadsNeverCrash · ×53bitchatTests/CashuTokenDecoderTests.swift:272

What to do

  1. Resolve the 53 No assertions finding(s) in Test Quality — start with PublicChatE2ETests.swift (12), NostrProtocolTests.swift (7), PrivateMediaEndToEndTests.swift (6). — One of this dimension's main actionable groups (53 warning-level).
  2. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D11 · Test Reliability10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether the tests pass reliably, with no flakiness.

Method: Suite re-run N times within tiered wall-clock budgets (unit to e2e); tests failing non-deterministically across runs flagged; guarded tests retried when #if guards detected.

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

0 flaky across 1 measured tier(s). Swift (3 packages): measured (0 flaky).

✓ On the Gold path — maintain.

Detailed fixes: d11_recommendation.md.

D12 · Dependency Hygiene9.9 / 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 9.9 / 10 · rule-coverage 100% · ceiling Verified

1 outdated direct SwiftPM dependencies, 0 pinning defect(s). SwiftPM has no package registry: a dependency is a repository URL and its releases are that repository's semver tags, so currency is answered by listing tags rather than by querying an index. Only a newer tag on the SAME MAJOR is reported — a `from:` requirement admits everything below the next major and nothing above it, so a major crossing needs a Package.swift edit rather than an update, and naming the update as its remedy would be wrong. Whether any dependency is DEPRECATED or ABANDONED is not graded and cannot be: a repository publishes no such marker, and there is no registry that could carry one. Known CVEs in this dependency graph are D30's question.

Outdated: swift-secp256k1

✓ On the Gold path — maintain.

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

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

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

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

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

Secret scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

What it measures: Whether the licenses of third-party packages are compatible with your policy.

Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.

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

0 of 464 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's REDACTED 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. ★ COVERAGE OF THIS VERDICT: it grades this repository's crate dependencies and nothing else. The repository also declares a Swift Package.swift/Package.resolved, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 41 serious findings✓ 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.6 / 10 · rule-coverage 100% · ceiling Documented

Top hotspots: bitchat/Services/BLE/BLEService.swift (50×32=1600); bitchat/Sync/GossipSyncManager.swift (13×37=481); bitchat/Noise/NoiseSessionManager.swift (8×54=432)

Hotspot: bitchat/Services/BLE/BLEService.swift · ×41bitchat/Services/BLE/BLEService.swift:2261

What to do

  1. Resolve the 41 Hotspot finding(s) in Churn × Complexity Hotspots — start with BLEService.swift, GossipSyncManager.swift, NoiseSessionManager.swift. — One of this dimension's main actionable groups (41 warning-level).

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

D16 · Bus Factor6.4 / 10Adequate✓ Tool-verified

What it measures: Whether knowledge is concentrated in too few people (the "bus factor").

Method: Living knowledge per author via time-decayed commit attribution (6-month half-life, focus weighting) across largest source files. Deterministic, avoids blame's mechanical-refactor false positives.

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

85 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is bitchat/Noise/NoiseSessionManager.swift. Counted over 232 of the 308 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Off-boarding risk: anonymized user #1
Further sole-owners (lower concentration)

What to do

  1. Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 Further sole-owners (lower concentration) finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).

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

D17 · Explicit Debt10.0 / 10Stronggated by 1 serious finding✓ 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

1 deducted task-comment markers across 75109 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.

TodoCommentbitchat/Services/BLE/BLEService.swift:2012

What to do

  1. Resolve the 1 TodoComment finding(s) in Explicit Debt — start with BLEService.swift. — One of this dimension's main actionable groups (1 warning-level).
  2. 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 QualityExemplary◐ 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 Exemplary / 10 · rule-coverage 100% · ceiling Documented

The repository's root README is a clear, well-structured overview of the project (a decentralized P2P app with dual transport Bluetooth mesh for offline and Nostr protocol for global reach) plus licensing, features list, and links to architecture docs. The bitchatTests/README documents its own directory (an in-memory networking test harness), while the companion BLE-Transport-Architecture-V3.md covers a detailed architectural design pass that is itself well written. All four READMEs are present and complete within their scope; the only unshown section is clipped by the scanner, so no missing-section claims apply. The project's documentation is comprehensive: the README for each repository (PUSH-TO-TALK-DESIGN.md, REQUEST_SYNC_MANAGER.md, SERVICE-UUID-DETECTABILITY.md, SOURCE_ROUTING.md, TOR-INTEGRATION.md, and VERIFYING-A-BUILD.md) covers its scope, goals, existing work, wire protocol, new components, security rationale, and a concrete verification process. The architecture/Docs set (14 markdown files) provides the full design and implementation depth for each tier of the system.

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

D20 · ADR Quality0.0 / 10Critical✓ Tool-verified

What it measures: Whether architecture decisions are recorded well (context, decision, consequences).

Method: 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 ConsistencyStronggated by 2 serious findings◐ 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 Strong / 10 · rule-coverage 100% · ceiling Verified

2 API inconsistencies across 30 exposed types.

Ambiguous overlap in lifecycle management. 'startIfNeeded' implies a general check-and-start, while 'ensureRunningOnForeground' implies a state-dependent action triggered by foregrounding. It is unclear if 'ensureRunningOnForeground' calls 'startIfNeeded' or if they are mutually exclusive entry points. This creates confusion about the correct API to use when the app transitions to the foreground.
Redundant method signatures. Having two methods with the same name differing only by a default parameter for padding is acceptable in Swift, but if 'padding' is a rarely used or internal concern, it clutters the public API. More importantly, if 'toBinaryData()' always pads, the overload is redundant. If it conditionally pads, the naming is inconsistent with the 'forSigning' variant.

What to do

  1. Resolve the 1 Ambiguous overlap in lifecycle management. 'startIfNeeded' implies a… finding(s) in Internal API Consistency. — One of this dimension's main actionable groups (1 warning-level).
  2. Resolve the 1 Redundant method signatures. Having two methods with the same name… 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 Cohesion6.0 / 10Adequate✓ 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 6.0 / 10 · rule-coverage 100% · ceiling Documented

1 of 5 build units (Cargo, SwiftPM) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion

What to do

  1. Resolve the 1 Projects may be oversized for their cohesion 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)7.1 / 10Adequategated by 15 critical findings✓ 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 7.1 / 10 · rule-coverage 100% · ceiling Documented

15 finding(s): 0 critical, 15 high, 0 medium, 0 low. 13 unpinned-GitHub-Actions row(s) are reported here but scored by D36 (supply-chain provenance), which measures that posture as `pinned_actions` — one pinning decision is charged once, not once per lens. semgrep hit a parse error in 1 file(s) — `bitchatTests/ChatViewModelExtensionsTests.swift` (line 66, line 67, line 85, …) — 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 3 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

What to do

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

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

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

What it measures: Whether any dependency has a known published vulnerability (CVE), direct or transitive, in ANY ecosystem the repository declares — Dart pub, Elixir and Erlang via Hex, Go modules, Java and Kotlin via Maven/Gradle, JavaScript/npm, .NET/NuGet, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift.

Method: Dependency-CVE scan across every ecosystem the repository declares, scored ONCE. Three sources are unioned and deduplicated by advisory identity (rule id + alias closure, CVE<->GHSA) scoped to package+version, keeping the worst severity: `osv-scanner --recursive` over osv.dev for Dart pub, Elixir/Hex (and Erlang, whose `rebar.lock` syft first converts to a CycloneDX SBOM the scanner reads, with rows attributed back to the lock), Go, Java and Kotlin via Maven/Gradle (and Scala, whose sbt build's pinned direct declarations are written into a CycloneDX SBOM the scanner reads, with rows attributed back to the build file), npm, PHP/Composer, Python/PyPI, RubyGems, Rust/Cargo and Swift; `trivy fs --scanners vuln` for npm lockfiles; and `dotnet list package --vulnerable --include-transitive` for NuGet (with per-advisory collapse of the project x target-framework fan-out), plus a DECLARED-dependency arm that resolves a published gem's gemspec against rubygems.org where no Gemfile.lock is committed. `SeverityScore(c,h,m,l, normalizer 8.0)`. NotApplicable only when NO ecosystem is readable; if any applicable ecosystem could not be scanned the findings are REPORTED and the score is withheld. Supersedes the npm and OSV arms, retired 2026-09-05.

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

15 finding(s): 0 critical, 1 high, 14 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

D34 · Knowledge Freshness9.8 / 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 9.8 / 10 · rule-coverage 100% · ceiling Documented

4 of 232 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is bitchat/Views/Image Viewers/ImagePreviewView.swift. Counted over 232 of the 308 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned file · ×4bitchat/Views/Image Viewers/ImagePreviewView.swift:1
Orphaned files with no living knowledge

✓ On the Gold path — maintain.

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

D35 · Change Coupling9.5 / 10Adequategated by 3 critical 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.5 / 10 · rule-coverage 100% · ceiling Documented

Strongest change-coupling: NoiseSession.swift↔NoiseEncryptionService.swift 67%; ContentView.swift↔MeshPeerList.swift 67%; ContentView.swift↔ShareViewController.swift 62%

Boundary-crossing change coupling: ContentView.swift ↔ ShareViewController.swift · ×3bitchat/Views/ContentView.swift:1
Change coupling: NoiseSession.swift ↔ NoiseEncryptionService.swift · ×2bitchat/Noise/NoiseSession.swift:1
Change-coupling hub: ContentView.swift → BitchatPeer.swift, GeohashPeopleList.swift, MeshPeerList.swiftbitchat/Views/ContentView.swift

What to do

  1. Resolve the 3 Boundary-crossing change coupling finding(s) in Change Coupling — start with ContentView.swift, BitchatApp.swift, ChatViewModel.swift. — One of this dimension's main actionable groups (3 issue-level).
  2. Resolve the 2 Change coupling finding(s) in Change Coupling — start with NoiseSession.swift, BLEService.swift. — One of this dimension's main actionable groups (2 warning-level).
  3. Resolve the 1 Change-coupling hub finding(s) in Change Coupling — start with ContentView.swift. — One of this dimension's main actionable groups (1 warning-level).

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

D36 · Supply-chain Provenance & Signing5.0 / 10Adequate✓ 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 5.0 / 10 · rule-coverage 100% · ceiling Documented

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

What to do

  1. Resolve the 3 REDACTED finding(s) in Supply-chain Provenance & Signing — start with REDACTED, REDACTED, REDACTED. — One of this dimension's main actionable groups (3 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 recommendation-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

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

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. 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.

Frontend & cross-cutting dimensions

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

AX10 · Code composition9.7 / 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.

AX8 · Test isolation10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — Whether production projects stay free of references to test projects — tests may depend on production, never the reverse.

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. 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.

ED1 · Handler temporal coupling1.0 / 10Critical✓ Tool-verified

Other · Event-Driven — Whether event/message handlers avoid synchronous blocking waits — a blocking wait inside a handler stalls throughput and risks deadlock.

Method: Roslyn semantic scan (event-driven gated): event-handler bodies scanned for HTTP/gRPC invocations by resolved symbol type, not substring. Deterministic, semantic-resolved.

  • `NoiseSession.processHandshakeMessage` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — bitchat/Noise/NoiseSession.swift:83
  • `NoiseSessionManager.handleIncomingHandshakeWithResult` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — bitchat/Noise/NoiseSessionManager.swift:540
  • `NoiseEncryptionService.handleSessionEstablished` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — bitchat/Services/NoiseEncryptionService.swift:1038
  • `PTTCaptureEngine.handleInterruption` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — bitchat/Features/voice/PTTCaptureEngine.swift:264
  • `BLEService.onEngine` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler. — bitchat/Services/BLE/BLEService.swift:405

What to do

  • Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
ED4 · Outbox / dual-write8.0 / 10Strong✓ Tool-verified

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

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

  • `GossipSyncManager._onPublicPacketSeen` performs two independent DURABLE writes — `messages` (a persistence store) via `insert` and `fragments` (a persistence store) via `insert` — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox). — bitchat/Sync/GossipSyncManager.swift:294

What to do

  • Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
M1 · Documentation (README)8.0 / 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 README to the 4 of 4 project(s) that lack one — worth up to 2 pts.
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 your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure10.0 / 10Exemplary✓ Tool-verified

Maturity · Maturity — Whether the 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 accuracy9.3 / 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.

  • docs/CONVERSATION-STORE-DESIGN.md names `bitchat/ViewModels/PublicTimelineStore.swift`, but no file or folder `bitchat/ViewModels/PublicTimelineStore.swift` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/CONVERSATION-STORE-DESIGN.md:129
  • docs/GeohashPresenceSpec.md documents the environment variable `GEOHASH_PRESENCE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/GeohashPresenceSpec.md:11
  • docs/PEER-ID-ROTATION.md documents the environment variable `TAG_SLOTS`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/PEER-ID-ROTATION.md:214
  • docs/PUSH-TO-TALK-DESIGN.md names `bitchat/Services/PTT/`, but no file or folder `bitchat/Services/PTT` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/PUSH-TO-TALK-DESIGN.md:143
  • docs/REQUEST_SYNC_MANAGER.md documents the environment variable `IS_RSR`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/REQUEST_SYNC_MANAGER.md:17
  • docs/SOURCE_ROUTING.md documents the environment variable `HAS_RECIPIENT`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong. — docs/SOURCE_ROUTING.md:46

What to do

  • Reconcile the README with reality: docs/CONVERSATION-STORE-DESIGN.md names `bitchat/ViewModels/PublicTimelineStore.swift`, but no file or folder `bitchat/ViewModels/PublicTimelineStore.swift` exists; docs/GeohashPresenceSpec.md documents the environment variable `GEOHASH_PRESENCE`, but no code, script or configuration file names it; docs/PEER-ID-ROTATION.md documents the environment variable `TAG_SLOTS`, but no code, script or configuration file names it; docs/PUSH-TO-TALK-DESIGN.md names `bitchat/Services/PTT/`, but no file or folder `bitchat/Services/PTT` exists; docs/REQUEST_SYNC_MANAGER.md documents the environment variable `IS_RSR`, but no code, script or configuration file names it.
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.

P10 · Library API & versioning6.0 / 10Adequate✓ Tool-verified

Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.

Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.

  • 27/35 types (77%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.

What to do

  • Keep implementation types off the public surface (Rust: `pub(crate)`, or keep the module private; Swift: leave it `internal` (the default) instead of `public`) so internals can change without breaking consumers.
P2 · Observability8.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

  • Add OpenTelemetry tracing/metrics (swift-otel with swift-distributed-tracing) so requests are traceable across the system, not just health-probable.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 37496 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.

What to do

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

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

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene5.0 / 10Adequate✓ 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.

  • No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)

What to do

  • Keep a changelog (e.g. Keep-a-Changelog) recording what shipped in each release.
PF2 · Allocation hygiene6.5 / 10Adequate✓ Tool-verified

Readiness · Performance — Whether the code is written to minimise allocations so it doesn't pressure its host's memory manager — buffer/slice views over copies, object pooling, stack or value-type allocation, and buffer writers. Reward-only: credited where present, never penalised where a simpler style is fine.

Method: Production-source scan: density (per 1k LoC) of allocation-aware APIs — in .NET Span/Memory, ArrayPool/ObjectPool, stackalloc, ValueTask, value-type structs, IBufferWriter, string.Create, SkipLocalsInit; off .NET, with comments and strings blanked, Go's sync.Pool, preallocated slices/maps, Grow, strconv.Append* and buf[:0] reuse; the JVM's NIO buffer views, MemorySegment, primitive collections, pools and literal presizes (plus Kotlin primitive arrays and value classes, Scala AnyVal and @specialized); Swift's reserveCapacity, ContiguousArray, withUnsafe* access and ~Copyable. Activated off .NET on the same floor (400 lines, and benchmarks or 8 uses); Rust and garbage-collected scripting languages are not applicable. Reward-only. Deterministic, syntax/text detection.

What to do

  • Raise allocation-aware density on the hot paths — currently 76 use(s) across 82,991 production line(s) (~0.9/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Swift: on hot paths, reserveCapacity before appending, use ContiguousArray for class-element arrays, work in place with withUnsafeBufferPointer/withUnsafeTemporaryAllocation, and make large values ~Copyable with borrowing/consuming parameters.
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, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the code avoids sync-over-async (deadlock-prone blocking on tasks) and async void.

Method: Roslyn syntax scan: async methods scanned for .Wait()/.GetAwaiter().GetResult() and async-void outside event handlers. Deterministic, hard fact per invocation.

X12 · Unreachable branch10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether any branch is dead by construction — a switch arm whose label can never equal a case-normalised subject, or an `else if` whose predicate the arm above has already swallowed.

Method: Roslyn syntax + semantics: switch labels compared against the subject's own case normaliser, and if/else-if chains checked for a literal an earlier arm's containment test already swallows. Deterministic, provable per finding. Advisory.

X13 · Undrained process stream10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a child process that has BOTH standard streams redirected drains both — reading one to the end while the other is never read deadlocks once the child fills the unread pipe.

Method: Roslyn syntax + semantics: ProcessStartInfo launches with both streams redirected, checked for a drain of each stream across the enclosing type. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `spawn` imported from `child_process` whose stdout and stderr are both pipes (no options, no `stdio`, or `stdio` of `'pipe'`), bound to a local that never leaves its scope, where exactly one of the two streams is read, the other never, and the child’s `close`/`exit` (or the read stream’s end) is awaited; a shell redirect in the call’s arguments or a `kill` of the child suppresses it. The same rule reads Python’s `subprocess.Popen`, Dart’s `Process.start`, Ruby’s `Open3.popen3`, and Scala’s JDK process starts (`new ProcessBuilder(…).start()` with no `redirectErrorStream`/`redirectError`/`redirectOutput`/`inheritIO`, `Runtime.getRuntime.exec`) where one of `getInputStream`/`getErrorStream` is read and the other never while `waitFor()` is called or the read stream is read to its end. Deterministic, provable per finding. Advisory.

X14 · Bypassable address classification10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a hand-rolled public/private IP check can be walked past — a method that unwraps IPv4-mapped IPv6 but returns the opposite verdict for the same host written as IPv4-compatible, 6to4 or NAT64.

Method: Roslyn syntax + semantics: methods that unwrap IPv4-mapped IPv6 and hand-roll IPv4 range carve-outs, checked for whether the IPv6 branch also accounts for the IPv4-compatible, 6to4 and NAT64 embeddings. Deterministic, provable per finding. Advisory.

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

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

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

X17 · Uncapped recursion over a caller-supplied document10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether a walk that recurses through a JSON/XML tree handed in by its caller bounds how deep it will go — an uncapped walk lets the document's nesting choose the stack depth, and the resulting StackOverflowException cannot be caught.

Method: Roslyn syntax + semantics: methods that take a JSON/XML document node and call themselves with a child of it, reachable from an externally-callable member of the same type that accepts a document, checked for any depth parameter, descent counter or threaded arithmetic anywhere in the walk. On a repository with no .NET source it reads TypeScript off the engine’s own token stream (test, vendored, generated and minified paths and `.d.ts` not) with the same rule: a function or method with a parameter typed as a document value — `unknown`, `any`, `object`, `Record<string, unknown|any>`, a JSON alias (`JsonValue`, `JSONObject`, …) or a DOM node global the file does not rebind — that calls itself (bare, or through `this` for a method, or hands itself to a call over the value as in `value.map(walk)`) with something it took out of that value and never through an ancestor accessor such as `closest()` or `parentElement`, that is exported or reached from an exported function (a public method of the same exported class) taking such a value, and that names no depth, level, nesting, recursion, remaining or budget anywhere and threads no `+`/`-` arithmetic through a self-call. Plain JavaScript is not read: with no annotation nothing tells a parsed document from a tree the code built itself. Deterministic, provable per finding. Advisory.

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

Other · Code Health — Whether a method that temporarily changes state belonging to the whole process — the working directory, an environment variable — puts it back on EVERY path: a restore reached only when nothing throws leaks the change to the rest of the process.

Method: Roslyn syntax + semantics: method bodies that write the process working directory or an environment variable and write it back in the same body, checked for whether that restore sits in a `finally`/`catch` or only on the straight-line path. On a repository with no .NET source the same rule reads production JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not): `process.chdir`, `process.env.NAME =`/`["NAME"] =` and `delete process.env.NAME`, and Deno’s `Deno.chdir`/`Deno.env.set`/`Deno.env.delete`, paired per function body (a nested function or arrow is its own body, and module top-level code is none), where the last write puts back a local the body captured from the same global or deletes a variable the first write set, with at least one statement between them; a write in a `catch`/`finally` of that body silences it. Deterministic, provable per finding. Advisory.

X21 · Side-effecting pattern guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `when` guard is free of side effects — a guard that increments a counter or assigns while deciding whether its arm matches applies that change during PATTERN MATCHING, on an arm that may not be selected, and skips it entirely when a short-circuit to its left answers first.

Method: Roslyn syntax: `when` guards on case labels and switch-expression arms, read for a mutation (`++`/`--`/assignment) sitting in a position the guard's own `&&`/`||`/`??`/`?:`/`?.` can skip. Deterministic, provable per finding. Advisory.

X22 · Contradicted release guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a method that TAKES a lock or semaphore and gives it back from a flag-guarded `finally` returns the value that flag implies — reporting success while the guard hands the primitive back admits a second caller the exclusion was there to keep out, and reporting failure while the guard keeps it leaves nothing to ever give it back.

Method: Roslyn syntax: `try` statements whose `finally` releases a synchronisation primitive under a bare local-bool guard, where the method also TOOK that same primitive before the `try`, checked for a `return` of a bool literal whose value disagrees with the flag state the method's own straight-line assignments put it in. Deterministic, provable per finding. Advisory.

X23 · Unguarded diagnostic materialisation10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether the work a diagnostic log line costs is paid only when that line is wanted — C# evaluates a call's arguments BEFORE the call, so a trace/debug message joined or projected out of a collection is built in full on every pass, and then discarded by a sink the shipped configuration leaves switched off.

Method: Roslyn syntax: log calls at a diagnostic level (a `Log`-prefixed method naming Trace/Debug/Verbose, or a bare `Debug`/`Trace`/`Verbose` on a receiver named for a logger), whose argument list is read for a call whose cost scales with a sequence — a LINQ operator, a materialisation, `string.Join`, a serializer — with no enclosing level check or conditional-compilation region. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `debug`/`trace`/`verbose` call on a receiver named for a logger, or a `log`-prefixed method naming the level, whose argument calls an array operator (`map`/`filter`/`reduce`/`sort`/…), `Array.from`, `Object.keys/values/entries`, `JSON.stringify`/`util.inspect` over anything but a literal, or an array `join` — outside any arrow or function passed as an argument, which the logger calls only when the level is on — with no enclosing `if`, `&&` or `?:` whose condition names a level, a level string, or the `NODE_ENV`/`__DEV__`/`DEV` build switch. Deterministic, provable per finding. Advisory.

X24 · Document value interpolated into markup unescaped10.0 / 10Exemplary○ Nothing flagged

Other · Security — Whether text read out of the document being converted is escaped before it is written into generated markup — a value the document's author chose, interpolated into an attribute the surrounding literal delimits, can close that attribute and open another.

Method: Roslyn semantic model over the whole compilation: a string-typed `Value`/`InnerText`/`InnerXml`/`Text` member declared inside `DocumentFormat.OpenXml` or `System.Xml` is a taint SOURCE, propagated through assignments, returns, arguments, tuple elements and string composition to its transitive closure, then read at interpolated-string holes that sit in a markup position the surrounding literal itself delimits. Escaper/encoder calls and enclosing validator conditions cut the flow. Flow- and container-insensitive by construction. A second arm needs no provenance at all and reports a type that CONTRADICTS ITSELF — the same expression escaped at one delimited markup hole and interpolated raw at another hole in the same markup position of the same type, which the type's own escaping proves is a defect without knowing where the value came from. On a repository with no .NET source it reads JavaScript/TypeScript off the token stream with the same rule: a DOM read of raw document text (`getAttribute`, `textContent`, `innerText`, `nodeValue`) is the source, propagated through local bindings and string composition, and judged at template-literal and concatenation holes in the same two delimited markup positions; escapers and validating conditions cut it, and documentation-site, test, vendored and minified scripts are not read. Deterministic, provable per finding. Advisory.

X25 · Inert configuration knob10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value the caller is invited to supply is the value the type actually uses — a constructor parameter stored in a private field that nothing ever reads while the default it was given is spelled out a second time at the site that should have read it, a keyed lookup that falls back to a different setting than the one its key names while the same type falls back to the matching one for that same key, or a culture-sensitive parse given no format provider by a type that feeds its own settable culture to the same kind of parse elsewhere, or a number an entry point writes to standard output under the host's culture while the same entry point formats with the invariant culture elsewhere. Either way, every caller who supplies a value silently gets something else.

Method: Roslyn syntax: private instance fields of a non-partial type assigned in a constructor from one of its own parameters with a `??` fallback, checked for whether anything in the type body reads the field and whether that same fallback expression is spelled out again outside the constructor; and `??` fallbacks onto a member access from a lookup call carrying exactly one string literal, grouped by that key across the type and checked for a fallback member whose folded name disagrees with the key while a sibling site for the same key agrees with it. On a repository with no .NET source the first two arms read JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `#x`, `private` or `private` parameter-property instance field filled in the constructor from a parameter (or one member of one) through `??`/`||` or a parameter default, never read anywhere in the file by name, whose constructed default is spelled again in the class body; and `lookup("key") ?? s.member` grouped by key per class, or per module outside every class. The culture arm has no JavaScript counterpart: its parses take no locale. Deterministic, provable per finding. Advisory.

X26 · Unsynchronised callback handoff10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a value handed from a callback to the body that waits on it crosses on something built to be crossed — a `Queue<T>`/`List<T>`/`Dictionary<K,V>` written inside an event handler and read back outside it is mutated by two flows at once, and the semaphore or completion source beside it orders how MANY items exist while leaving the collection's own head, tail and backing array unprotected.

Method: Roslyn syntax: method, accessor, local-function and lambda bodies that declare BOTH a non-thread-safe generic collection (`Queue`/`Stack`/`List`/`Dictionary`/`HashSet`/`Sorted*`/`LinkedList`) and a synchronisation primitive (`SemaphoreSlim`/`TaskCompletionSource`/`ManualResetEvent(Slim)`/`AutoResetEvent`/`CountdownEvent`) as locals, then read for a `+=`-registered lambda that raises that primitive while the body outside every lambda waits on it — and, in that scope, a mutating call on the collection inside the lambda paired with a mention of it outside. Any `lock` in the scope abstains it. On a repository with no .NET source the same handoff is read in Java off the engine’s own token stream (test source sets, vendored and demonstration paths not): an `ArrayList`/`LinkedList`/`ArrayDeque`/`PriorityQueue`/`Hash*`/`LinkedHash*`/`Tree*` local and a `CountDownLatch`/`Semaphore`/`CompletableFuture` local, a lambda or anonymous class that raises the primitive and mutates the collection, and a wait outside it; any `synchronized` or `lock()` abstains the body. Because each of those primitives orders what the callback wrote before raising it, only a touch that provably overlaps the callback is convicted: one after the registration and before the next wait, or one in a loop registered-before, waiting on every pass and not declaring the collection. Deterministic, provable per finding. Advisory.

X27 · Collection changed while being enumerated10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a `for` loop leaves the `RefCell` it is walking alone — safe Rust rejects a body that changes the collection its loop borrows at compile time, except through interior mutability: a `RefCell` borrowed in the loop's header stays borrowed until the loop ends, so a `borrow_mut()` of it inside the body panics with `already borrowed: BorrowMutError` and the remaining elements are never seen. Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

Method: Roslyn syntax + semantics: `foreach` statements whose body calls a structural mutator (`Add`/`Remove`/`Clear`/`Insert`/…) on the very expression the loop is enumerating. Two arms. ARM A — the source is a concrete fragile BCL collection, or a live `Keys`/`Values` view over one, and the mutator resolves to that same collection's own member; concurrent and immutable collections and arrays are outside the population by construction, since their enumerators survive a structural change. ARM B — the source is an argument-less accessor CALL on a receiver whose body is in source: the accessor must return a stored field VERBATIM and a sibling member must structurally change that same field, both read off the implementations rather than from the members' names. A mutation the loop provably exits immediately after (`break`/`return`/`throw`/`goto`), or one written inside a nested loop or a lambda, is counted and never reported. Deterministic, provable per finding. Advisory.

X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.

Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.

X29 · Per-element action decided by a fixed element10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a decision taken once per element is taken ABOUT that element — a test inside a counted loop that reads a fixed subscript of the very collection its guarded statement indexes by the loop variable applies element zero's answer to all of them, so the elements that differ from it are all handled wrongly, and in the same direction.

Method: Roslyn syntax only, no semantic model: every `for` statement declaring exactly ONE loop variable, and every `if` inside its body that is not under a nested loop or a lambda. A site enters the population when the `if`’s condition never mentions the loop variable while the statement it guards indexes some collection by that variable ALONE (`c[i]`; `c[i + 1]` and `c[i, j]` are outside it). A finding additionally needs the AGREEING TWIN at the same-collection grain: the condition must read THAT SAME collection at a subscript that does not move — written into the condition, or reached through a local declared BEFORE the loop, so an alias bound inside the body is not followed. Both collection expressions must be simple identifiers. On a repository with no .NET source the same rule reads JavaScript/TypeScript off the engine’s own token stream (tests included, bundles and vendored paths not): a `for (let|var|const x = …; …; …)` with one declarator and a braced body, an alias followed only when it is declared before the loop in a block that encloses it and never assigned inside the loop. Deterministic, provable per finding. Advisory.

X3 · Exception handling6.8 / 10Adequate✓ Tool-verified

Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.

Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.

  • `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. (×7) — bitchat/Models/BitchatMessage+Media.swift:29, bitchat/Nostr/GeoRelayDirectory.swift:137, bitchat/Services/NoiseEncryptionService.swift:1135, …

What to do

  • Swallowed exception (caught, then discarded)
X30 · Support guard that admits what it rejects10.0 / 10Exemplary○ Nothing flagged

Other · Code Health — Whether a guard written as a NEGATED `||` says what its author meant — `!(a || b || x != k)` is `!a && !b && x == k` by De Morgan, so a bail-out that mixes capabilities the code needs with a fault it refuses turns inside out: it fires only where the capabilities are ABSENT, and lets every value the fault term names walk straight into the body that cannot handle it.

Method: Roslyn syntax only, no semantic model: every logical-not whose operand is a parenthesised `||` chain of two or more disjuncts, flattened (a left-nested `a || b || c` read once would see `(a || b)` as one disjunct). A site enters the population on that shape alone. A finding additionally needs the disjuncts to DISAGREE in polarity: at least one bare boolean read — an identifier or member access, never an invocation, which is a predicate rather than a capability flag — and at least one `x != <constant>`, the only form that negates into an exact-value pin (`== null` negates into a looser requirement and is outside the fault set). Consistently-polarised disjunctions, all-fault or all-capability, are counted and never reported; a negated `&&` is outside the population entirely. No same-receiver gate: it was measured to cost a real defect and remove no false positive. Deterministic, provable per finding. Advisory.

X4 · Structured logging1.9 / 10Critical✓ Tool-verified

Other · Code Health — Whether log calls use message templates (queryable) rather than interpolated strings.

Method: Roslyn syntax scan: every log call-site counted; interpolated-string first-argument violations flagged. Population is all log calls, not estimated. On a repository with no .NET source it reads JavaScript/TypeScript off the engine’s own token stream (test, vendored and minified paths not) with the same rule: a `trace`/`debug`/`info`/`warn`/`error`/`fatal`/`verbose`/`silly`/`http`/`log` call on a receiver named for a logger, in a package whose own or an enclosing `package.json` declares a logger that carries values as fields (pino, pino-http, nestjs-pino, Fastify, winston, bunyan, tslog, LogTape, roarr), whose first deciding argument is a template literal with substitutions; an object-literal fields argument is stepped over, a plain string message clears the call. Python is read the same way: a `debug`/`info`/`warning`/`error`/`exception`/`critical`/`log` call on a logger in a file that imports the standard library’s `logging` or structlog (loguru, which formats at the call, is not judged), whose message is a whole f-string with a non-constant field; a `%`-formatted, `.format()`-ed or concatenated message is not convicted, as in C#. PHP is read the same way: a PSR-3 level call (`emergency`…`debug`, `log`) on a logger (`$logger`, `$this->logger`, Laravel’s `Log::`, `logger()`, `\Drupal::logger()`) in a package whose `composer.json` requires a PSR-3 logger or a framework that hands one out (psr/log, Monolog, Laravel, Symfony, Drupal, CakePHP), or a file that imports one, whose message is a double-quoted string interpolating a variable; a single-quoted message clears the call, and `sprintf` or `.` concatenation is not convicted, as in C#. Dart is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on Sentry’s structured logger (`Sentry.logger`) whose message is a whole string literal interpolating a value (`$name`, `${…}`); the `Sentry.logger.fmt` template API clears the call. Dart that logs only through loggers with one message and no fields (package:logging, package:logger, talker, dart:developer) is not applicable rather than a reach gap. Ruby is read the same way: a `trace`/`debug`/`info`/`warn`/`error`/`fatal` call on the console gem’s `Console` (declared by a Gemfile, gemspec or Gemfile.lock, or required) or, where SemanticLogger, Ougai or dry-logger is declared or required, on a receiver named for a logger (`logger`, `@logger`, `Rails.logger`, `log`), whose first deciding argument is, as the whole argument, a double-quoted string interpolating a non-constant value (`#{…}`, `#@ivar`); a plain literal clears the call, keyword arguments are the fields, and a block, `%`-format or `+` concatenation is not convicted. Ruby that logs only through the standard Logger (Rails.logger) is not applicable rather than a reach gap. Deterministic.

  • `debug!` at line 130 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/socks.rs:130
  • `debug!` at line 137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/socks.rs:137
  • `debug!` at line 149 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/socks.rs:149
  • `debug!` at line 185 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/socks.rs:185
  • `debug!` at line 190 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/socks.rs:190
  • `error!` at line 105 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/lib.rs:105
  • `info!` at line 286 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/lib.rs:286
  • `debug!` at line 297 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/lib.rs:297
  • `warn!` at line 302 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`. — localPackages/Arti/arti-bitchat/src/lib.rs:302

What to do

  • Interpolated log message defeats structured logging

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 Health59%Adequate — gated by D2, X4Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture94%ExemplaryStrongest area.
Maturity65%Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness49%Weak — gated by P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security81%StrongSolid.
Event-Driven40%Weak — gated by ED1Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance80%StrongSolid.
Unscored — 2 check(s) recorded observations but carry no score

These checks ran and found something, but they do not carry a score — either by design (an advisory check reports evidence rather than grading it) or because they could not be scored here. They are excluded from the score for that reason, not because there was nothing to see.

  • X10 Duplicated predicate — 11 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 2 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 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.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 51 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 — No container singleton was found, so there is no shared instance for concurrent requests to race on. No function in this Python code is served by a threaded web framework (a Flask, Bottle or FastAPI route, a Django or Pyramid view), so no module is shared between request threads. No Swift request handler (a Vapor, Hummingbird, Kitura, Swifter or Perfect route handler, as a method or a registered closure) is declared, so no state is shared between request threads. Rust's compiler refuses unsynchronised shared mutation — a value shared across threads must be Sync — so the race this check looks for cannot be written.
  • 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
  • AXB1 Runtime evidence locked — no reproducible boot — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • 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, nor 2+ projects each declaring an entity of their own. 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 — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.swift), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 15 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D44 Platform End-of-Life — Platform end-of-life not assessed — this repository declares no platform this pass reads
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (2 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 this analysis resolves a call's owner only where the receiver's type is written down in the source. Reported as guidance rather than measured
  • 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 — no mutating command handlers or message consumers detected — idempotency check not applicable
  • ES1 Event Sourcing — not scored — this repository shows none of the 3 signals this lens looks for
  • GD1 Unfinished & placeholder code — no source files were read — this check reads C#, F#, JavaScript/TypeScript, Dart, Ruby and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — this card publishes what the CI gate does with the test inventory rather than grading it. The findings above are its output.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python, Rust, Swift 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 — coverage data present for 2 file(s), but no domain-layer files were identified: no covered file's path contains any of the markers this check keys on (/domain/, /aggregates/, /valueobjects/, /domainmodel/, .domain/, /entities/), which are matched case-insensitively anywhere in the path. With no domain partition there is nothing to compare the web/controller layer against — if this repository keeps its business rules under a folder named none of those, that naming is what the check cannot see, not the domain logic.
  • PF1 Benchmark discipline — Not applicable: no benchmark suite was found. This check searched for `Benchmark("…")` in a file importing package-benchmark, or package-benchmark in Package.swift, and for a `*benchmark*` script that this repository's CI runs. Benchmarks are credited as a bonus, so their absence is neither scored nor deducted.
  • 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.
  • X16 Unfloored truncation loop — 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
  • X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • 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 — 25 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
ED1 · Handler temporal coupling · Blocking wait inside a handler · ×5
  • Blocking wait inside a handler: NoiseSession.processHandshakeMessage bitchat/Noise/NoiseSession.swift:83 — `NoiseSession.processHandshakeMessage` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: NoiseSessionManager.handleIncomingHandshakeWithResult bitchat/Noise/NoiseSessionManager.swift:540 — `NoiseSessionManager.handleIncomingHandshakeWithResult` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: NoiseEncryptionService.handleSessionEstablished bitchat/Services/NoiseEncryptionService.swift:1038 — `NoiseEncryptionService.handleSessionEstablished` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: PTTCaptureEngine.handleInterruption bitchat/Features/voice/PTTCaptureEngine.swift:264 — `PTTCaptureEngine.handleInterruption` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
  • Blocking wait inside a handler: BLEService.onEngine bitchat/Services/BLE/BLEService.swift:405 — `BLEService.onEngine` is an event/message handler that blocks on a synchronous wait (a semaphore/queue `.wait`/`.sync`) — it stalls the handler on a peer or resource and serialises throughput, and can deadlock under load. Await the work asynchronously (`async`/`await`) instead of blocking the handler.
D35 · Change Coupling · Boundary-crossing change coupling · ×3
  • Boundary-crossing change coupling: ContentView.swift ↔ ShareViewController.swift bitchat/Views/ContentView.swift:1 — `bitchat/Views/ContentView.swift` (context bitchat) and `bitchatShareExtension/ShareViewController.swift` (context bitchatShareExtension) sit in DIFFERENT parts of the tree yet change together 62% of the time (8 of the 13 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `bcb21f21` Require review before importing shared content (#1430); `d01538a2` Fix Localizations (#684); `a7d5b2d7` Centralize remaining magic numbers; finalize logging hygiene across U… — run `git show` on any of them.
  • Boundary-crossing change coupling: BitchatApp.swift ↔ ShareViewController.swift bitchat/BitchatApp.swift:1 — `bitchat/BitchatApp.swift` (context bitchat) and `bitchatShareExtension/ShareViewController.swift` (context bitchatShareExtension) sit in DIFFERENT parts of the tree yet change together 62% of the time (8 of the 13 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 8 shared commits counted here, the most recent 3 are `bcb21f21` Require review before importing shared content (#1430); `7c4bde59` Xcode Configuration files: `.xcconfigs` + Remove `xcodegen` (#608); `a7d5b2d7` Centralize remaining magic numbers; finalize logging hygiene across U… — run `git show` on any of them.
  • Boundary-crossing change coupling: ChatViewModel.swift ↔ ShareViewController.swift bitchat/ViewModels/ChatViewModel.swift:1 — `bitchat/ViewModels/ChatViewModel.swift` (context bitchat) and `bitchatShareExtension/ShareViewController.swift` (context bitchatShareExtension) sit in DIFFERENT parts of the tree yet change together 54% of the time (7 of the 13 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) — the bounded-context boundary may be in the wrong place, or one context is leaking into the other. This is the behavioural boundary violation a static scan can't see. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `bcb21f21` Require review before importing shared content (#1430); `d01538a2` Fix Localizations (#684); `a7d5b2d7` Centralize remaining magic numbers; finalize logging hygiene across U… — run `git show` on any of them.
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · High CVE · ×1
  • REDACTED
ED4 · Outbox / dual-write · Dual write (no outbox) · ×1
  • Dual write (no outbox): GossipSyncManager._onPublicPacketSeen bitchat/Sync/GossipSyncManager.swift:294 — `GossipSyncManager._onPublicPacketSeen` performs two independent DURABLE writes — `messages` (a persistence store) via `insert` and `fragments` (a persistence store) via `insert` — in one command path with no shared transaction or outbox. A crash between the two leaves the stores diverged (one write committed, the other lost) or emits a phantom record. Wrap both in one transaction, or record the second write in the same store and dispatch it afterwards (a transactional outbox).
Serious — 525 finding(s)
D10 · Test Quality · No assertions · ×53
  • No assertions: garbagePayloadsNeverCrash bitchatTests/CashuTokenDecoderTests.swift:272 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: stateNamingTheStoredCreatorWithAnotherSigningKeyIsRejected bitchatTests/ChatGroupCoordinatorContextTests.swift:203 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: nonCreatorRosterOmittingUsDoesNotDeleteTheGroup bitchatTests/ChatGroupCoordinatorContextTests.swift:225 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: staleCreatorStateIsRejectedIncludingStaleRemoval bitchatTests/ChatGroupCoordinatorContextTests.swift:280 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: concurrentMixedOperations bitchatTests/MessageDeduplicationServiceTests.swift:539 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptionFailsWithWrongRecipient bitchatTests/NostrProtocolTests.swift:92 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptRejectsAlternateInnerTagShapes bitchatTests/NostrProtocolTests.swift:138 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptRejectsOversizedCiphertextBeforeDecoding bitchatTests/NostrProtocolTests.swift:227 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptDoesNotMisinterpretStandardNIP44Payload bitchatTests/NostrProtocolTests.swift:252 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptRejectsWrongOuterKind bitchatTests/NostrProtocolTests.swift:276 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptRejectsInvalidSealSignature bitchatTests/NostrProtocolTests.swift:300 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: decryptRejectsSealRumorPubkeyMismatch bitchatTests/NostrProtocolTests.swift:317 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: verificationViews_renderCoreBranches bitchatTests/ViewSmokeTests.swift:301 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: deinitReleasesSessionAndStopsPlayback bitchatTests/VoiceNotePlaybackControllerTests.swift:109 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: prepareFailureCleansUpAndAllowsTheNextRecording bitchatTests/VoiceRecorderTests.swift:254 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: recordFailureCleansUpAndAllowsTheNextRecording bitchatTests/VoiceRecorderTests.swift:262 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: simplePrivateMessage bitchatTests/EndToEnd/PrivateChatE2ETests.swift:61 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: privateMessageNotReceivedByOthers bitchatTests/EndToEnd/PrivateChatE2ETests.swift:82 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: privateMessageRelay bitchatTests/EndToEnd/PrivateChatE2ETests.swift:186 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: privateMessageThroughput bitchatTests/EndToEnd/PrivateChatE2ETests.swift:222 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: largePrivateMessage bitchatTests/EndToEnd/PrivateChatE2ETests.swift:249 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: approvedLegacySendCancelledBeforeDeferredAdmissionDoesNotTransmit bitchatTests/EndToEnd/PrivateMediaEndToEndTests.swift:96 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: approvedLegacySendDeletedBeforeDeferredAdmissionDoesNotTransmit bitchatTests/EndToEnd/PrivateMediaEndToEndTests.swift:101 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: canonical0x20EncryptedFileIsAcceptedAcrossV1OuterPacket bitchatTests/EndToEnd/PrivateMediaEndToEndTests.swift:1065 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: privateJPEGIsOpaqueBeforeFragmentationAndDelivers bitchatTests/EndToEnd/PrivateMediaEndToEndTests.swift:1089 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 28 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×41
  • Hotspot: bitchat/Services/BLE/BLEService.swift bitchat/Services/BLE/BLEService.swift:2261 — bitchat/Services/BLE/BLEService.swift changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in BLEService.sendOnAllLinks at line 2261. 7 of those changes were fix/bug commits, and the other 43 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Services/BLE/BLEService.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Sync/GossipSyncManager.swift bitchat/Sync/GossipSyncManager.swift:418 — bitchat/Sync/GossipSyncManager.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 37 in GossipSyncManager._handleRequestSync at line 418. 1 of those changes was a fix/bug commit, and the other 12 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Sync/GossipSyncManager.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Noise/NoiseSessionManager.swift bitchat/Noise/NoiseSessionManager.swift:526 — bitchat/Noise/NoiseSessionManager.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 54 in NoiseSessionManager.handleIncomingHandshakeWithResult at line 526. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Noise/NoiseSessionManager.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatMessageFormatter.swift bitchat/ViewModels/ChatMessageFormatter.swift:17 — bitchat/ViewModels/ChatMessageFormatter.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in ChatMessageFormatter.formatMessageAsText at line 17. 1 of those changes was a fix/bug commit, and the other 3 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatMessageFormatter.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Services/CommandProcessor.swift bitchat/Services/CommandProcessor.swift:105 — bitchat/Services/CommandProcessor.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in CommandProcessor.process at line 105. 3 of those changes were fix/bug commits, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Services/CommandProcessor.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/ContentView.swift bitchat/Views/ContentView.swift:229 — bitchat/Views/ContentView.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in ContentView.body at line 229. 1 of those changes was a fix/bug commit, and the other 12 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/ContentView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/ContentSheetViews.swift bitchat/Views/ContentSheetViews.swift:125 — bitchat/Views/ContentSheetViews.swift changed 14 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in ContentPeopleSheetView.body at line 125. 2 of those changes were fix/bug commits, and the other 12 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/ContentSheetViews.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Services/MessageRouter.swift bitchat/Services/MessageRouter.swift:306 — bitchat/Services/MessageRouter.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in MessageRouter.courierBecameAvailable at line 306. 3 of those changes were fix/bug commits, and the other 10 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-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Services/MessageRouter.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/MessageListView.swift bitchat/Views/MessageListView.swift:57 — bitchat/Views/MessageListView.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in MessageListView.body at line 57. 1 of those changes was a fix/bug commit, and the other 6 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/MessageListView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatMediaTransferCoordinator.swift bitchat/ViewModels/ChatMediaTransferCoordinator.swift:1009 — bitchat/ViewModels/ChatMediaTransferCoordinator.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ChatMediaTransferCoordinator.handleTransferEvent at line 1009. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatMediaTransferCoordinator.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/ContentHeaderView.swift bitchat/Views/ContentHeaderView.swift:43 — bitchat/Views/ContentHeaderView.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ContentHeaderView.body at line 43. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/ContentHeaderView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/NostrInboundPipeline.swift bitchat/ViewModels/NostrInboundPipeline.swift:196 — bitchat/ViewModels/NostrInboundPipeline.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in NostrInboundPipeline.handleNostrEvent at line 196. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/NostrInboundPipeline.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatLifecycleCoordinator.swift bitchat/ViewModels/ChatLifecycleCoordinator.swift:169 — bitchat/ViewModels/ChatLifecycleCoordinator.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in ChatLifecycleCoordinator.markPrivateMessagesAsRead at line 169. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatLifecycleCoordinator.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Nostr/NostrRelayManager.swift bitchat/Nostr/NostrRelayManager.swift:1459 — bitchat/Nostr/NostrRelayManager.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in NostrRelayManager.handleDisconnection at line 1459. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Nostr/NostrRelayManager.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatPublicConversationCoordinator.swift bitchat/ViewModels/ChatPublicConversationCoordinator.swift:448 — bitchat/ViewModels/ChatPublicConversationCoordinator.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in ChatPublicConversationCoordinator.handlePublicMessage at line 448. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatPublicConversationCoordinator.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Services/BLE/BLEAnnounceHandler.swift bitchat/Services/BLE/BLEAnnounceHandler.swift:98 — bitchat/Services/BLE/BLEAnnounceHandler.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 34 in BLEAnnounceHandler.handle at line 98. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Services/BLE/BLEAnnounceHandler.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Sync/SyncTypeFlags.swift bitchat/Sync/SyncTypeFlags.swift:29 — bitchat/Sync/SyncTypeFlags.swift changed 10 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in SyncTypeFlags.bitIndex at line 29. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Sync/SyncTypeFlags.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: localPackages/BitFoundation/Sources/BitFoundation/MessageType.swift localPackages/BitFoundation/Sources/BitFoundation/MessageType.swift:60 — localPackages/BitFoundation/Sources/BitFoundation/MessageType.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in MessageType.description at line 60. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- localPackages/BitFoundation/Sources/BitFoundation/MessageType.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/Components/TextMessageView.swift bitchat/Views/Components/TextMessageView.swift:35 — bitchat/Views/Components/TextMessageView.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in TextMessageView.body at line 35. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/Components/TextMessageView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/Media/MediaMessageView.swift bitchat/Views/Media/MediaMessageView.swift:35 — bitchat/Views/Media/MediaMessageView.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in MediaMessageView.body at line 35. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/Media/MediaMessageView.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Views/MeshPeerList.swift bitchat/Views/MeshPeerList.swift:39 — bitchat/Views/MeshPeerList.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in MeshPeerList.body at line 39. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Views/MeshPeerList.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatTransportEventCoordinator.swift bitchat/ViewModels/ChatTransportEventCoordinator.swift:424 — bitchat/ViewModels/ChatTransportEventCoordinator.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in ChatTransportEventCoordinator.handleNoisePayload at line 424. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatTransportEventCoordinator.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/VoiceRecordingViewModel.swift bitchat/ViewModels/VoiceRecordingViewModel.swift:80 — bitchat/ViewModels/VoiceRecordingViewModel.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 26 in VoiceRecordingViewModel.start at line 80. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/VoiceRecordingViewModel.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/ViewModels/ChatPrivateConversationCoordinator.swift bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:485 — bitchat/ViewModels/ChatPrivateConversationCoordinator.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in ChatPrivateConversationCoordinator.handlePrivateMessage at line 485. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/ViewModels/ChatPrivateConversationCoordinator.swift`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: bitchat/Services/NostrTransport.swift bitchat/Services/NostrTransport.swift:359 — bitchat/Services/NostrTransport.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in NostrTransport.sendAckItem at line 359. Frequent change and high complexity in one file compound: schedule the next change to it to include carving out the part being edited, with the area under test before it moves. Counted over 2026-06-26..2026-09-24, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-06-26 09:35:50 +02:00' --until='2026-09-24 09:35:50 +02:00' --full-history --no-merges -- bitchat/Services/NostrTransport.swift`: 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.
  • + 16 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×19
  • MethodTooLong: ChatMessageFormatter.formatMessageAsText bitchat/ViewModels/ChatMessageFormatter.swift:17 — MethodTooLong — formatMessageAsText runs 254 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 154 over it, 2.54× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ContentHeaderView.body bitchat/Views/ContentHeaderView.swift:43 — MethodTooLong — body runs 226 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 126 over it, 2.26× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: NoiseSessionManager.handleIncomingHandshakeWithResult bitchat/Noise/NoiseSessionManager.swift:526 — MethodTooLong — handleIncomingHandshakeWithResult runs 224 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 124 over it, 2.24× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ContentView.body bitchat/Views/ContentView.swift:229 — MethodTooLong — body runs 186 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 86 over it, 1.86× 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: FingerprintView.body bitchat/Views/FingerprintView.swift:65 — MethodTooLong — body runs 173 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 73 over it, 1.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.
  • MethodTooLong: AppInfoView.settingsContent bitchat/Views/AppInfoView.swift:334 — MethodTooLong — settingsContent runs 162 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 62 over it, 1.62× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BLEService.sendFilePrivate bitchat/Services/BLE/BLEService.swift:1569 — MethodTooLong — sendFilePrivate runs 156 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 56 over it, 1.56× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageListView.body bitchat/Views/MessageListView.swift:57 — MethodTooLong — body runs 149 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 49 over it, 1.49× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:507 — MethodTooLong — loadDurableStateIfNeeded runs 142 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 42 over it, 1.42× 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: MeshPeerList.body bitchat/Views/MeshPeerList.swift:39 — MethodTooLong — body runs 136 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 36 over it, 1.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ContentPeopleSheetView.body bitchat/Views/ContentSheetViews.swift:125 — MethodTooLong — body runs 133 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 33 over it, 1.33× 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: ChatViewModel.performPrivateChatClear bitchat/ViewModels/ChatViewModel.swift:744 — MethodTooLong — performPrivateChatClear runs 128 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 28 over it, 1.28× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BLEAnnounceHandler.handle bitchat/Services/BLE/BLEAnnounceHandler.swift:98 — MethodTooLong — handle runs 117 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 17 over it, 1.17× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: MessageOutboxStore.save bitchat/Services/Courier/MessageOutboxStore.swift:256 — MethodTooLong — save runs 115 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 15 over it, 1.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: BLEFileTransferHandler.storeIncomingFile bitchat/Services/BLE/BLEFileTransferHandler.swift:233 — MethodTooLong — storeIncomingFile runs 114 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 14 over it, 1.14× 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: BinaryProtocol.decodeCore localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:267 — MethodTooLong — decodeCore runs 112 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 12 over it, 1.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: KeychainManager.deleteAllKeychainData bitchat/Services/KeychainManager.swift:669 — MethodTooLong — deleteAllKeychainData runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× 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: ChatViewModel.panicClearAllData bitchat/ViewModels/ChatViewModel.swift:1555 — MethodTooLong — panicClearAllData runs 109 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 9 over it, 1.09× 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: MessageOutboxStore.retryDeferredLoad bitchat/Services/Courier/MessageOutboxStore.swift:470 — MethodTooLong — retryDeferredLoad runs 104 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 4 over it, 1.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D3 · God Classes · FileTooLong · ×17
  • FileTooLong: BLE/BLEService.swift bitchat/Services/BLE/BLEService.swift — FileTooLong — 4145 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3645 over it, 8.29× 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: ViewModels/ChatMediaTransferCoordinator.swift bitchat/ViewModels/ChatMediaTransferCoordinator.swift — FileTooLong — 1300 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 800 over it, 2.60× 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: ViewModels/ChatViewModel.swift bitchat/ViewModels/ChatViewModel.swift — FileTooLong — 1297 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: ChatViewModel (125-2353). The bar is 500 significant lines; this is 797 over it, 2.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Nostr/NostrRelayManager.swift bitchat/Nostr/NostrRelayManager.swift — FileTooLong — 1148 significant lines (blank, comment-only and punctuation-only lines excluded), about 77% of them inside a single declaration: NostrRelayManager (131-1652). The bar is 500 significant lines; this is 648 over it, 2.30× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Noise/NoiseSessionManager.swift bitchat/Noise/NoiseSessionManager.swift — FileTooLong — 855 significant lines (blank, comment-only and punctuation-only lines excluded), about 98% of them inside a single declaration: NoiseSessionManager (48-1289). The bar is 500 significant lines; this is 355 over it, 1.71× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: BLE/BLEPrivateMediaReceiptStore.swift bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift — FileTooLong — 759 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: BLEPrivateMediaReceiptStore (27-1143). The bar is 500 significant lines; this is 259 over it, 1.52× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Courier/MessageOutboxStore.swift bitchat/Services/Courier/MessageOutboxStore.swift — FileTooLong — 627 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: MessageOutboxStore (25-898). The bar is 500 significant lines; this is 127 over it, 1.25× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Views/AppInfoView.swift bitchat/Views/AppInfoView.swift — FileTooLong — 602 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: AppInfoView (7-844). The bar is 500 significant lines; this is 102 over it, 1.20× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Services/KeychainManager.swift bitchat/Services/KeychainManager.swift — FileTooLong — 596 significant lines (blank, comment-only and punctuation-only lines excluded), about 94% of them inside a single declaration: KeychainManager (62-962). The bar is 500 significant lines; this is 96 over it, 1.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Services/NoiseEncryptionService.swift bitchat/Services/NoiseEncryptionService.swift — FileTooLong — 594 significant lines (blank, comment-only and punctuation-only lines excluded), about 84% of them inside a single declaration: NoiseEncryptionService (153-1101). The bar is 500 significant lines; this is 94 over it, 1.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Nostr/NostrProtocol.swift bitchat/Nostr/NostrProtocol.swift — FileTooLong — 560 significant lines (blank, comment-only and punctuation-only lines excluded), about 81% of them inside a single declaration: NostrProtocol (18-768). The bar is 500 significant lines; this is 60 over it, 1.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: BLE/BLEIncomingFileStore.swift bitchat/Services/BLE/BLEIncomingFileStore.swift — FileTooLong — 560 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: BLEIncomingFileStore (96-876). The bar is 500 significant lines; this is 60 over it, 1.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: ViewModels/ChatPrivateConversationCoordinator.swift bitchat/ViewModels/ChatPrivateConversationCoordinator.swift — FileTooLong — 559 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: ChatPrivateConversationCoordinator (238-939). The bar is 500 significant lines; this is 59 over it, 1.12× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Noise/NoiseProtocol.swift bitchat/Noise/NoiseProtocol.swift — FileTooLong — 558 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 58 over it, 1.12× 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: Views/NoticesView.swift bitchat/Views/NoticesView.swift — FileTooLong — 551 significant lines (blank, comment-only and punctuation-only lines excluded), about 67% of them inside a single declaration: NoticesView (18-567). The bar is 500 significant lines; this is 51 over it, 1.10× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Views/ContentSheetViews.swift bitchat/Views/ContentSheetViews.swift — FileTooLong — 527 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 27 over it, 1.05× 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: Sync/GossipSyncManager.swift bitchat/Sync/GossipSyncManager.swift — FileTooLong — 518 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: GossipSyncManager (6-816). The bar is 500 significant lines; this is 18 over it, 1.04× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
D3 · God Classes · ClassTooLong · ×17
  • ClassTooLong: BLEService bitchat/Services/BLE/BLEService.swift:182 — ClassTooLong — 1610 significant lines (blank, comment-only and punctuation-only lines excluded), 294 methods. The bar is 400 significant lines; this is 1210 over it, 4.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatViewModel bitchat/ViewModels/ChatViewModel.swift:125 — ClassTooLong — 1210 significant lines (blank, comment-only and punctuation-only lines excluded), 371 methods. The bar is 400 significant lines; this is 810 over it, 3.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: NostrRelayManager bitchat/Nostr/NostrRelayManager.swift:130 — ClassTooLong — 887 significant lines (blank, comment-only and punctuation-only lines excluded), 57 methods. The bar is 400 significant lines; this is 487 over it, 2.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: NoiseSessionManager bitchat/Noise/NoiseSessionManager.swift:48 — ClassTooLong — 836 significant lines (blank, comment-only and punctuation-only lines excluded), 39 methods. The bar is 400 significant lines; this is 436 over it, 2.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BLEPrivateMediaReceiptStore bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:27 — ClassTooLong — 752 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 352 over it, 1.88× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MessageOutboxStore bitchat/Services/Courier/MessageOutboxStore.swift:25 — ClassTooLong — 619 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 219 over it, 1.55× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: KeychainManager bitchat/Services/KeychainManager.swift:62 — ClassTooLong — 562 significant lines (blank, comment-only and punctuation-only lines excluded), 31 methods. The bar is 400 significant lines; this is 162 over it, 1.41× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatMediaTransferCoordinator bitchat/ViewModels/ChatMediaTransferCoordinator.swift:492 — ClassTooLong — 561 significant lines (blank, comment-only and punctuation-only lines excluded), 49 methods. The bar is 400 significant lines; this is 161 over it, 1.40× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AppInfoView bitchat/Views/AppInfoView.swift:7 — ClassTooLong — 545 significant lines (blank, comment-only and punctuation-only lines excluded), 6 methods. The bar is 400 significant lines; this is 145 over it, 1.36× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: NoiseEncryptionService bitchat/Services/NoiseEncryptionService.swift:153 — ClassTooLong — 501 significant lines (blank, comment-only and punctuation-only lines excluded), 51 methods. The bar is 400 significant lines; this is 101 over it, 1.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: GossipSyncManager bitchat/Sync/GossipSyncManager.swift:6 — ClassTooLong — 500 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 100 over it, 1.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BLEIncomingFileStore bitchat/Services/BLE/BLEIncomingFileStore.swift:96 — ClassTooLong — 499 significant lines (blank, comment-only and punctuation-only lines excluded), 28 methods. The bar is 400 significant lines; this is 99 over it, 1.25× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: BridgeService bitchat/Services/Gateway/BridgeService.swift:62 — ClassTooLong — 484 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 84 over it, 1.21× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: NostrProtocol bitchat/Nostr/NostrProtocol.swift:18 — ClassTooLong — 454 significant lines (blank, comment-only and punctuation-only lines excluded), 25 methods. The bar is 400 significant lines; this is 54 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatPrivateConversationCoordinator bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:237 — ClassTooLong — 439 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 39 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LocationChannelsSheet bitchat/Views/LocationChannelsSheet.swift:8 — ClassTooLong — 439 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 39 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MessageRouter bitchat/Services/MessageRouter.swift:33 — ClassTooLong — 434 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 34 over it, 1.09× 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 · ×14
  • TooManyMethods: ChatViewModel bitchat/ViewModels/ChatViewModel.swift:125 — TooManyMethods — 371 methods, declared across 21 files: ViewModels/ChatViewModel.swift (154), Extensions/ChatViewModel+PrivateChat.swift (24), ViewModels/ChatPeerIdentityCoordinator.swift (23), ViewModels/ChatPrivateConversationCoordinator.swift (23), +17 more file(s). The bar is 30 methods; this is 341 over it, 12.37× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BLEService bitchat/Services/BLE/BLEService.swift:182 — TooManyMethods — 294 methods, declared across 3 files: BLE/BLEService.swift (266), BLE/BLEService+LinkLayerCentralRole.swift (15), BLE/BLEService+LinkLayerPeripheralRole.swift (13). The bar is 30 methods; this is 264 over it, 9.80× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NostrRelayManager bitchat/Nostr/NostrRelayManager.swift:130 — TooManyMethods — 57 methods. The bar is 30 methods; this is 27 over it, 1.90× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NoiseEncryptionService bitchat/Services/NoiseEncryptionService.swift:153 — TooManyMethods — 51 methods. The bar is 30 methods; this is 21 over it, 1.70× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ChatMediaTransferCoordinator bitchat/ViewModels/ChatMediaTransferCoordinator.swift:492 — TooManyMethods — 49 methods. The bar is 30 methods; this is 19 over it, 1.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: SecureIdentityStateManager bitchat/Identity/SecureIdentityStateManager.swift:156 — TooManyMethods — 43 methods. The bar is 30 methods; this is 13 over it, 1.43× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NoiseSessionManager bitchat/Noise/NoiseSessionManager.swift:48 — TooManyMethods — 39 methods. The bar is 30 methods; this is 9 over it, 1.30× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConversationStore bitchat/App/ConversationStore.swift:332 — TooManyMethods — 36 methods. The bar is 30 methods; this is 6 over it, 1.20× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: ConversationUIModel bitchat/App/ConversationUIModel.swift:8 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: LocationStateManager bitchat/Services/LocationStateManager.swift:88 — TooManyMethods — 34 methods. The bar is 30 methods; this is 4 over it, 1.13× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: GossipSyncManager bitchat/Sync/GossipSyncManager.swift:6 — TooManyMethods — 32 methods. The bar is 30 methods; this is 2 over it, 1.07× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: BLEPrivateMediaReceiptStore bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:27 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: KeychainManager bitchat/Services/KeychainManager.swift:62 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: NostrTransport bitchat/Services/NostrTransport.swift:7 — TooManyMethods — 31 methods. The bar is 30 methods; this is 1 over it, 1.03× 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.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×10
  • Duplicated block (5 lines × 2) bitchat/Services/BLE/BLEService.swift:5085 — bitchat/Services/BLE/BLEService.swift:5085-5089 | bitchat/Services/BLE/BLEService.swift:5139-5143 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService.swift:5085` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) bitchat/Services/CommandProcessor.swift:453 — bitchat/Services/CommandProcessor.swift:453-457 | bitchat/Services/CommandProcessor.swift:480-484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) bitchat/Services/Gateway/BridgeService.swift:573 — bitchat/Services/Gateway/BridgeService.swift:573-577 | bitchat/Services/Gateway/GatewayService.swift:250-254 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (5 lines × 2) bitchat/Services/MessageFormattingEngine.swift:191 — bitchat/Services/MessageFormattingEngine.swift:191-196 | bitchat/ViewModels/ChatMessageFormatter.swift:338-342 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:106 — bitchat/ViewModels/ChatMessageFormatter.swift:106-110 | bitchat/ViewModels/ChatMessageFormatter.swift: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. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMessageFormatter.swift:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/ViewModels/ChatMessageFormatter.swift:111` calls `matches`, `NSRange` and `bitchat/ViewModels/ChatMessageFormatter.swift:120` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:328 — bitchat/ViewModels/ChatMessageFormatter.swift:328-332 | bitchat/ViewModels/ChatMessageFormatter.swift:340-344 — both copies are in the same file, so extract the 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) bitchat/ViewModels/VoiceRecordingViewModel.swift:203 — bitchat/ViewModels/VoiceRecordingViewModel.swift:203-207 | bitchat/ViewModels/VoiceRecordingViewModel.swift:213-217 — both copies are in the same file, so extract the 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) bitchat/Views/Image Viewers/ImagePreviewView.swift:50 — bitchat/Views/Image Viewers/ImagePreviewView.swift:50-54 | bitchat/Views/Image Viewers/ImagePreviewView.swift:59-63 — both copies are in the same file, so extract the 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) localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:130 — localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:130-134 | localPackages/BitFoundation/Sources/BitFoundation/PrekeyBundle.swift:131-135 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:130` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) bitchat/Services/KeychainManager.swift:448 — bitchat/Services/KeychainManager.swift:448-452 | bitchat/Services/KeychainManager.swift:506-510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/KeychainManager.swift:448` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Services/KeychainManager.swift:512` calls `warning`, `otherError` and `bitchat/Services/KeychainManager.swift:454` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×7
  • Duplicated block (11 lines × 2) bitchat/Nostr/NostrEmbeddedBitChat.swift:22 — bitchat/Nostr/NostrEmbeddedBitChat.swift:22-32 | bitchat/Nostr/NostrEmbeddedBitChat.swift:45-55 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Nostr/NostrEmbeddedBitChat.swift:22` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) bitchat/Nostr/NostrEmbeddedBitChat.swift:67 — bitchat/Nostr/NostrEmbeddedBitChat.swift:67-77 | bitchat/Nostr/NostrEmbeddedBitChat.swift:90-100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Nostr/NostrEmbeddedBitChat.swift:67` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) bitchat/Services/BLE/BLEService.swift:4445 — bitchat/Services/BLE/BLEService.swift:4445-4455 | bitchat/Services/BLE/BLEService.swift:4493-4503 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService.swift:4445` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) bitchat/Services/Board/BoardStore.swift:323 — bitchat/Services/Board/BoardStore.swift:323-333 | bitchat/Sync/GossipMessageArchive.swift:44-54 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Board/BoardStore.swift:323` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) bitchat/Services/PrivateChatManager.swift:168 — bitchat/Services/PrivateChatManager.swift:168-178 | bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:296-306 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:296` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (11 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:203 — bitchat/ViewModels/ChatMessageFormatter.swift:203-213 | bitchat/ViewModels/ChatMessageFormatter.swift:316-326 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMessageFormatter.swift:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) bitchat/Views/GeohashPeopleList.swift:146 — bitchat/Views/GeohashPeopleList.swift:146-156 | bitchat/Views/MeshPeerList.swift:233-243 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/GeohashPeopleList.swift:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×7
  • Swallowed exception (caught, then discarded) bitchat/Models/BitchatMessage+Media.swift:29 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) bitchat/Nostr/GeoRelayDirectory.swift:137 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) bitchat/Services/NoiseEncryptionService.swift:1135 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) bitchat/Services/NoiseEncryptionService.swift:1148 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) bitchat/Services/Groups/GroupProtocol.swift:279 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) bitchat/ViewModels/ChatViewModel.swift:1118 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) localPackages/Arti/Sources/TorManager.swift:156 — `catch` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
D3 · God Classes · FunctionTooLong · ×6
  • FunctionTooLong: TorManager.swift.arti_start localPackages/Arti/Sources/TorManager.swift:18 — FunctionTooLong — arti_start runs 296 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 196 over it, 2.96× 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: TorManager.swift.arti_stop localPackages/Arti/Sources/TorManager.swift:21 — FunctionTooLong — arti_stop runs 294 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 194 over it, 2.94× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • FunctionTooLong: TorManager.swift.arti_is_running localPackages/Arti/Sources/TorManager.swift:24 — FunctionTooLong — arti_is_running runs 292 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 192 over it, 2.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: TorManager.swift.arti_bootstrap_progress localPackages/Arti/Sources/TorManager.swift:27 — FunctionTooLong — arti_bootstrap_progress runs 290 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 190 over it, 2.90× 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: TorManager.swift.arti_bootstrap_summary localPackages/Arti/Sources/TorManager.swift:30 — FunctionTooLong — arti_bootstrap_summary runs 288 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 188 over it, 2.88× 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: arti_bitchat::socks::handle_socks_connection localPackages/Arti/arti-bitchat/src/socks.rs:26 — FunctionTooLong — arti_bitchat::socks::handle_socks_connection runs 110 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 10 over it, 1.10× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×6
  • Duplicated block (12 lines × 2) bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121 — bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121-133 | bitchat/Services/BLE/BLEService+LinkLayerPeripheralRole.swift:72-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) bitchat/Services/Courier/CourierStore.swift:605 — bitchat/Services/Courier/CourierStore.swift:605-616 | bitchat/Services/Courier/MessageOutboxStore.swift:874-885 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:573 — bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:573-584 | bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:610-621 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:573` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) bitchat/Views/Components/ConnectivityStatusBanner.swift:104 — bitchat/Views/Components/ConnectivityStatusBanner.swift:104-115 | bitchat/Views/Components/PanicWipeBlockedBanner.swift:30-41 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/Components/ConnectivityStatusBanner.swift:104` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) bitchat/Views/GroupChatList.swift:50 — bitchat/Views/GroupChatList.swift:50-61 | bitchat/Views/RecentChatList.swift:59-70 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/GroupChatList.swift:50` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (12 lines × 2) localPackages/Arti/arti-bitchat/src/lib.rs:76 — localPackages/Arti/arti-bitchat/src/lib.rs:76-87 | localPackages/Arti/arti-bitchat/src/lib.rs:128-139 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D30 · Dependency Vulnerabilities · Medium advisory (unsound) · ×5
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D6 · Cohesion (LCOM4) · Low cohesion · ×5
  • Low cohesion: ChatViewModel (LCOM4 35) bitchat/ViewModels/ChatViewModel.swift:125 — ChatViewModel's methods fall into 35 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 35 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: Data (LCOM4 14) bitchat/Nostr/XChaCha20Poly1305Compat.swift:115 — Data's methods fall into 14 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 14 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: VerificationService (LCOM4 7) bitchat/Services/VerificationService.swift:4 — VerificationService's methods fall into 7 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 7 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: ChatNostrCoordinator (LCOM4 6) bitchat/ViewModels/ChatNostrCoordinator.swift:47 — ChatNostrCoordinator's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: String (LCOM4 6) bitchat/Utils/String+DJB2.swift:11 — String's methods fall into 6 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 6 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×4
  • Duplicated block (10 lines × 2) bitchat/Nostr/XChaCha20Poly1305Compat.swift:21 — bitchat/Nostr/XChaCha20Poly1305Compat.swift:21-30 | bitchat/Nostr/XChaCha20Poly1305Compat.swift:37-46 — both copies are in the same file, so extract the 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) bitchat/Services/BLE/BLEService.swift:2908 — bitchat/Services/BLE/BLEService.swift:2908-2918 | bitchat/Services/BLE/BLEService.swift:6607-6616 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService.swift:2908` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Services/BLE/BLEService.swift:6617` calls `ingest` and `bitchat/Services/BLE/BLEService.swift:2919` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) bitchat/ViewModels/ChatGroupCoordinator.swift:191 — bitchat/ViewModels/ChatGroupCoordinator.swift:191-200 | bitchat/ViewModels/ChatGroupCoordinator.swift:267-276 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:199 — localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:199-208 | localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:232-241 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×4
  • Duplicated block (9 lines × 2) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:218 — bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:218-229 | bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:299-307 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:218` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) bitchat/Services/Board/BoardStore.swift:328 — bitchat/Services/Board/BoardStore.swift:328-336 | bitchat/Services/Groups/GroupStore.swift:179-187 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Board/BoardStore.swift:328` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) bitchat/Services/Courier/MessageOutboxStore.swift:825 — bitchat/Services/Courier/MessageOutboxStore.swift:825-833 | bitchat/Services/MessageRouter.swift:530-538 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Courier/MessageOutboxStore.swift:825` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:631 — bitchat/ViewModels/ChatMediaTransferCoordinator.swift:631-639 | bitchat/ViewModels/ChatMediaTransferCoordinator.swift:662-670 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMediaTransferCoordinator.swift:631` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D30 · Dependency Vulnerabilities · Medium CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium advisory (unmaintained) · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Medium vulnerability · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D36 · Supply-chain Provenance & Signing REDACTED · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Duplicated block (15 lines × 2) · ×3
  • Duplicated block (15 lines × 2) bitchat/Services/BLE/BLEService.swift:4032 — bitchat/Services/BLE/BLEService.swift:4032-4046 | bitchat/Services/BLE/BLEService.swift:5334-5348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService.swift:4032` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) bitchat/Services/Gateway/BridgeDropDedupStore.swift:102 — bitchat/Services/Gateway/BridgeDropDedupStore.swift:102-116 | bitchat/Services/NostrProcessedEventStore.swift:78-92 — before extracting anything, compare `bitchat/Services/Gateway/BridgeDropDedupStore.swift` and `bitchat/Services/NostrProcessedEventStore.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeDropDedupStore.swift:102` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (15 lines × 2) bitchat/Services/Gateway/BridgeService.swift:694 — bitchat/Services/Gateway/BridgeService.swift:694-708 | bitchat/Services/Gateway/GatewayService.swift:365-379 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeService.swift:694` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×3
  • Duplicated block (14 lines × 2) bitchat/Services/KeychainManager.swift:409 — bitchat/Services/KeychainManager.swift:409-422 | bitchat/Services/KeychainManager.swift:569-582 — both copies are in the same file, so extract the 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) bitchat/Services/NoiseEncryptionService.swift:116 — bitchat/Services/NoiseEncryptionService.swift:116-129 | bitchat/Services/NoiseEncryptionService.swift:131-144 — both copies are in the same file, so extract the 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) localPackages/BitFoundation/Sources/BitFoundation/BinaryEncodingUtils.swift:124 — localPackages/BitFoundation/Sources/BitFoundation/BinaryEncodingUtils.swift:124-137 | localPackages/BitFoundation/Sources/BitFoundation/BinaryEncodingUtils.swift:143-156 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `maxLength` to `Int = 255` in one and `Int = 65535` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D35 · Change Coupling · Change coupling · ×2
  • Change coupling: NoiseSession.swift ↔ NoiseEncryptionService.swift bitchat/Noise/NoiseSession.swift:1 — `bitchat/Noise/NoiseSession.swift` and `bitchat/Services/NoiseEncryptionService.swift` change together 67% of the time (16 of the 24 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 16 shared commits counted here, the most recent 3 are `03c357f0` PeerID 11/n: `Noise` types use `PeerID` + create separate files (#750); `00ff5fd3` Refine panic mode to regenerate identities immediately (#624); `347ce5ec` Modularization: Extract SecureLogger into a separate module (#600) — run `git show` on any of them.
  • Change coupling: BLEService.swift ↔ UnifiedPeerService.swift bitchat/Services/BLE/BLEService.swift:1 — `bitchat/Services/BLE/BLEService.swift` and `bitchat/Services/UnifiedPeerService.swift` change together 59% of the time (13 of the 22 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). They sit in different directories, but in this ecosystem the namespace is declared in the FILE, not by the folder — so the two may well share one namespace and reference each other with no import for this pass to see. Read the pair before acting: if one derives from or overrides the other, the dependency is explicit in the type declaration and the co-change is definitional; if one registers itself into the other through a hook or an initialiser, the missing dependency is DELIBERATE and the thing to add is a comment saying so; if they simply belong together, co-locate them; if none of these holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 13 shared commits counted here, the most recent 3 are `ad4103ba` Refactor Nostr ID Bridge & Keychain Helper (#796) (at that commit the file was still `bitchat/Services/BLEService.swift`); `10e3f574` PeerID 16/n: BitchatPeer / PeerInfo / TransportPeer (#755) (at that commit the file was still `bitchat/Services/BLEService.swift`); `f86ae5e2` PeerID 14/n: `Transport` and its dependents (#753) (at that commit the file was still `bitchat/Services/BLEService.swift`) — run `git show` on any of them.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×2
  • Duplicated block (28 lines × 2) bitchat/Services/Courier/MessageOutboxStore.swift:331 — bitchat/Services/Courier/MessageOutboxStore.swift:331-358 | bitchat/Services/Courier/MessageOutboxStore.swift:374-401 — both copies are in the same file, so extract the 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 (28 lines × 2) bitchat/Services/Courier/MessageOutboxStore.swift:521 — bitchat/Services/Courier/MessageOutboxStore.swift:521-548 | bitchat/Services/Courier/MessageOutboxStore.swift:553-580 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `bitchat/Services/Courier/MessageOutboxStore.swift:551` calls `corrupt`, `error` and `bitchat/Services/Courier/MessageOutboxStore.swift:520` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×2
  • Duplicated block (19 lines × 2) bitchat/ViewModels/ChatViewModel.swift:875 — bitchat/ViewModels/ChatViewModel.swift:875-893 | bitchat/ViewModels/ChatViewModel.swift:905-923 — both copies are in the same file, so extract the 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 (19 lines × 2) bitchat/Views/MessageListView.swift:625 — bitchat/Views/MessageListView.swift:625-643 | bitchat/Views/MessageListView.swift:669-687 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/MessageListView.swift:625` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×2
  • Duplicated block (17 lines × 2) bitchat/Noise/NoiseSession.swift:108 — bitchat/Noise/NoiseSession.swift:108-124 | bitchat/Noise/NoiseSession.swift:134-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Noise/NoiseSession.swift:108` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 2) bitchat/Protocols/Geohash.swift:77 — bitchat/Protocols/Geohash.swift:77-93 | bitchat/Protocols/Geohash.swift:103-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. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×2
  • Duplicated block (8–9 lines × 2) bitchat/App/PeerListModel.swift:367 — bitchat/App/PeerListModel.swift:367-375 | bitchat/ViewModels/ChatViewModel.swift:1875-1882 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/App/PeerListModel.swift:367` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8–9 lines × 2) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:607 — bitchat/ViewModels/ChatMediaTransferCoordinator.swift:607-614 | bitchat/ViewModels/ChatMediaTransferCoordinator.swift:617-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMediaTransferCoordinator.swift:617` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×2
  • Duplicated block (6 lines × 2) bitchat/Services/Gateway/BridgeService.swift:257 — bitchat/Services/Gateway/BridgeService.swift:257-262 | bitchat/Services/Gateway/GatewayService.swift:139-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Services/Gateway/BridgeService.swift:263` calls `BoundedIDSet` and `bitchat/Services/Gateway/GatewayService.swift:145` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 2) localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:137 — localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:137-142 | localPackages/BitFoundation/Sources/BitFoundation/PrekeyBundle.swift:138-143 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D1 · Cyclomatic Complexity · ChatMessageFormatter.formatMessageAsText (cyclomatic 95) · ×1
  • ChatMessageFormatter.formatMessageAsText (cyclomatic 95) bitchat/ViewModels/ChatMessageFormatter.swift:17 — ChatMessageFormatter.formatMessageAsText has cyclomatic complexity 95 (threshold 15). Of this number, 83 points are the body's own statements and 12 belong to 4 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 · MimeType.matches (cyclomatic 60) · ×1
  • MimeType.matches (cyclomatic 60) bitchat/Services/BLE/MimeType.swift:114 — MimeType.matches has cyclomatic complexity 60 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · NoiseSessionManager.handleIncomingHandshakeWithResult (cyclomatic 54) · ×1
  • NoiseSessionManager.handleIncomingHandshakeWithResult (cyclomatic 54) bitchat/Noise/NoiseSessionManager.swift:526 — NoiseSessionManager.handleIncomingHandshakeWithResult has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BinaryProtocol.decodeCore (cyclomatic 48) · ×1
  • BinaryProtocol.decodeCore (cyclomatic 48) localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:267 — BinaryProtocol.decodeCore has cyclomatic complexity 48 (threshold 15). Of this number, 44 points are the body's own statements and 4 belong to 4 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 · MessageOutboxStore.retryDeferredLoad (cyclomatic 43) · ×1
  • MessageOutboxStore.retryDeferredLoad (cyclomatic 43) bitchat/Services/Courier/MessageOutboxStore.swift:470 — MessageOutboxStore.retryDeferredLoad has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent 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 · BoardWire.decode (cyclomatic 41) · ×1
  • BoardWire.decode (cyclomatic 41) bitchat/Protocols/BoardPackets.swift:184 — BoardWire.decode has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BinaryProtocol.encode (cyclomatic 41) · ×1
  • BinaryProtocol.encode (cyclomatic 41) localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:133 — BinaryProtocol.encode has cyclomatic complexity 41 (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 · MessageOutboxStore.save (cyclomatic 40) · ×1
  • MessageOutboxStore.save (cyclomatic 40) bitchat/Services/Courier/MessageOutboxStore.swift:256 — MessageOutboxStore.save has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GossipSyncManager._handleRequestSync (cyclomatic 37) · ×1
  • GossipSyncManager._handleRequestSync (cyclomatic 37) bitchat/Sync/GossipSyncManager.swift:418 — GossipSyncManager._handleRequestSync has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MeshPeerList.body (cyclomatic 36) · ×1
  • MeshPeerList.body (cyclomatic 36) bitchat/Views/MeshPeerList.swift:39 — MeshPeerList.body has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded (cyclomatic 35) · ×1
  • BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded (cyclomatic 35) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:507 — BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEAnnounceHandler.handle (cyclomatic 34) · ×1
  • BLEAnnounceHandler.handle (cyclomatic 34) bitchat/Services/BLE/BLEAnnounceHandler.swift:98 — BLEAnnounceHandler.handle has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeoRelayDirectory.validatedDirectoryAddress (cyclomatic 33) · ×1
  • GeoRelayDirectory.validatedDirectoryAddress (cyclomatic 33) bitchat/Nostr/GeoRelayDirectory.swift:515 — GeoRelayDirectory.validatedDirectoryAddress has cyclomatic complexity 33 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MessageListView.body (cyclomatic 33) · ×1
  • MessageListView.body (cyclomatic 33) bitchat/Views/MessageListView.swift:57 — MessageListView.body has cyclomatic complexity 33 (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 · BLEService.sendOnAllLinks (cyclomatic 32) · ×1
  • BLEService.sendOnAllLinks (cyclomatic 32) bitchat/Services/BLE/BLEService.swift:2261 — BLEService.sendOnAllLinks has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent 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 · MessageFormattingEngine.findAllMatches (cyclomatic 31) · ×1
  • MessageFormattingEngine.findAllMatches (cyclomatic 31) bitchat/Services/MessageFormattingEngine.swift:282 — MessageFormattingEngine.findAllMatches has cyclomatic complexity 31 (threshold 15). Of this number, 21 points are the body's own statements and 10 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NotificationStreamAssembler.append (cyclomatic 31) · ×1
  • NotificationStreamAssembler.append (cyclomatic 31) bitchat/Services/NotificationStreamAssembler.swift:37 — NotificationStreamAssembler.append has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandProcessor.process (cyclomatic 30) · ×1
  • CommandProcessor.process (cyclomatic 30) bitchat/Services/CommandProcessor.swift:105 — CommandProcessor.process has cyclomatic complexity 30 (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 · BLEService.handleReceivedPacketOnQueue (cyclomatic 30) · ×1
  • BLEService.handleReceivedPacketOnQueue (cyclomatic 30) bitchat/Services/BLE/BLEService.swift:5931 — BLEService.handleReceivedPacketOnQueue has cyclomatic complexity 30 (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 · BLEService.startFragmentedPacket (cyclomatic 28) · ×1
  • BLEService.startFragmentedPacket (cyclomatic 28) bitchat/Services/BLE/BLEService.swift:5498 — BLEService.startFragmentedPacket has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GossipSyncManager._onPublicPacketSeen (cyclomatic 27) · ×1
  • GossipSyncManager._onPublicPacketSeen (cyclomatic 27) bitchat/Sync/GossipSyncManager.swift:273 — GossipSyncManager._onPublicPacketSeen 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 · BLEService.broadcastPacket (cyclomatic 27) · ×1
  • BLEService.broadcastPacket (cyclomatic 27) bitchat/Services/BLE/BLEService.swift:1968 — BLEService.broadcastPacket 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 · validate_georelays.normalize_relay_address (cyclomatic 27) · ×1
  • validate_georelays.normalize_relay_address (cyclomatic 27) scripts/validate_georelays.py:56 — validate_georelays.normalize_relay_address has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VoiceRecordingViewModel.start (cyclomatic 26) · ×1
  • VoiceRecordingViewModel.start (cyclomatic 26) bitchat/ViewModels/VoiceRecordingViewModel.swift:80 — VoiceRecordingViewModel.start has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BitchatMessage.init (cyclomatic 26) · ×1
  • BitchatMessage.init (cyclomatic 26) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:221 — BitchatMessage.init has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RequestSyncPacket.decode (cyclomatic 25) · ×1
  • RequestSyncPacket.decode (cyclomatic 25) bitchat/Models/RequestSyncPacket.swift:87 — RequestSyncPacket.decode has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NoiseHandshakeState.writeMessage (cyclomatic 25) · ×1
  • NoiseHandshakeState.writeMessage (cyclomatic 25) bitchat/Noise/NoiseProtocol.swift:614 — NoiseHandshakeState.writeMessage has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocationStateManager.locationNamesByLevel (cyclomatic 25) · ×1
  • LocationStateManager.locationNamesByLevel (cyclomatic 25) bitchat/Services/LocationStateManager.swift:481 — LocationStateManager.locationNamesByLevel has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · PrivateChatManager.consolidateMessages (cyclomatic 25) · ×1
  • PrivateChatManager.consolidateMessages (cyclomatic 25) bitchat/Services/PrivateChatManager.swift:93 — PrivateChatManager.consolidateMessages has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatViewModel.performPrivateChatClear (cyclomatic 25) · ×1
  • ChatViewModel.performPrivateChatClear (cyclomatic 25) bitchat/ViewModels/ChatViewModel.swift:744 — ChatViewModel.performPrivateChatClear has cyclomatic complexity 25 (threshold 15). Most of this is not in the body itself: 7 of the 25 points are its own statements and the rest belongs to 3 function items inside it that branch (continueClear, currentRemovalPlan, hasRemainingCopy). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · BLEPrivateMediaReceiptStore.recordDeleted (cyclomatic 25) · ×1
  • BLEPrivateMediaReceiptStore.recordDeleted (cyclomatic 25) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:288 — BLEPrivateMediaReceiptStore.recordDeleted has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validate_georelays._validated_dataset (cyclomatic 25) · ×1
  • validate_georelays._validated_dataset (cyclomatic 25) scripts/validate_georelays.py:104 — validate_georelays._validated_dataset has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeoRelayDirectory.validatedEntries (cyclomatic 24) · ×1
  • GeoRelayDirectory.validatedEntries (cyclomatic 24) bitchat/Nostr/GeoRelayDirectory.swift:442 — GeoRelayDirectory.validatedEntries has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BitchatFilePacket.decode (cyclomatic 24) · ×1
  • BitchatFilePacket.decode (cyclomatic 24) bitchat/Protocols/BitchatFilePacket.swift:69 — BitchatFilePacket.decode has cyclomatic complexity 24 (threshold 15). Of this number, 21 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageRouter.retrySecurePrivateMessagesAfterAuthentication (cyclomatic 24) · ×1
  • MessageRouter.retrySecurePrivateMessagesAfterAuthentication (cyclomatic 24) bitchat/Services/MessageRouter.swift:592 — MessageRouter.retrySecurePrivateMessagesAfterAuthentication has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrivateConversationModel.resolveDisplayName (cyclomatic 23) · ×1
  • PrivateConversationModel.resolveDisplayName (cyclomatic 23) bitchat/App/PrivateConversationModels.swift:289 — PrivateConversationModel.resolveDisplayName has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NostrInboundPipeline.handleNostrEvent (cyclomatic 23) · ×1
  • NostrInboundPipeline.handleNostrEvent (cyclomatic 23) bitchat/ViewModels/NostrInboundPipeline.swift:196 — NostrInboundPipeline.handleNostrEvent has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ContentView.body (cyclomatic 23) · ×1
  • ContentView.body (cyclomatic 23) bitchat/Views/ContentView.swift:229 — ContentView.body has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLEService.handleLinkEvent (cyclomatic 23) · ×1
  • BLEService.handleLinkEvent (cyclomatic 23) bitchat/Services/BLE/BLEService.swift:5720 — BLEService.handleLinkEvent has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEService.handleAnnounce (cyclomatic 23) · ×1
  • BLEService.handleAnnounce (cyclomatic 23) bitchat/Services/BLE/BLEService.swift:6103 — BLEService.handleAnnounce has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · KeychainManager.deleteAllKeychainData (cyclomatic 22) · ×1
  • KeychainManager.deleteAllKeychainData (cyclomatic 22) bitchat/Services/KeychainManager.swift:669 — KeychainManager.deleteAllKeychainData has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEPrivateMediaReceiptStore.state (cyclomatic 22) · ×1
  • BLEPrivateMediaReceiptStore.state (cyclomatic 22) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:126 — BLEPrivateMediaReceiptStore.state has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEService.sendFilePrivate (cyclomatic 22) · ×1
  • BLEService.sendFilePrivate (cyclomatic 22) bitchat/Services/BLE/BLEService.swift:1569 — BLEService.sendFilePrivate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEService.configureNoiseServiceCallbacks (cyclomatic 22) · ×1
  • BLEService.configureNoiseServiceCallbacks (cyclomatic 22) bitchat/Services/BLE/BLEService.swift:4016 — BLEService.configureNoiseServiceCallbacks has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PrekeyBundle.decode (cyclomatic 22) · ×1
  • PrekeyBundle.decode (cyclomatic 22) localPackages/BitFoundation/Sources/BitFoundation/PrekeyBundle.swift:122 — PrekeyBundle.decode has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CBORReader.parseValue (cyclomatic 21) · ×1
  • CBORReader.parseValue (cyclomatic 21) bitchat/Services/CashuTokenDecoder.swift:257 — CBORReader.parseValue has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatMediaTransferCoordinator.handleTransferEvent (cyclomatic 21) · ×1
  • ChatMediaTransferCoordinator.handleTransferEvent (cyclomatic 21) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:1009 — ChatMediaTransferCoordinator.handleTransferEvent has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContentHeaderView.body (cyclomatic 21) · ×1
  • ContentHeaderView.body (cyclomatic 21) bitchat/Views/ContentHeaderView.swift:43 — ContentHeaderView.body has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · GeohashPeopleList.body (cyclomatic 21) · ×1
  • GeohashPeopleList.body (cyclomatic 21) bitchat/Views/GeohashPeopleList.swift:25 — GeohashPeopleList.body has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEPrivateMediaReceiptStore.commitAccepted (cyclomatic 21) · ×1
  • BLEPrivateMediaReceiptStore.commitAccepted (cyclomatic 21) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:214 — BLEPrivateMediaReceiptStore.commitAccepted has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · BridgeService.handleRendezvousEvent (cyclomatic 21) · ×1
  • BridgeService.handleRendezvousEvent (cyclomatic 21) bitchat/Services/Gateway/BridgeService.swift:432 — BridgeService.handleRendezvousEvent has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BitchatMessage.toBinaryPayload (cyclomatic 21) · ×1
  • BitchatMessage.toBinaryPayload (cyclomatic 21) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:125 — BitchatMessage.toBinaryPayload has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NoiseHandshakeState.performDHOperation (cyclomatic 20) · ×1
  • NoiseHandshakeState.performDHOperation (cyclomatic 20) bitchat/Noise/NoiseProtocol.swift:782 — NoiseHandshakeState.performDHOperation 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 · ParsedInbound.init (cyclomatic 20) · ×1
  • ParsedInbound.init (cyclomatic 20) bitchat/Nostr/NostrRelayManager.swift:1733 — ParsedInbound.init 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 · RelayController.decide (cyclomatic 20) · ×1
  • RelayController.decide (cyclomatic 20) bitchat/Services/RelayController.swift:12 — RelayController.decide has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatLifecycleCoordinator.markPrivateMessagesAsRead (cyclomatic 20) · ×1
  • ChatLifecycleCoordinator.markPrivateMessagesAsRead (cyclomatic 20) bitchat/ViewModels/ChatLifecycleCoordinator.swift:169 — ChatLifecycleCoordinator.markPrivateMessagesAsRead 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 · ChatPublicConversationCoordinator.handlePublicMessage (cyclomatic 20) · ×1
  • ChatPublicConversationCoordinator.handlePublicMessage (cyclomatic 20) bitchat/ViewModels/ChatPublicConversationCoordinator.swift:448 — ChatPublicConversationCoordinator.handlePublicMessage has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MinimalDistancePalette.rebuildEntries (cyclomatic 20) · ×1
  • MinimalDistancePalette.rebuildEntries (cyclomatic 20) bitchat/ViewModels/MinimalDistancePalette.swift:85 — MinimalDistancePalette.rebuildEntries has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent 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 · TextMessageView.body (cyclomatic 20) · ×1
  • TextMessageView.body (cyclomatic 20) bitchat/Views/Components/TextMessageView.swift:35 — TextMessageView.body has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MeshTopologyTracker.computeRoute (cyclomatic 19) · ×1
  • MeshTopologyTracker.computeRoute (cyclomatic 19) bitchat/Services/MeshTopologyTracker.swift:85 — MeshTopologyTracker.computeRoute has cyclomatic complexity 19 (threshold 15). Of this number, 18 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent 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 · ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cyclomatic 19) · ×1
  • ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cyclomatic 19) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:847 — ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatTransportEventCoordinator.handleNoisePayload (cyclomatic 19) · ×1
  • ChatTransportEventCoordinator.handleNoisePayload (cyclomatic 19) bitchat/ViewModels/ChatTransportEventCoordinator.swift:424 — ChatTransportEventCoordinator.handleNoisePayload has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · NostrInboundPipeline.subscribeNostrEvent (cyclomatic 19) · ×1
  • NostrInboundPipeline.subscribeNostrEvent (cyclomatic 19) bitchat/ViewModels/NostrInboundPipeline.swift:118 — NostrInboundPipeline.subscribeNostrEvent 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 · BLEPrivateMediaReceiptStore.recoverDeletionJournal (cyclomatic 19) · ×1
  • BLEPrivateMediaReceiptStore.recoverDeletionJournal (cyclomatic 19) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:720 — BLEPrivateMediaReceiptStore.recoverDeletionJournal has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageOutboxStore.load (cyclomatic 19) · ×1
  • MessageOutboxStore.load (cyclomatic 19) bitchat/Services/Courier/MessageOutboxStore.swift:180 — MessageOutboxStore.load has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GroupStatePayload.decode (cyclomatic 19) · ×1
  • GroupStatePayload.decode (cyclomatic 19) bitchat/Services/Groups/GroupProtocol.swift:285 — GroupStatePayload.decode has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · GroupCrypto.openMessage (cyclomatic 19) · ×1
  • GroupCrypto.openMessage (cyclomatic 19) bitchat/Services/Groups/GroupProtocol.swift:513 — GroupCrypto.openMessage has cyclomatic complexity 19 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · CourierEnvelope.decode (cyclomatic 19) · ×1
  • CourierEnvelope.decode (cyclomatic 19) localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:120 — CourierEnvelope.decode has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · VouchAttestation.decode (cyclomatic 18) · ×1
  • VouchAttestation.decode (cyclomatic 18) bitchat/Protocols/VouchAttestation.swift:145 — VouchAttestation.decode has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CommandProcessor.handleBlock (cyclomatic 18) · ×1
  • CommandProcessor.handleBlock (cyclomatic 18) bitchat/Services/CommandProcessor.swift:299 — CommandProcessor.handleBlock has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocationNotesManager.subscribe (cyclomatic 18) · ×1
  • LocationNotesManager.subscribe (cyclomatic 18) bitchat/Services/LocationNotesManager.swift:225 — LocationNotesManager.subscribe has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · MessageRouter.courierBecameAvailable (cyclomatic 18) · ×1
  • MessageRouter.courierBecameAvailable (cyclomatic 18) bitchat/Services/MessageRouter.swift:306 — MessageRouter.courierBecameAvailable has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · MessageRouter.flushOutbox (cyclomatic 18) · ×1
  • MessageRouter.flushOutbox (cyclomatic 18) bitchat/Services/MessageRouter.swift:694 — MessageRouter.flushOutbox has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SharedContentPayload.validate (cyclomatic 18) · ×1
  • SharedContentPayload.validate (cyclomatic 18) bitchat/Services/SharedContentHandoff.swift:58 — SharedContentPayload.validate has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GossipSyncManager.buildGcsPayload (cyclomatic 18) · ×1
  • GossipSyncManager.buildGcsPayload (cyclomatic 18) bitchat/Sync/GossipSyncManager.swift:553 — GossipSyncManager.buildGcsPayload has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NostrInboundPipeline.processGeohashGiftWrap (cyclomatic 18) · ×1
  • NostrInboundPipeline.processGeohashGiftWrap (cyclomatic 18) bitchat/ViewModels/NostrInboundPipeline.swift:333 — NostrInboundPipeline.processGeohashGiftWrap has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NostrRelayManager.handleDisconnection (cyclomatic 17) · ×1
  • NostrRelayManager.handleDisconnection (cyclomatic 17) bitchat/Nostr/NostrRelayManager.swift:1459 — NostrRelayManager.handleDisconnection has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AnnouncementPacket.decode (cyclomatic 17) · ×1
  • AnnouncementPacket.decode (cyclomatic 17) bitchat/Protocols/Packets.swift:96 — AnnouncementPacket.decode has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · UnifiedPeerService.updatePeers (cyclomatic 17) · ×1
  • UnifiedPeerService.updatePeers (cyclomatic 17) bitchat/Services/UnifiedPeerService.swift:79 — UnifiedPeerService.updatePeers has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeoPresenceTracker.subscribeNostrEvent (cyclomatic 17) · ×1
  • GeoPresenceTracker.subscribeNostrEvent (cyclomatic 17) bitchat/ViewModels/GeoPresenceTracker.swift:98 — GeoPresenceTracker.subscribeNostrEvent has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NostrInboundPipeline.processNostrMessage (cyclomatic 17) · ×1
  • NostrInboundPipeline.processNostrMessage (cyclomatic 17) bitchat/ViewModels/NostrInboundPipeline.swift:429 — NostrInboundPipeline.processNostrMessage has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ContentPeopleSheetView.body (cyclomatic 17) · ×1
  • ContentPeopleSheetView.body (cyclomatic 17) bitchat/Views/ContentSheetViews.swift:125 — ContentPeopleSheetView.body has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLEFileTransferHandler.storeIncomingFile (cyclomatic 17) · ×1
  • BLEFileTransferHandler.storeIncomingFile (cyclomatic 17) bitchat/Services/BLE/BLEFileTransferHandler.swift:233 — BLEFileTransferHandler.storeIncomingFile has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLENoisePacketHandler.handleEncrypted (cyclomatic 17) · ×1
  • BLENoisePacketHandler.handleEncrypted (cyclomatic 17) bitchat/Services/BLE/BLENoisePacketHandler.swift:197 — BLENoisePacketHandler.handleEncrypted has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BLEPublicMessageHandler.handle (cyclomatic 17) · ×1
  • BLEPublicMessageHandler.handle (cyclomatic 17) bitchat/Services/BLE/BLEPublicMessageHandler.swift:51 — BLEPublicMessageHandler.handle has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLEService.sendPendingNoisePayloadsAfterHandshake (cyclomatic 17) · ×1
  • BLEService.sendPendingNoisePayloadsAfterHandshake (cyclomatic 17) bitchat/Services/BLE/BLEService.swift:6887 — BLEService.sendPendingNoisePayloadsAfterHandshake has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · BridgeService.classify (cyclomatic 17) · ×1
  • BridgeService.classify (cyclomatic 17) bitchat/Services/Gateway/BridgeService.swift:836 — BridgeService.classify has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · MediaMessageView.body (cyclomatic 17) · ×1
  • MediaMessageView.body (cyclomatic 17) bitchat/Views/Media/MediaMessageView.swift:35 — MediaMessageView.body has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked (cyclomatic 16) · ×1
  • NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked (cyclomatic 16) bitchat/Noise/NoiseSessionManager.swift:886 — NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NostrRelayManager.subscribe (cyclomatic 16) · ×1
  • NostrRelayManager.subscribe (cyclomatic 16) bitchat/Nostr/NostrRelayManager.swift:739 — NostrRelayManager.subscribe has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GeohashChannelLevel.init (cyclomatic 16) · ×1
  • GeohashChannelLevel.init (cyclomatic 16) bitchat/Protocols/LocationChannel.swift:43 — GeohashChannelLevel.init has cyclomatic complexity 16 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AuthenticatedPeerStatePacket.decode (cyclomatic 16) · ×1
  • AuthenticatedPeerStatePacket.decode (cyclomatic 16) bitchat/Protocols/Packets.swift:199 — AuthenticatedPeerStatePacket.decode has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · CashuTokenDecoder.decodeV4 (cyclomatic 16) · ×1
  • CashuTokenDecoder.decodeV4 (cyclomatic 16) bitchat/Services/CashuTokenDecoder.swift:162 — CashuTokenDecoder.decodeV4 has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · ChatGroupCoordinator.applyGroupState (cyclomatic 16) · ×1
  • ChatGroupCoordinator.applyGroupState (cyclomatic 16) bitchat/ViewModels/ChatGroupCoordinator.swift:542 — ChatGroupCoordinator.applyGroupState has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote (cyclomatic 16) · ×1
  • ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote (cyclomatic 16) bitchat/ViewModels/ChatLiveVoiceCoordinator.swift:256 — ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote has cyclomatic complexity 16 (threshold 15). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatMessageFormatter.formatMessageHeader (cyclomatic 16) · ×1
  • ChatMessageFormatter.formatMessageHeader (cyclomatic 16) bitchat/ViewModels/ChatMessageFormatter.swift:351 — ChatMessageFormatter.formatMessageHeader has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ChatPrivateConversationCoordinator.handlePrivateMessage (cyclomatic 16) · ×1
  • ChatPrivateConversationCoordinator.handlePrivateMessage (cyclomatic 16) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:485 — ChatPrivateConversationCoordinator.handlePrivateMessage has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLEConnectionScheduler.handleDiscovery (cyclomatic 16) · ×1
  • BLEConnectionScheduler.handleDiscovery (cyclomatic 16) bitchat/Services/BLE/BLEConnectionScheduler.swift:80 — BLEConnectionScheduler.handleDiscovery has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · BLERadioController.updateScanningDutyCycle (cyclomatic 16) · ×1
  • BLERadioController.updateScanningDutyCycle (cyclomatic 16) bitchat/Services/BLE/BLERadioController.swift:88 — BLERadioController.updateScanningDutyCycle has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AnnounceV2Packet.decode (cyclomatic 16) · ×1
  • AnnounceV2Packet.decode (cyclomatic 16) localPackages/BitFoundation/Sources/BitFoundation/AnnounceV2Packet.swift:110 — AnnounceV2Packet.decode 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 · ×1
  • TodoComment bitchat/Services/BLE/BLEService.swift:2012 — // TODO(#1434): negotiate an explicit per-peer fragment limit so a future
D2 · Cognitive Complexity · ChatMessageFormatter.formatMessageAsText (cognitive 286) · ×1
  • ChatMessageFormatter.formatMessageAsText (cognitive 286) bitchat/ViewModels/ChatMessageFormatter.swift:17 — ChatMessageFormatter.formatMessageAsText has cognitive complexity 286 (threshold 15). Drivers by points: if/else 44 (155 pts), ternaries 19 (69 pts), loops 12 (40 pts), boolean chains 22 (nesting depth added 189). Of this number, 249 points are the body's own statements and 37 belong to 4 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NoiseSessionManager.handleIncomingHandshakeWithResult (cognitive 94) · ×1
  • NoiseSessionManager.handleIncomingHandshakeWithResult (cognitive 94) bitchat/Noise/NoiseSessionManager.swift:526 — NoiseSessionManager.handleIncomingHandshakeWithResult has cognitive complexity 94 (threshold 15). Drivers by points: if/else 34 (68 pts), boolean chains 23, ternaries 1 (2 pts), error handling 1 (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MeshPeerList.body (cognitive 92) · ×1
  • MeshPeerList.body (cognitive 92) bitchat/Views/MeshPeerList.swift:39 — MeshPeerList.body has cognitive complexity 92 (threshold 15). Drivers by points: if/else 27 (55 pts), ternaries 11 (35 pts), loops 1 (2 pts) (nesting depth added 53). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · MessageOutboxStore.save (cognitive 76) · ×1
  • MessageOutboxStore.save (cognitive 76) bitchat/Services/Courier/MessageOutboxStore.swift:256 — MessageOutboxStore.save has cognitive complexity 76 (threshold 15). Drivers by points: if/else 16 (38 pts), ternaries 8 (23 pts), boolean chains 12, match/switch 2 (3 pts) (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GossipSyncManager._handleRequestSync (cognitive 74) · ×1
  • GossipSyncManager._handleRequestSync (cognitive 74) bitchat/Sync/GossipSyncManager.swift:418 — GossipSyncManager._handleRequestSync has cognitive complexity 74 (threshold 15). Drivers by points: if/else 24 (55 pts), loops 7 (14 pts), boolean chains 5 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BinaryProtocol.decodeCore (cognitive 74) · ×1
  • BinaryProtocol.decodeCore (cognitive 74) localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:267 — BinaryProtocol.decodeCore has cognitive complexity 74 (threshold 15). Drivers by points: if/else 41 (63 pts), boolean chains 7, loops 2 (4 pts) (nesting depth added 24). Of this number, 70 points are the body's own statements and 4 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageOutboxStore.retryDeferredLoad (cognitive 63) · ×1
  • MessageOutboxStore.retryDeferredLoad (cognitive 63) bitchat/Services/Courier/MessageOutboxStore.swift:470 — MessageOutboxStore.retryDeferredLoad has cognitive complexity 63 (threshold 15). Drivers by points: if/else 15 (27 pts), ternaries 9 (18 pts), boolean chains 17, match/switch 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NotificationStreamAssembler.append (cognitive 59) · ×1
  • NotificationStreamAssembler.append (cognitive 59) bitchat/Services/NotificationStreamAssembler.swift:37 — NotificationStreamAssembler.append has cognitive complexity 59 (threshold 15). Drivers by points: if/else 24 (47 pts), ternaries 2 (6 pts), boolean chains 5, loops 1 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrivateChatManager.consolidateMessages (cognitive 56) · ×1
  • PrivateChatManager.consolidateMessages (cognitive 56) bitchat/Services/PrivateChatManager.swift:93 — PrivateChatManager.consolidateMessages has cognitive complexity 56 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 4 (9 pts), boolean chains 5, ternaries 1 (4 pts) (nesting depth added 31). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BLEService.sendOnAllLinks (cognitive 56) · ×1
  • BLEService.sendOnAllLinks (cognitive 56) bitchat/Services/BLE/BLEService.swift:2261 — BLEService.sendOnAllLinks has cognitive complexity 56 (threshold 15). Drivers by points: if/else 17 (30 pts), ternaries 4 (14 pts), boolean chains 11, loops 1 (nesting depth added 23). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded (cognitive 53) · ×1
  • BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded (cognitive 53) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:507 — BLEPrivateMediaReceiptStore.loadDurableStateIfNeeded has cognitive complexity 53 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 10, error handling 4 (6 pts), loops 5 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MimeType.matches (cognitive 53) · ×1
  • MimeType.matches (cognitive 53) bitchat/Services/BLE/MimeType.swift:114 — MimeType.matches has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 47, if/else 4 (5 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · BinaryProtocol.encode (cognitive 50) · ×1
  • BinaryProtocol.encode (cognitive 50) localPackages/BitFoundation/Sources/BitFoundation/BinaryProtocol.swift:133 — BinaryProtocol.encode has cognitive complexity 50 (threshold 15). Drivers by points: if/else 26 (29 pts), loops 4 (8 pts), ternaries 6 (7 pts), boolean chains 6 (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NoiseHandshakeState.writeMessage (cognitive 47) · ×1
  • NoiseHandshakeState.writeMessage (cognitive 47) bitchat/Noise/NoiseProtocol.swift:614 — NoiseHandshakeState.writeMessage has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (38 pts), boolean chains 6, match/switch 1 (2 pts), loops 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BoardWire.decode (cognitive 47) · ×1
  • BoardWire.decode (cognitive 47) bitchat/Protocols/BoardPackets.swift:184 — BoardWire.decode has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 12, match/switch 2 (3 pts), loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeohashPeopleList.body (cognitive 47) · ×1
  • GeohashPeopleList.body (cognitive 47) bitchat/Views/GeohashPeopleList.swift:25 — GeohashPeopleList.body has cognitive complexity 47 (threshold 15). Drivers by points: if/else 14 (25 pts), ternaries 9 (20 pts), loops 1 (2 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.startFragmentedPacket (cognitive 43) · ×1
  • BLEService.startFragmentedPacket (cognitive 43) bitchat/Services/BLE/BLEService.swift:5498 — BLEService.startFragmentedPacket has cognitive complexity 43 (threshold 15). Drivers by points: if/else 22 (37 pts), boolean chains 4, loops 2 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BitchatMessage.init (cognitive 43) · ×1
  • BitchatMessage.init (cognitive 43) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:221 — BitchatMessage.init has cognitive complexity 43 (threshold 15). Drivers by points: if/else 20 (36 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RequestSyncPacket.decode (cognitive 41) · ×1
  • RequestSyncPacket.decode (cognitive 41) bitchat/Models/RequestSyncPacket.swift:87 — RequestSyncPacket.decode has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (24 pts), loops 3 (9 pts), boolean chains 6, match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BitchatFilePacket.decode (cognitive 41) · ×1
  • BitchatFilePacket.decode (cognitive 41) bitchat/Protocols/BitchatFilePacket.swift:69 — BitchatFilePacket.decode has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (29 pts), loops 3 (7 pts), boolean chains 3, match/switch 1 (2 pts) (nesting depth added 20). Of this number, 35 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.
D2 · Cognitive Complexity · CashuTokenDecoder.decodeV4 (cognitive 41) · ×1
  • CashuTokenDecoder.decodeV4 (cognitive 41) bitchat/Services/CashuTokenDecoder.swift:162 — CashuTokenDecoder.decodeV4 has cognitive complexity 41 (threshold 15). Drivers by points: loops 5 (19 pts), if/else 5 (18 pts), match/switch 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cognitive 40) · ×1
  • ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cognitive 40) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:847 — ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (27 pts), loops 3 (7 pts), boolean chains 6 (nesting depth added 20). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · BLEService.broadcastPacket (cognitive 38) · ×1
  • BLEService.broadcastPacket (cognitive 38) bitchat/Services/BLE/BLEService.swift:1968 — BLEService.broadcastPacket has cognitive complexity 38 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GossipSyncManager._onPublicPacketSeen (cognitive 37) · ×1
  • GossipSyncManager._onPublicPacketSeen (cognitive 37) bitchat/Sync/GossipSyncManager.swift:273 — GossipSyncManager._onPublicPacketSeen has cognitive complexity 37 (threshold 15). Drivers by points: if/else 18 (33 pts), boolean chains 3, match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceRecordingViewModel.start (cognitive 37) · ×1
  • VoiceRecordingViewModel.start (cognitive 37) bitchat/ViewModels/VoiceRecordingViewModel.swift:80 — VoiceRecordingViewModel.start has cognitive complexity 37 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 12, error handling 3 (5 pts), ternaries 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 · CommandProcessor.handleBlock (cognitive 36) · ×1
  • CommandProcessor.handleBlock (cognitive 36) bitchat/Services/CommandProcessor.swift:299 — CommandProcessor.handleBlock has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (23 pts), loops 2 (6 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageListView.body (cognitive 36) · ×1
  • MessageListView.body (cognitive 36) bitchat/Views/MessageListView.swift:57 — MessageListView.body has cognitive complexity 36 (threshold 15). Drivers by points: if/else 23 (26 pts), boolean chains 9, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · KeychainManager.deleteAllKeychainData (cognitive 35) · ×1
  • KeychainManager.deleteAllKeychainData (cognitive 35) bitchat/Services/KeychainManager.swift:669 — KeychainManager.deleteAllKeychainData has cognitive complexity 35 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 8, loops 1 (2 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageRouter.retrySecurePrivateMessagesAfterAuthentication (cognitive 35) · ×1
  • MessageRouter.retrySecurePrivateMessagesAfterAuthentication (cognitive 35) bitchat/Services/MessageRouter.swift:592 — MessageRouter.retrySecurePrivateMessagesAfterAuthentication has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (23 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeoRelayDirectory.validatedDirectoryAddress (cognitive 34) · ×1
  • GeoRelayDirectory.validatedDirectoryAddress (cognitive 34) bitchat/Nostr/GeoRelayDirectory.swift:515 — GeoRelayDirectory.validatedDirectoryAddress has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 24, if/else 7 (9 pts), ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · MessageFormattingEngine.findAllMatches (cognitive 34) · ×1
  • MessageFormattingEngine.findAllMatches (cognitive 34) bitchat/Services/MessageFormattingEngine.swift:282 — MessageFormattingEngine.findAllMatches has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, loops 8, ternaries 7 (nesting depth added 4). Of this number, 21 points are the body's own statements and 13 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · BLEAnnounceHandler.handle (cognitive 34) · ×1
  • BLEAnnounceHandler.handle (cognitive 34) bitchat/Services/BLE/BLEAnnounceHandler.swift:98 — BLEAnnounceHandler.handle has cognitive complexity 34 (threshold 15). Drivers by points: if/else 20 (24 pts), boolean chains 9, match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BLEIncomingFileStore.expireAgedMedia (cognitive 34) · ×1
  • BLEIncomingFileStore.expireAgedMedia (cognitive 34) bitchat/Services/BLE/BLEIncomingFileStore.swift:605 — BLEIncomingFileStore.expireAgedMedia has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (24 pts), error handling 2 (5 pts), loops 2 (5 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEPrivateMediaReceiptStore.recoverDeletionJournal (cognitive 34) · ×1
  • BLEPrivateMediaReceiptStore.recoverDeletionJournal (cognitive 34) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:720 — BLEPrivateMediaReceiptStore.recoverDeletionJournal has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 5, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MeshTopologyTracker.computeRoute (cognitive 33) · ×1
  • MeshTopologyTracker.computeRoute (cognitive 33) bitchat/Services/MeshTopologyTracker.swift:85 — MeshTopologyTracker.computeRoute has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (26 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 15). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEIncomingFileStore.enforceQuota (cognitive 33) · ×1
  • BLEIncomingFileStore.enforceQuota (cognitive 33) bitchat/Services/BLE/BLEIncomingFileStore.swift:527 — BLEIncomingFileStore.enforceQuota has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageRouter.flushOutbox (cognitive 32) · ×1
  • MessageRouter.flushOutbox (cognitive 32) bitchat/Services/MessageRouter.swift:694 — MessageRouter.flushOutbox has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.handleLinkEvent (cognitive 32) · ×1
  • BLEService.handleLinkEvent (cognitive 32) bitchat/Services/BLE/BLEService.swift:5720 — BLEService.handleLinkEvent has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (8 pts), boolean chains 3, match/switch 1 (nesting depth added 14). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · validate_georelays._validated_dataset (cognitive 32) · ×1
  • validate_georelays._validated_dataset (cognitive 32) scripts/validate_georelays.py:104 — validate_georelays._validated_dataset has cognitive complexity 32 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 6, error handling 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageRouter.courierBecameAvailable (cognitive 30) · ×1
  • MessageRouter.courierBecameAvailable (cognitive 30) bitchat/Services/MessageRouter.swift:306 — MessageRouter.courierBecameAvailable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 5 (15 pts), boolean chains 9, loops 3 (6 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MinimalDistancePalette.rebuildEntries (cognitive 30) · ×1
  • MinimalDistancePalette.rebuildEntries (cognitive 30) bitchat/ViewModels/MinimalDistancePalette.swift:85 — MinimalDistancePalette.rebuildEntries has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 6 (9 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 11). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLERadioController.updateScanningDutyCycle (cognitive 30) · ×1
  • BLERadioController.updateScanningDutyCycle (cognitive 30) bitchat/Services/BLE/BLERadioController.swift:88 — BLERadioController.updateScanningDutyCycle has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 3, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PrekeyBundle.decode (cognitive 30) · ×1
  • PrekeyBundle.decode (cognitive 30) localPackages/BitFoundation/Sources/BitFoundation/PrekeyBundle.swift:122 — PrekeyBundle.decode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 6, loops 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NoiseHandshakeState.performDHOperation (cognitive 29) · ×1
  • NoiseHandshakeState.performDHOperation (cognitive 29) bitchat/Noise/NoiseProtocol.swift:782 — NoiseHandshakeState.performDHOperation has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 6, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BLENoisePacketHandler.handleEncrypted (cognitive 29) · ×1
  • BLENoisePacketHandler.handleEncrypted (cognitive 29) bitchat/Services/BLE/BLENoisePacketHandler.swift:197 — BLENoisePacketHandler.handleEncrypted has cognitive complexity 29 (threshold 15). Drivers by points: if/else 14 (26 pts), error handling 3 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.sendPendingNoisePayloadsAfterHandshake (cognitive 29) · ×1
  • BLEService.sendPendingNoisePayloadsAfterHandshake (cognitive 29) bitchat/Services/BLE/BLEService.swift:6887 — BLEService.sendPendingNoisePayloadsAfterHandshake has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (18 pts), boolean chains 3, match/switch 1 (3 pts), error handling 1 (2 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MessageOutboxStore.load (cognitive 29) · ×1
  • MessageOutboxStore.load (cognitive 29) bitchat/Services/Courier/MessageOutboxStore.swift:180 — MessageOutboxStore.load has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 4, ternaries 1 (2 pts), match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_georelays.normalize_relay_address (cognitive 29) · ×1
  • validate_georelays.normalize_relay_address (cognitive 29) scripts/validate_georelays.py:56 — validate_georelays.normalize_relay_address has cognitive complexity 29 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 10, error handling 1, loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GeoRelayDirectory.validatedEntries (cognitive 28) · ×1
  • GeoRelayDirectory.validatedEntries (cognitive 28) bitchat/Nostr/GeoRelayDirectory.swift:442 — GeoRelayDirectory.validatedEntries has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 12, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FavoritesPersistenceService.loadFavorites (cognitive 28) · ×1
  • FavoritesPersistenceService.loadFavorites (cognitive 28) bitchat/Services/FavoritesPersistenceService.swift:238 — FavoritesPersistenceService.loadFavorites has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), loops 4 (10 pts), boolean chains 2, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatMediaTransferCoordinator.handleTransferEvent (cognitive 28) · ×1
  • ChatMediaTransferCoordinator.handleTransferEvent (cognitive 28) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:1009 — ChatMediaTransferCoordinator.handleTransferEvent has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (24 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · BLEPrivateMediaReceiptStore.state (cognitive 28) · ×1
  • BLEPrivateMediaReceiptStore.state (cognitive 28) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:126 — BLEPrivateMediaReceiptStore.state has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (19 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NostrRelayManager.flushMessageQueue (cognitive 27) · ×1
  • NostrRelayManager.flushMessageQueue (cognitive 27) bitchat/Nostr/NostrRelayManager.swift:693 — NostrRelayManager.flushMessageQueue has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 3 (7 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatLifecycleCoordinator.markPrivateMessagesAsRead (cognitive 27) · ×1
  • ChatLifecycleCoordinator.markPrivateMessagesAsRead (cognitive 27) bitchat/ViewModels/ChatLifecycleCoordinator.swift:169 — ChatLifecycleCoordinator.markPrivateMessagesAsRead has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NostrInboundPipeline.processNostrMessage (cognitive 27) · ×1
  • NostrInboundPipeline.processNostrMessage (cognitive 27) bitchat/ViewModels/NostrInboundPipeline.swift:429 — NostrInboundPipeline.processNostrMessage has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (21 pts), match/switch 1 (4 pts), boolean chains 1, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BitchatMessage.toBinaryPayload (cognitive 27) · ×1
  • BitchatMessage.toBinaryPayload (cognitive 27) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:125 — BitchatMessage.toBinaryPayload has cognitive complexity 27 (threshold 15). Drivers by points: if/else 19 (21 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PrivateConversationModel.resolveDisplayName (cognitive 26) · ×1
  • PrivateConversationModel.resolveDisplayName (cognitive 26) bitchat/App/PrivateConversationModels.swift:289 — PrivateConversationModel.resolveDisplayName has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 10 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NostrRelayManager.subscribe (cognitive 26) · ×1
  • NostrRelayManager.subscribe (cognitive 26) bitchat/Nostr/NostrRelayManager.swift:739 — NostrRelayManager.subscribe has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3 (6 pts), boolean chains 3, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnnouncementPacket.decode (cognitive 26) · ×1
  • AnnouncementPacket.decode (cognitive 26) bitchat/Protocols/Packets.swift:96 — AnnouncementPacket.decode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (6 pts), boolean chains 3, match/switch 1 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatMediaTransferCoordinator.scheduleReconnectRetries (cognitive 26) · ×1
  • ChatMediaTransferCoordinator.scheduleReconnectRetries (cognitive 26) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:1520 — ChatMediaTransferCoordinator.scheduleReconnectRetries has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WaveformCache.computeWaveform (cognitive 26) · ×1
  • WaveformCache.computeWaveform (cognitive 26) bitchat/Features/voice/Waveform.swift:59 — WaveformCache.computeWaveform has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 3 (9 pts), ternaries 1 (3 pts), boolean chains 1, error handling 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.handleAnnounce (cognitive 26) · ×1
  • BLEService.handleAnnounce (cognitive 26) bitchat/Services/BLE/BLEService.swift:6103 — BLEService.handleAnnounce has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 9 (12 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · CourierEnvelope.decode (cognitive 26) · ×1
  • CourierEnvelope.decode (cognitive 26) localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:120 — CourierEnvelope.decode has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (20 pts), boolean chains 3, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEPrivateMediaReceiptStore.recordDeleted (cognitive 25) · ×1
  • BLEPrivateMediaReceiptStore.recordDeleted (cognitive 25) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:288 — BLEPrivateMediaReceiptStore.recordDeleted has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 13, if/else 10 (11 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AuthenticatedPeerStatePacket.decode (cognitive 24) · ×1
  • AuthenticatedPeerStatePacket.decode (cognitive 24) bitchat/Protocols/Packets.swift:199 — AuthenticatedPeerStatePacket.decode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VouchAttestation.decode (cognitive 24) · ×1
  • VouchAttestation.decode (cognitive 24) bitchat/Protocols/VouchAttestation.swift:145 — VouchAttestation.decode has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CBORReader.parseValue (cognitive 24) · ×1
  • CBORReader.parseValue (cognitive 24) bitchat/Services/CashuTokenDecoder.swift:257 — CBORReader.parseValue has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 2 (4 pts), boolean chains 2, ternaries 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocationStateManager.locationNamesByLevel (cognitive 24) · ×1
  • LocationStateManager.locationNamesByLevel (cognitive 24) bitchat/Services/LocationStateManager.swift:481 — LocationStateManager.locationNamesByLevel has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 12, if/else 12. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · BLEService.configureNoiseServiceCallbacks (cognitive 24) · ×1
  • BLEService.configureNoiseServiceCallbacks (cognitive 24) bitchat/Services/BLE/BLEService.swift:4016 — BLEService.configureNoiseServiceCallbacks has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 9, match/switch 1 (2 pts), error handling 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParsedInbound.init (cognitive 23) · ×1
  • ParsedInbound.init (cognitive 23) bitchat/Nostr/NostrRelayManager.swift:1733 — ParsedInbound.init has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 9, ternaries 1 (3 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · UnifiedPeerService.updatePeers (cognitive 23) · ×1
  • UnifiedPeerService.updatePeers (cognitive 23) bitchat/Services/UnifiedPeerService.swift:79 — UnifiedPeerService.updatePeers has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 3, boolean chains 2, ternaries 2 (nesting depth added 7). Of this number, 21 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatPublicConversationCoordinator.handlePublicMessage (cognitive 23) · ×1
  • ChatPublicConversationCoordinator.handlePublicMessage (cognitive 23) bitchat/ViewModels/ChatPublicConversationCoordinator.swift:448 — ChatPublicConversationCoordinator.handlePublicMessage has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NostrInboundPipeline.handleNostrEvent (cognitive 23) · ×1
  • NostrInboundPipeline.handleNostrEvent (cognitive 23) bitchat/ViewModels/NostrInboundPipeline.swift:196 — NostrInboundPipeline.handleNostrEvent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (14 pts), boolean chains 8, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ContentView.body (cognitive 23) · ×1
  • ContentView.body (cognitive 23) bitchat/Views/ContentView.swift:229 — ContentView.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 9, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BridgeService.handleRendezvousEvent (cognitive 23) · ×1
  • BridgeService.handleRendezvousEvent (cognitive 23) bitchat/Services/Gateway/BridgeService.swift:432 — BridgeService.handleRendezvousEvent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TextMessageView.body (cognitive 23) · ×1
  • TextMessageView.body (cognitive 23) bitchat/Views/Components/TextMessageView.swift:35 — TextMessageView.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, ternaries 2 (3 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · BLEService.sendFilePrivate (cognitive 22) · ×1
  • BLEService.sendFilePrivate (cognitive 22) bitchat/Services/BLE/BLEService.swift:1569 — BLEService.sendFilePrivate has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12 (18 pts), match/switch 2, boolean chains 1, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnnounceV2Packet.decode (cognitive 22) · ×1
  • AnnounceV2Packet.decode (cognitive 22) localPackages/BitFoundation/Sources/BitFoundation/AnnounceV2Packet.swift:110 — AnnounceV2Packet.decode has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 2, match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PeerListModel.buildRecentChatRows (cognitive 21) · ×1
  • PeerListModel.buildRecentChatRows (cognitive 21) bitchat/App/PeerListModel.swift:298 — PeerListModel.buildRecentChatRows has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3, boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RelayController.decide (cognitive 21) · ×1
  • RelayController.decide (cognitive 21) bitchat/Services/RelayController.swift:12 — RelayController.decide has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, ternaries 3 (5 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NostrInboundPipeline.subscribeNostrEvent (cognitive 21) · ×1
  • NostrInboundPipeline.subscribeNostrEvent (cognitive 21) bitchat/ViewModels/NostrInboundPipeline.swift:118 — NostrInboundPipeline.subscribeNostrEvent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 6, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · VoiceRecordingViewModel.finish (cognitive 21) · ×1
  • VoiceRecordingViewModel.finish (cognitive 21) bitchat/ViewModels/VoiceRecordingViewModel.swift:164 — VoiceRecordingViewModel.finish has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 2 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FingerprintView.body (cognitive 21) · ×1
  • FingerprintView.body (cognitive 21) bitchat/Views/FingerprintView.swift:65 — FingerprintView.body has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ShareViewController.processShare (cognitive 20) · ×1
  • ShareViewController.processShare (cognitive 20) bitchatShareExtension/ShareViewController.swift:50 — ShareViewController.processShare has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceBurstPacket.decode (cognitive 20) · ×1
  • VoiceBurstPacket.decode (cognitive 20) bitchat/Protocols/VoiceBurstPacket.swift:99 — VoiceBurstPacket.decode has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 3, loops 1 (2 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CashuTokenDecoder.decodeV3 (cognitive 20) · ×1
  • CashuTokenDecoder.decodeV3 (cognitive 20) bitchat/Services/CashuTokenDecoder.swift:127 — CashuTokenDecoder.decodeV3 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 4, loops 2 (3 pts), ternaries 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 · CommandProcessor.process (cognitive 20) · ×1
  • CommandProcessor.process (cognitive 20) bitchat/Services/CommandProcessor.swift:105 — CommandProcessor.process has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 5, match/switch 2, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SharedContentPayload.validate (cognitive 20) · ×1
  • SharedContentPayload.validate (cognitive 20) bitchat/Services/SharedContentHandoff.swift:58 — SharedContentPayload.validate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 6, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GossipSyncManager.buildGcsPayload (cognitive 20) · ×1
  • GossipSyncManager.buildGcsPayload (cognitive 20) bitchat/Sync/GossipSyncManager.swift:553 — GossipSyncManager.buildGcsPayload has cognitive complexity 20 (threshold 15). Drivers by points: if/else 14, loops 2 (4 pts), boolean chains 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatGroupCoordinator.applyGroupState (cognitive 20) · ×1
  • ChatGroupCoordinator.applyGroupState (cognitive 20) bitchat/ViewModels/ChatGroupCoordinator.swift:542 — ChatGroupCoordinator.applyGroupState has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEFanoutSelector.collapseDuplicateLinksPerPeer (cognitive 20) · ×1
  • BLEFanoutSelector.collapseDuplicateLinksPerPeer (cognitive 20) bitchat/Services/BLE/BLEFanoutSelector.swift:158 — BLEFanoutSelector.collapseDuplicateLinksPerPeer has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 4, loops 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEPrivateMediaReceiptStore.commitAccepted (cognitive 20) · ×1
  • BLEPrivateMediaReceiptStore.commitAccepted (cognitive 20) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:214 — BLEPrivateMediaReceiptStore.commitAccepted has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · NoiseHandshakeState.readMessage (cognitive 19) · ×1
  • NoiseHandshakeState.readMessage (cognitive 19) bitchat/Noise/NoiseProtocol.swift:726 — NoiseHandshakeState.readMessage has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (7 pts), error handling 2 (6 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Geohash.decodeCenter (cognitive 19) · ×1
  • Geohash.decodeCenter (cognitive 19) bitchat/Protocols/Geohash.swift:76 — Geohash.decodeCenter has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Geohash.decodeBounds) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Geohash.decodeBounds (cognitive 19) · ×1
  • Geohash.decodeBounds (cognitive 19) bitchat/Protocols/Geohash.swift:102 — Geohash.decodeBounds has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (Geohash.decodeCenter) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · ChatMediaTransferCoordinator.cleanupLocalFile (cognitive 19) · ×1
  • ChatMediaTransferCoordinator.cleanupLocalFile (cognitive 19) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:1127 — ChatMediaTransferCoordinator.cleanupLocalFile has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 6, error handling 2 (4 pts), loops 1, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatTransportEventCoordinator.handleNoisePayload (cognitive 19) · ×1
  • ChatTransportEventCoordinator.handleNoisePayload (cognitive 19) bitchat/ViewModels/ChatTransportEventCoordinator.swift:424 — ChatTransportEventCoordinator.handleNoisePayload has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ContentHeaderView.body (cognitive 19) · ×1
  • ContentHeaderView.body (cognitive 19) bitchat/Views/ContentHeaderView.swift:43 — ContentHeaderView.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8, ternaries 6 (7 pts), boolean chains 2, match/switch 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BLEService.deliverTransportEvent (cognitive 19) · ×1
  • BLEService.deliverTransportEvent (cognitive 19) bitchat/Services/BLE/BLEService.swift:3577 — BLEService.deliverTransportEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.openCourierEnvelope (cognitive 19) · ×1
  • BLEService.openCourierEnvelope (cognitive 19) bitchat/Services/BLE/BLEService.swift:4626 — BLEService.openCourierEnvelope has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2, ternaries 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CourierStore.merge (cognitive 19) · ×1
  • CourierStore.merge (cognitive 19) bitchat/Services/Courier/CourierStore.swift:542 — CourierStore.merge has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, match/switch 1 (3 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BridgeService.classify (cognitive 19) · ×1
  • BridgeService.classify (cognitive 19) bitchat/Services/Gateway/BridgeService.swift:836 — BridgeService.classify has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (7 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · ConversationStore.auditInvariants (cognitive 18) · ×1
  • ConversationStore.auditInvariants (cognitive 18) bitchat/App/ConversationStore.swift:723 — ConversationStore.auditInvariants has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (6 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NoiseCipherState.markNonceAsSeen (cognitive 18) · ×1
  • NoiseCipherState.markNonceAsSeen (cognitive 18) bitchat/Noise/NoiseProtocol.swift:191 — NoiseCipherState.markNonceAsSeen has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 1 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · NostrRelayManager.handleDisconnection (cognitive 18) · ×1
  • NostrRelayManager.handleDisconnection (cognitive 18) bitchat/Nostr/NostrRelayManager.swift:1459 — NostrRelayManager.handleDisconnection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · LocationNotesManager.subscribe (cognitive 18) · ×1
  • LocationNotesManager.subscribe (cognitive 18) bitchat/Services/LocationNotesManager.swift:225 — LocationNotesManager.subscribe has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11, boolean chains 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 · ChatMediaTransferCoordinator.sendVoiceNote (cognitive 18) · ×1
  • ChatMediaTransferCoordinator.sendVoiceNote (cognitive 18) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:550 — ChatMediaTransferCoordinator.sendVoiceNote has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatMediaTransferCoordinator.sendImage (cognitive 18) · ×1
  • ChatMediaTransferCoordinator.sendImage (cognitive 18) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:693 — ChatMediaTransferCoordinator.sendImage has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, error handling 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatViewModel.panicClearAllData (cognitive 18) · ×1
  • ChatViewModel.panicClearAllData (cognitive 18) bitchat/ViewModels/ChatViewModel.swift:1555 — ChatViewModel.panicClearAllData has cognitive complexity 18 (threshold 15). Drivers by points: if/else 14 (17 pts), error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · NoticesView.reconcileGeoSession (cognitive 18) · ×1
  • NoticesView.reconcileGeoSession (cognitive 18) bitchat/Views/NoticesView.swift:119 — NoticesView.reconcileGeoSession has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MediaMessageView.body (cognitive 18) · ×1
  • MediaMessageView.body (cognitive 18) bitchat/Views/Media/MediaMessageView.swift:35 — MediaMessageView.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 4, ternaries 2 (3 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked (cognitive 17) · ×1
  • NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked (cognitive 17) bitchat/Noise/NoiseSessionManager.swift:886 — NoiseSessionManager.scheduleOrdinaryResponderTimeoutLocked has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9, boolean chains 7, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · PrivateMediaMessageIdentity.stableID (cognitive 17) · ×1
  • PrivateMediaMessageIdentity.stableID (cognitive 17) bitchat/Protocols/BitchatFilePacket.swift:183 — PrivateMediaMessageIdentity.stableID has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 1, match/switch 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocationStateManager.resolveCompositeAdminName · ×1
  • LocationStateManager.resolveCompositeAdminName::step (cognitive 17) bitchat/Services/LocationStateManager.swift:554 — LocationStateManager.resolveCompositeAdminName::step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 4 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NostrTransport.sendAckItem (cognitive 17) · ×1
  • NostrTransport.sendAckItem (cognitive 17) bitchat/Services/NostrTransport.swift:359 — NostrTransport.sendAckItem has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 6). 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 · ContentPeopleSheetView.body (cognitive 17) · ×1
  • ContentPeopleSheetView.body (cognitive 17) bitchat/Views/ContentSheetViews.swift:125 — ContentPeopleSheetView.body has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11, boolean chains 5, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BLEService.handleReceivedPacketOnQueue (cognitive 17) · ×1
  • BLEService.handleReceivedPacketOnQueue (cognitive 17) bitchat/Services/BLE/BLEService.swift:5931 — BLEService.handleReceivedPacketOnQueue has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (16 pts), match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CourierStore.deposit (cognitive 17) · ×1
  • CourierStore.deposit (cognitive 17) bitchat/Services/Courier/CourierStore.swift:173 — CourierStore.deposit has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AppRuntime.handleScenePhaseChange (cognitive 16) · ×1
  • AppRuntime.handleScenePhaseChange (cognitive 16) bitchat/App/AppRuntime.swift:199 — AppRuntime.handleScenePhaseChange has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 5). 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 · Geohash.encode (cognitive 16) · ×1
  • Geohash.encode (cognitive 16) bitchat/Protocols/Geohash.swift:27 — Geohash.encode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NostrCarrierPacket.decode (cognitive 16) · ×1
  • NostrCarrierPacket.decode (cognitive 16) bitchat/Protocols/NostrCarrierPacket.swift:105 — NostrCarrierPacket.decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AnnouncementPacket.encode (cognitive 16) · ×1
  • AnnouncementPacket.encode (cognitive 16) bitchat/Protocols/Packets.swift:42 — AnnouncementPacket.encode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · CommandProcessor.handleEmote (cognitive 16) · ×1
  • CommandProcessor.handleEmote (cognitive 16) bitchat/Services/CommandProcessor.swift:256 — CommandProcessor.handleEmote has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), ternaries 2 (5 pts), match/switch 1 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote (cognitive 16) · ×1
  • ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote (cognitive 16) bitchat/ViewModels/ChatLiveVoiceCoordinator.swift:256 — ChatLiveVoiceCoordinator.absorbFinalizedVoiceNote has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 6, ternaries 2, match/switch 1 (nesting depth added 2). Of this number, 13 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChatMessageFormatter.formatMessageHeader (cognitive 16) · ×1
  • ChatMessageFormatter.formatMessageHeader (cognitive 16) bitchat/ViewModels/ChatMessageFormatter.swift:351 — ChatMessageFormatter.formatMessageHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 5, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatMessageFormatter.isSelfMessage (cognitive 16) · ×1
  • ChatMessageFormatter.isSelfMessage (cognitive 16) bitchat/ViewModels/ChatMessageFormatter.swift:401 — ChatMessageFormatter.isSelfMessage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatViewModel.performPrivateChatClear · ×1
  • ChatViewModel.performPrivateChatClear::continueClear (cognitive 16) bitchat/ViewModels/ChatViewModel.swift:835 — ChatViewModel.performPrivateChatClear::continueClear has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · ChatViewModel.isSelfSender (cognitive 16) · ×1
  • ChatViewModel.isSelfSender (cognitive 16) bitchat/ViewModels/ChatViewModel.swift:1335 — ChatViewModel.isSelfSender has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GeoPresenceTracker.subscribeNostrEvent (cognitive 16) · ×1
  • GeoPresenceTracker.subscribeNostrEvent (cognitive 16) bitchat/ViewModels/GeoPresenceTracker.swift:98 — GeoPresenceTracker.subscribeNostrEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 12, boolean chains 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · NostrInboundPipeline.processGeohashGiftWrap (cognitive 16) · ×1
  • NostrInboundPipeline.processGeohashGiftWrap (cognitive 16) bitchat/ViewModels/NostrInboundPipeline.swift:333 — NostrInboundPipeline.processGeohashGiftWrap has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · NostrInboundPipeline.findNoiseKey (cognitive 16) · ×1
  • NostrInboundPipeline.findNoiseKey (cognitive 16) bitchat/ViewModels/NostrInboundPipeline.swift:519 — NostrInboundPipeline.findNoiseKey has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEConnectionScheduler.handleDiscovery (cognitive 16) · ×1
  • BLEConnectionScheduler.handleDiscovery (cognitive 16) bitchat/Services/BLE/BLEConnectionScheduler.swift:80 — BLEConnectionScheduler.handleDiscovery has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, match/switch 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · BLEFileTransferHandler.storeIncomingFile (cognitive 16) · ×1
  • BLEFileTransferHandler.storeIncomingFile (cognitive 16) bitchat/Services/BLE/BLEFileTransferHandler.swift:233 — BLEFileTransferHandler.storeIncomingFile has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 2, match/switch 1 (2 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · BLEService.privateMediaSendPolicy (cognitive 16) · ×1
  • BLEService.privateMediaSendPolicy (cognitive 16) bitchat/Services/BLE/BLEService.swift:1174 — BLEService.privateMediaSendPolicy has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (7 pts), boolean chains 5, ternaries 2 (4 pts) (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BLEService.handleReceivedPacket (cognitive 16) · ×1
  • BLEService.handleReceivedPacket (cognitive 16) bitchat/Services/BLE/BLEService.swift:5881 — BLEService.handleReceivedPacket has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · BridgeCourierService.handleDropEvent (cognitive 16) · ×1
  • BridgeCourierService.handleDropEvent (cognitive 16) bitchat/Services/Gateway/BridgeCourierService.swift:554 — BridgeCourierService.handleDropEvent has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · GroupCrypto.openMessage (cognitive 16) · ×1
  • GroupCrypto.openMessage (cognitive 16) bitchat/Services/Groups/GroupProtocol.swift:513 — GroupCrypto.openMessage has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), match/switch 1 (2 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D22 · Internal API Consistency · Ambiguous overlap in lifecycle management. 'startIfNeeded' implies a general check-and-start, while 'ensureRunningOnForeground' implies a state-dependent action triggered by foregrounding. It is unclear if 'ensureRunningOnForeground' calls 'startIfNeeded' or if they are mutually exclusive entry points. This creates confusion about the correct API to use when the app transitions to the foreground. · ×1
  • Ambiguous overlap in lifecycle management. 'startIfNeeded' implies a general check-and-start, while 'ensureRunningOnForeground' implies a state-dependent action triggered by foregrounding. It is unclear if 'ensureRunningOnForeground' calls 'startIfNeeded' or if they are mutually exclusive entry points. This creates confusion about the correct API to use when the app transitions to the foreground. — Consolidate into a single lifecycle method, e.g., 'startIfNeeded()', and handle the foreground/background state internally, or clearly distinguish them by scope (e.g., 'startIfNeeded()' for general boot, 'activateForForeground()' for UI-driven activation). (signatures: TorManager.startIfNeeded() | TorManager.ensureRunningOnForeground())
D22 · Internal API Consistency · Redundant method signatures. Having two methods with the same name differing only by a default parameter for padding is acceptable in Swift, but if 'padding' is a rarely used or internal concern, it clutters the public API. More importantly, if 'toBinaryData()' always pads, the overload is redundant. If it conditionally pads, the naming is inconsistent with the 'forSigning' variant. · ×1
  • Redundant method signatures. Having two methods with the same name differing only by a default parameter for padding is acceptable in Swift, but if 'padding' is a rarely used or internal concern, it clutters the public API. More importantly, if 'toBinaryData()' always pads, the overload is redundant. If it conditionally pads, the naming is inconsistent with the 'forSigning' variant. — Rename to 'toBinaryData()' (standard encoding) and 'toBinaryDataForSigning()' (explicitly for signing, as already exists). Remove the 'padding' parameter overload unless padding is a critical, frequently toggled feature for general serialization, in which case rename to 'toBinaryData(padded: Bool)' for clarity. (signatures: BitchatPacket.toBinaryData(padding: Bool): Data? | BitchatPacket.toBinaryData(): Data?)
D35 · Change Coupling · Change-coupling hub · ×1
  • Change-coupling hub: ContentView.swift → BitchatPeer.swift, GeohashPeopleList.swift, MeshPeerList.swift bitchat/Views/ContentView.swift — `bitchat/Views/ContentView.swift` changes together with 3 other files — `bitchat/Models/BitchatPeer.swift`, `bitchat/Views/GeohashPeopleList.swift`, `bitchat/Views/MeshPeerList.swift` — none of which declares a dependency on it: one file is the hub of 3 separate couplings, not 3 unrelated pairs. Read the hub first: if the others each duplicate a part of what it does, the shared concern belongs in ONE unit and extracting it clears every edge at once; if the hub is a registry, dispatcher or barrel that must name each of them, the coupling is structural and the question is whether that list can be discovered instead of enumerated. Fixing the hub is one change; breaking the couplings one pair at a time is 3.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Edited copy of a member (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) bitchat/Protocols/Geohash.swift:76 — bitchat/Protocols/Geohash.swift:76-97 | bitchat/Protocols/Geohash.swift:102-121 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×1
  • Edited copy of a member (13 corresponding lines) bitchat/Services/VerificationService.swift:148 — bitchat/Services/VerificationService.swift:148-163 | bitchat/Services/VerificationService.swift:165-178 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (8 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (8 members, 50+ identical tokens) bitchat/Services/Board/BoardStore.swift:357 — bitchat/Services/Board/BoardStore.swift:357-367 | bitchat/Services/Courier/CourierStore.swift:618-628 | bitchat/Services/Courier/MessageOutboxStore.swift:887-897 | bitchat/Services/Gateway/BridgeDropDedupStore.swift:126-136 | bitchat/Services/Groups/GroupStore.swift:206-216 | bitchat/Services/NostrProcessedEventStore.swift:96-106 | bitchat/Services/Prekeys/PrekeyBundleStore.swift:205-215 | bitchat/Sync/GossipMessageArchive.swift:69-79 — These 8 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 8 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 8 times.
D4 · Code Duplication · Duplicated block (67–71 lines × 2) · ×1
  • Duplicated block (67–71 lines × 2) bitchat/Noise/NoiseProtocol.swift:644 — bitchat/Noise/NoiseProtocol.swift:644-714 | bitchat/Noise/NoiseProtocol.swift:784-850 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Noise/NoiseProtocol.swift:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) bitchat/Views/Components/TextMessageView.swift:74 — bitchat/Views/Components/TextMessageView.swift:74-103 | bitchat/Views/Media/MediaMessageView.swift:64-92 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/Components/TextMessageView.swift:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `alignment` to `.firstTextBaseline` in one and `.center` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Views/Components/TextMessageView.swift:104` calls `padding` and `bitchat/Views/Media/MediaMessageView.swift:93` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (16–26 lines × 2) · ×1
  • Duplicated block (16–26 lines × 2) bitchat/Services/Gateway/BridgeService.swift:534 — bitchat/Services/Gateway/BridgeService.swift:534-549 | bitchat/Services/Gateway/GatewayService.swift:190-215 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeService.swift:534` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–24 lines × 2) · ×1
  • Duplicated block (19–24 lines × 2) bitchat/Features/media/ImageUtils.swift:57 — bitchat/Features/media/ImageUtils.swift:57-80 | bitchat/Features/media/ImageUtils.swift:140-158 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Features/media/ImageUtils.swift:57` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×1
  • Duplicated block (21–22 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:20 — bitchat/ViewModels/ChatMessageFormatter.swift:20-40 | bitchat/ViewModels/ChatMessageFormatter.swift:402-423 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–21 lines × 2) · ×1
  • Duplicated block (17–21 lines × 2) bitchat/Nostr/NostrProtocol.swift:533 — bitchat/Nostr/NostrProtocol.swift:533-553 | bitchat/Nostr/NostrProtocol.swift:562-578 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Nostr/NostrProtocol.swift:533` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) bitchat/Services/BLE/BLEService.swift:1865 — bitchat/Services/BLE/BLEService.swift:1865-1882 | bitchat/Services/BLE/BLEService.swift:2675-2695 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/BLE/BLEService.swift:1865` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) bitchat/Services/KeychainManager.swift:474 — bitchat/Services/KeychainManager.swift:474-494 | bitchat/Services/KeychainManager.swift:614-634 — both copies are in the same file, so extract the 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 lines × 2) · ×1
  • Duplicated block (20 lines × 2) bitchat/Services/NoiseEncryptionService.swift:367 — bitchat/Services/NoiseEncryptionService.swift:367-386 | bitchat/Services/NoiseEncryptionService.swift:391-410 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/NoiseEncryptionService.swift:367` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×1
  • Duplicated block (18–20 lines × 2) bitchat/Views/MessageListView.swift:645 — bitchat/Views/MessageListView.swift:645-664 | bitchat/Views/MessageListView.swift:689-706 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/MessageListView.swift:645` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 2) · ×1
  • Duplicated block (17–19 lines × 2) bitchat/Features/voice/PTTAudioCodec.swift:117 — bitchat/Features/voice/PTTAudioCodec.swift:117-135 | bitchat/Features/voice/PTTAudioCodec.swift:158-174 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Features/voice/PTTAudioCodec.swift:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×1
  • Duplicated block (15–18 lines × 2) bitchat/Services/PrivateChatManager.swift:104 — bitchat/Services/PrivateChatManager.swift:104-118 | bitchat/ViewModels/ChatTransportEventCoordinator.swift:392-409 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/PrivateChatManager.swift:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×1
  • Duplicated block (18 lines × 2) bitchat/ViewModels/ChatMediaTransferCoordinator.swift:642 — bitchat/ViewModels/ChatMediaTransferCoordinator.swift:642-659 | bitchat/ViewModels/ChatMediaTransferCoordinator.swift:673-690 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMediaTransferCoordinator.swift:642` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:61 — bitchat/ViewModels/ChatMessageFormatter.swift:61-77 | bitchat/ViewModels/ChatMessageFormatter.swift:384-397 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMessageFormatter.swift:61` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:586 — bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:586-601 | bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:623-635 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:586` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×1
  • Duplicated block (16 lines × 2) bitchat/Views/Components/TextMessageView.swift:46 — bitchat/Views/Components/TextMessageView.swift:46-61 | bitchat/Views/Media/MediaMessageView.swift:44-59 — 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–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) bitchat/ViewModels/ChatViewModelBootstrapper.swift:337 — bitchat/ViewModels/ChatViewModelBootstrapper.swift:337-351 | bitchat/ViewModels/ChatViewModelBootstrapper.swift:417-427 — both copies are in the same file, so extract the 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 (14 lines × 4) · ×1
  • Duplicated block (14 lines × 4) bitchat/Services/BLE/BLEService.swift:1627 — bitchat/Services/BLE/BLEService.swift:1627-1640 | bitchat/Services/BLE/BLEService.swift:1644-1657 | bitchat/Services/BLE/BLEService.swift:1672-1685 | bitchat/Services/BLE/BLEService.swift:1691-1704 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (7–13 lines × 3) · ×1
  • Duplicated block (7–13 lines × 3) bitchat/Services/MessageRouter.swift:666 — bitchat/Services/MessageRouter.swift:666-678 | bitchat/Services/MessageRouter.swift:725-731 | bitchat/Services/MessageRouter.swift:762-768 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/MessageRouter.swift:666` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Services/MessageRouter.swift:732` calls `insert`, `PeerMessageKey` and `bitchat/Services/MessageRouter.swift:769` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×1
  • Duplicated block (13 lines × 2) bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:411 — bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:411-423 | bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift:455-467 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×1
  • Duplicated block (12–13 lines × 2) bitchat/Views/FingerprintView.swift:134 — bitchat/Views/FingerprintView.swift:134-146 | bitchat/Views/FingerprintView.swift:168-179 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/FingerprintView.swift:134` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–12 lines × 3) · ×1
  • Duplicated block (10–12 lines × 3) bitchat/Services/MessageFormattingEngine.swift:220 — bitchat/Services/MessageFormattingEngine.swift:220-231 | bitchat/ViewModels/ChatMessageFormatter.swift:61-70 | bitchat/ViewModels/ChatMessageFormatter.swift:384-393 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/MessageFormattingEngine.swift:220` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/ViewModels/ChatMessageFormatter.swift:395` calls `appendVerifiedSeal` and `bitchat/Services/MessageFormattingEngine.swift:233` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×1
  • Duplicated block (11–12 lines × 2) bitchat/Services/Gateway/BridgeService.swift:590 — bitchat/Services/Gateway/BridgeService.swift:590-600 | bitchat/Services/Gateway/GatewayService.swift:271-282 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeService.swift:590` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11 lines × 8) · ×1
  • Duplicated block (11 lines × 8) bitchat/Services/Board/BoardStore.swift:357 — bitchat/Services/Board/BoardStore.swift:357-367 | bitchat/Services/Courier/CourierStore.swift:618-628 | bitchat/Services/Courier/MessageOutboxStore.swift:887-897 | bitchat/Services/Gateway/BridgeDropDedupStore.swift:126-136 | bitchat/Services/Groups/GroupStore.swift:206-216 | bitchat/Services/NostrProcessedEventStore.swift:96-106 | bitchat/Services/Prekeys/PrekeyBundleStore.swift:205-215 | bitchat/Sync/GossipMessageArchive.swift:69-79 — before extracting anything, compare `bitchat/Services/Gateway/BridgeDropDedupStore.swift` and `bitchat/Services/NostrProcessedEventStore.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 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 (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) bitchat/Sync/GossipSyncManager.swift:455 — bitchat/Sync/GossipSyncManager.swift:455-465 | bitchat/Sync/GossipSyncManager.swift:493-503 | bitchat/Sync/GossipSyncManager.swift:507-517 | bitchat/Sync/GossipSyncManager.swift:539-549 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Sync/GossipSyncManager.swift:455` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Sync/GossipSyncManager.swift:473` calls `decodeFragmentIdFilter` and `bitchat/Sync/GossipSyncManager.swift:506` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) bitchat/Services/Gateway/BridgeDropDedupStore.swift:101 — bitchat/Services/Gateway/BridgeDropDedupStore.swift:101-111 | bitchat/Services/NostrProcessedEventStore.swift:77-87 | bitchat/Sync/GossipMessageArchive.swift:40-50 — before extracting anything, compare `bitchat/Services/Gateway/BridgeDropDedupStore.swift` and `bitchat/Services/NostrProcessedEventStore.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeDropDedupStore.swift:101` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×1
  • Duplicated block (10–11 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:136 — bitchat/ViewModels/ChatMessageFormatter.swift:136-146 | bitchat/ViewModels/ChatMessageFormatter.swift:257-266 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/ViewModels/ChatMessageFormatter.swift:136` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×1
  • Duplicated block (9–11 lines × 2) bitchat/Views/ContentSheetViews.swift:286 — bitchat/Views/ContentSheetViews.swift:286-296 | bitchat/Views/ContentView.swift:437-445 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Views/ContentSheetViews.swift:286` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) bitchat/Sync/GossipSyncManager.swift:456 — bitchat/Sync/GossipSyncManager.swift:456-465 | bitchat/Sync/GossipSyncManager.swift:479-489 | bitchat/Sync/GossipSyncManager.swift:494-503 | bitchat/Sync/GossipSyncManager.swift:508-517 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Sync/GossipSyncManager.swift:456` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/Sync/GossipSyncManager.swift:473` calls `decodeFragmentIdFilter` and `bitchat/Sync/GossipSyncManager.swift:492` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) bitchat/Services/VerificationService.swift:149 — bitchat/Services/VerificationService.swift:149-158 | bitchat/Services/VerificationService.swift:166-173 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×1
  • Duplicated block (9 lines × 3) bitchat/Services/Courier/CourierStore.swift:476 — bitchat/Services/Courier/CourierStore.swift:476-484 | bitchat/Services/Gateway/BridgeDropDedupStore.swift:110-118 | bitchat/Services/NostrProcessedEventStore.swift:86-94 — before extracting anything, compare `bitchat/Services/Gateway/BridgeDropDedupStore.swift` and `bitchat/Services/NostrProcessedEventStore.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 46 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Courier/CourierStore.swift:476` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) bitchat/Services/Gateway/BridgeService.swift:654 — bitchat/Services/Gateway/BridgeService.swift:654-660 | bitchat/Services/Gateway/GatewayService.swift:335-343 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `bitchat/Services/Gateway/BridgeService.swift:654` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5–8 lines × 3) · ×1
  • Duplicated block (5–8 lines × 3) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:295 — localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:295-302 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:304-311 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:313-317 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:313` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×1
  • Duplicated block (7 lines × 2) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:257 — localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:257-263 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:268-274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D5 · Coupling · Off the main sequence · ×1
  • Off the main sequence: BitLogger — BitLogger: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
Minor — 45 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×11
  • Duplicated predicate bitchat/App/AppRuntime.swift:111 — `!key.isEmpty && key == post.authorSigningKey` appears character-identically in 2 files — bitchat/App/AppRuntime.swift, bitchat/Services/Board/BoardManager.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/LocationStateManager.swift:138 — `NSClassFromString("XCTestCase") != nil || env["XCTestConfigurationFilePath"] != nil || env["XCTestBundlePath"] != nil || env["GITHUB_ACTIONS…` appears character-identically in 3 files — bitchat/Services/LocationStateManager.swift, bitchat/Services/NotificationService.swift, bitchat/Services/TestEnvironment.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/MessageFormattingEngine.swift:290 — `content.contains("://") || content.contains("www.") || content.contains("http")` appears character-identically in 2 files — bitchat/Services/MessageFormattingEngine.swift, bitchat/ViewModels/ChatMessageFormatter.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/MessageFormattingEngine.swift:291 — `content.lowercased().contains("ln") || content.lowercased().contains("lightning:")` appears character-identically in 2 files — bitchat/Services/MessageFormattingEngine.swift, bitchat/ViewModels/ChatMessageFormatter.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/ViewModels/GeoPresenceTracker.swift:101 — `event.kind == NostrProtocol.EventKind.ephemeralEvent.rawValue || event.kind == NostrProtocol.EventKind.geohashPresence.rawValue` appears character-identically in 2 files — bitchat/ViewModels/GeoPresenceTracker.swift, bitchat/ViewModels/NostrInboundPipeline.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Views/ContentSheetViews.swift:70 — `includingVoiceAlert && voiceRecordingVM.showAlert` appears character-identically in 2 files — bitchat/Views/ContentSheetViews.swift, bitchat/Views/ContentView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Views/Components/TextMessageView.swift:79 — `message.isPrivate && conversationUIModel.isSentByCurrentUser(message)` appears character-identically in 2 files — bitchat/Views/Components/TextMessageView.swift, bitchat/Views/Media/MediaMessageView.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/App/ConversationUIModel.swift:155 — `message.sender == currentNickname || message.sender.hasPrefix(currentNickname + "#")` appears character-identically in 2 files — bitchat/App/ConversationUIModel.swift, bitchat/ViewModels/ChatViewModel.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/BLE/BLEDirectedRelaySpool.swift:71 — `order.count > capacity || payloadBytes > byteBudget` appears character-identically in 2 files — bitchat/Services/BLE/BLEDirectedRelaySpool.swift, bitchat/Sync/GossipSyncManager.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/BLE/BLEIngressLinkRegistry.swift:120 — `packet.type == MessageType.announce.rawValue && packet.ttl == directAnnounceTTL` appears character-identically in 2 files — bitchat/Services/BLE/BLEIngressLinkRegistry.swift, bitchat/Services/BLE/BLEOutboundLinkPlanner.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
  • Duplicated predicate bitchat/Services/BLE/BLEFileTransferPolicy.swift:11 — `peerID == localPeerID && packet.ttl != 0` appears character-identically in 2 files — bitchat/Services/BLE/BLEFileTransferPolicy.swift, bitchat/Services/BLE/BLEPublicMessagePolicy.swift. It is one line, so the duplication detector's token window never sees it; the copies drift when only one is corrected. Give the condition a name and one home.
X4 · Structured logging · Interpolated log message defeats structured logging · ×9
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/socks.rs:130 — `debug!` at line 130 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/socks.rs:137 — `debug!` at line 137 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/socks.rs:149 — `debug!` at line 149 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/socks.rs:185 — `debug!` at line 185 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/socks.rs:190 — `debug!` at line 190 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/lib.rs:105 — `error!` at line 105 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `error!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/lib.rs:286 — `info!` at line 286 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `info!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/lib.rs:297 — `debug!` at line 297 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `debug!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
  • Interpolated log message defeats structured logging localPackages/Arti/arti-bitchat/src/lib.rs:302 — `warn!` at line 302 is handed a format string with `{…}` values in it, so tracing records one finished `message` field — the values in it cannot be queried, filtered or aggregated as fields, and every occurrence reads as a different message. Record the values as fields beside a constant message instead: `warn!(order_id = %order_id, status = ?status, "order status updated")` (`%` records a value by its `Display`, `?` by its `Debug`, a bare name as itself), which a JSON subscriber, OpenTelemetry or a log store keeps as queryable keys. An error goes in as a field too: `error = %err`.
M4 · Documentation accuracy · README/code drift · ×6
  • README/code drift docs/CONVERSATION-STORE-DESIGN.md:129 — docs/CONVERSATION-STORE-DESIGN.md names `bitchat/ViewModels/PublicTimelineStore.swift`, but no file or folder `bitchat/ViewModels/PublicTimelineStore.swift` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/GeohashPresenceSpec.md:11 — docs/GeohashPresenceSpec.md documents the environment variable `GEOHASH_PRESENCE`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/PEER-ID-ROTATION.md:214 — docs/PEER-ID-ROTATION.md documents the environment variable `TAG_SLOTS`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/PUSH-TO-TALK-DESIGN.md:143 — docs/PUSH-TO-TALK-DESIGN.md names `bitchat/Services/PTT/`, but no file or folder `bitchat/Services/PTT` exists. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/REQUEST_SYNC_MANAGER.md:17 — docs/REQUEST_SYNC_MANAGER.md documents the environment variable `IS_RSR`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
  • README/code drift docs/SOURCE_ROUTING.md:46 — docs/SOURCE_ROUTING.md documents the environment variable `HAS_RECIPIENT`, but no code, script or configuration file names it. Checked without a model against the repository: its files and folders, the scripts and dependencies of every package.json, the projects, namespaces, package references and target frameworks of the .NET build, the SDK and Node pins, and the identifiers of every file that is not a document; the documents' own text never counts. A footprint generated at build time, read only by a platform, or living outside this repository is not seen, and this row is then wrong.
D34 · Knowledge Freshness · Orphaned file · ×4
  • Orphaned file bitchat/Views/Image Viewers/ImagePreviewView.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file bitchat/Nostr/Bech32.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file bitchat/Noise/NoiseRateLimiter.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file bitchat/Sync/RequestSyncManager.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
D16 · Bus Factor · Off-boarding risk · ×1
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 83 significant file(s) lose their only recent owner: bitchat/Noise/NoiseSessionManager.swift, bitchat/Services/Gateway/BridgeService.swift, bitchat/Services/BLE/BLEPrivateMediaReceiptStore.swift, bitchat/ViewModels/ChatPrivateConversationCoordinator.swift, bitchat/App/ConversationStore.swift, bitchat/Services/Courier/MessageOutboxStore.swift, bitchat/Views/NoticesView.swift, bitchat/ViewModels/ChatGroupCoordinator.swift (+75 more). Pair on, review, or document these before any departure.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (85 single-owned of 232 analysed files in total, 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; 232 of the 308 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: bitchat/Services/BLE/MimeType.swift, bitchat/Models/ReadReceipt.swift.
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 · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 5 project(s) overshoot their size bounds, lowering Project Cohesion to 6.0/10. The most over is `(repository root)` (71177 LoC, 652 module-visible types across 26 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D34 · Knowledge Freshness · Orphaned files with no living knowledge · ×1
  • Orphaned files with no living knowledge — 4 of 232 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; 232 of the 308 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: bitchat/Views/Image Viewers/ImagePreviewView.swift, bitchat/Nostr/Bech32.swift, bitchat/Noise/NoiseRateLimiter.swift, bitchat/Sync/RequestSyncManager.swift. 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
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.
P10 · Library API & versioning · Large public API surface · ×1
  • Large public API surface — 27/35 types (77%) declared in the published library are public. For a library, every public type is a stability contract — keep implementation types off the surface and expose only the intended API.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST — No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 37496 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
P6 · Release Hygiene · No changelog · ×1
  • No changelog — No CHANGELOG/HISTORY/RELEASES file — what shipped when isn't easy to reconstruct for support or audit. (Versioning/tagging makes releases traceable, but a changelog records the what.)
X7 · Silent fallback defaults · Silent fallback default in catch · ×1
  • Silent fallback default in catch bitchat/Services/BLE/BLEIncomingFileStore.swift:687 — `migrateFileProtectionIfNeeded` turns every thrown error into `0` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default on Err · ×1
  • Silent fallback default on Err localPackages/Arti/arti-bitchat/src/lib.rs:196 — `arti_bootstrap_summary` turns every `Err` into `-1` — a failure becomes a plausible value and a silent behavior change with no trail. Log the error or propagate it with `?`. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the arm or in the doc comment, and the row stops firing.
Minor — 1 finding(s)
D12 · Dependency Hygiene · Outdated · ×1
  • Outdated: swift-secp256k1 — `swift-secp256k1` is resolved at 0.21.1, but 0.24.0 is the newest release tagged on https://github.com/21-DOT-DEV/swift-secp256k1 within the same major. SwiftPM resolves from git tags, and a `from:` requirement admits every release below the next major — so `swift package update swift-secp256k1` reaches this one with no change to Package.swift.

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-41fc279dafa14e929b5239d94783f99b/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-41fc279dafa14e929b5239d94783f99b/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 .15artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .15artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 15 file(s) — `bitchat/Features/voice/PTTBurstPlayer.swift`, `bitchat/Noise/NoiseSessionManager.swift`, `bitchat/Services/CashuTokenDecoder.swift`, `bitchat/ViewModels/ChatLiveVoiceCoordinator.swift`, `bitchat/ViewModels/ChatMediaTransferCoordinator.swift`, … (+10 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a1673e-d026-7b11-942e-1c359c6195e0 · 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