Public report of permissionlesstech/bitchat, published 11 November 2026. It has the same score, grades and number of
findings as the full report. The details of security findings (where they are in the code, which known
vulnerabilities and which passwords or keys were found) are left out, so nobody can use them against the project.
Public
Executive reportMeasured under the Code Assurance Index, an open standard for code quality, using its published scoring rules (rubric version 2026.11.2). Assert signed this survey and filed it in the standard's public register, where anyone can look it up by its survey ID. Check this survey →
Signed and filed in the standard's public register, 11 November 2026, 12:45 UTC · Survey ID cd_152b0a87c6e44111968e589b7db8fdbc
permissionlesstech/bitchat
Measured 11 November 2026, 12:35 UTC, at code version 04995f6
CAI scoreAdequate
CriticalWeakAdequateStrongExemplary
Up 3 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: 77,980 lines of product code in 5 projects, tests not counted · Estimated rebuild effort: about 1.0 person-years · Weakest lens: Event-Driven, 40
Findings by how serious they are
24 critical494 serious31 minor
32 dimensions are left out of the score. For each one, we either couldn't measure it in this code, or found no evidence of the safeguard we look for, such as a tested backup restore. They count neither for nor against the score, and Limitations lists each one with its reason.
This survey was produced by
Canine Code Analyzer
Producer
Canine Development
Analyzer
Canine Code Analyzer engine 1.0.0
Measured
11 November 2026, 12:35 UTC
A measurement, not a certificate. The Code Assurance Index records a number
together with the evidence it was worked out from, so anyone can recalculate it, but it doesn't certify or guarantee
the code. The standard was written by Canine Development, which also builds the Canine Code Analyzer. It is open to any tool that
implements it, and today the Canine Code Analyzer is the only one that does.
The score is deterministic, which means the same code always gets the same score. We work it out with tools that follow published rules, and an AI model never decides it, so anyone who applies the same rules to the same code gets the same number. How it is done is explained under Methodology ▸
43of 43 dimensions measured by tools.
536of 549 findings point to an exact file and line, so you can open each one in the code. The other 13 concern the repository as a whole, such as missing documentation.
43dimensions across 7 lenses, read from 77,980 lines of product code in 5 projects.
permissionlesstech/bitchat falls short of our standard for production because it has message handlers that wait for another service. It scores 53 out of 100 and is rated Adequate, and 15 of its 24 critical findings are security problems in the build pipeline.
Event-Driven, at 40, is the weakest lens and counts most in the score. The best first step is stopping the event handlers from waiting on other services, worth about 11 points. Adding automated security scanning is another step, worth about 5 points. Raising Event-Driven to 70 would lift the score to about 62.
Thirteen pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Two pipeline steps put outside input straight into a shell command, so an attacker can run commands in the build pipeline. Pinning each tool to an exact version and passing outside input through environment variables would close both risks. Letting the handler publish a message instead of waiting for the reply would take care of the five message handlers that wait for another service.
The product code is 77,980 lines, about €140,000 to rebuild. Two of our security checks couldn't finish, among them the one for known security holes in its packages, so those results are missing, not clean passes.
A lens is capped at Adequate while one of its dimensions scores below 4 out of 10, however well the rest of the lens does. That way a serious problem in one place always shows in the lens's rating.
How the score is built: what each lens counts forThe lenses don't count equally. The weakest lens counts most, the next weakest a little less, and so on, so a weak area pulls the score down instead of being averaged away. In the bar below, each part's width shows how much that lens counts and its colour shows its rating. Improving the widest part moves the score most, and as that lens improves, it counts for less, because another lens becomes the weakest.
We compare 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: 62 findings
These 62 critical or serious findings were in the previous survey, on 23 October 2026, and are gone from this one.
Dependency Vulnerabilities · High CVE: [GHSA redacted] localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium CVE: [GHSA redacted] localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium CVE: [GHSA redacted] localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium CVE: RUSTSEC-2023-0071 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unmaintained): RUSTSEC-2024-0436 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unmaintained): RUSTSEC-2025-0141 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unmaintained): RUSTSEC-2026-0173 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unsound): RUSTSEC-2026-0012 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unsound): RUSTSEC-2026-0097 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unsound): RUSTSEC-2026-0097 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unsound): RUSTSEC-2026-0186 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium advisory (unsound): RUSTSEC-2026-0221 localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium vulnerability: [GHSA redacted] localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium vulnerability: [GHSA redacted] localPackages/Arti/Cargo.lock
Dependency Vulnerabilities · Medium vulnerability: RUSTSEC-2026-0204 localPackages/Arti/Cargo.lock
Rebuild cost: about €140,000 · Estimate
Cost to rebuild
€47,000 to €230,000, for 777 to 2,464 hours of work, about 1.0 person-years for 1 to 2 engineers
Difficulty of the problem
Standard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor
×0.7 at a score of 53. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
Size
Medium: 77,980 lines of product code
What it is not
Not a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.
How the estimate is made: We price the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.
Top priorities
The three actions that raise the score most for the work they take. The full ranked list is in the Roadmap.
1
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
Resolve the 1 No ADRs found finding(s) in ADR Quality.
Raises the score by about 2 points · Low effort · ADR Quality
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.
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 €140,000 to build again, about 1.0 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 11 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 we estimate the extra work at 2% to 5% on every change. The history of the code shows how much it changes: about 24,318 lines over the last 90 days, which is about 98,623 lines a year. At that pace, the extra work comes to an estimated 5.4 to 32.9 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.
Architecture — module dependency graph
Project dependencies, layered top-to-bottom; arrows show direction. Any dashed red edge points upward or sideways, which only happens where the projects form a dependency cycle. A graph without cycles has none.
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 a module listed above itPart of a loopThe module itself
4→6 localPackages~BitFoundation~BitFoundation uses repositorypart of a loop✕
Connections
26 pairs of types, where a type in localPackages~BitFoundation~BitFoundation uses a type in repository. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
localPackages~BitFoundation~BitFoundation uses repository, so a change to repository can break localPackages~BitFoundation~BitFoundation, while a change to localPackages~BitFoundation~BitFoundation can't break repository.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
scripts uses scripts.validate_georelays, so a change to scripts.validate_georelays can break scripts, while a change to scripts can't break scripts.validate_georelays.
Position
Below the diagonal: scripts uses a module listed above it, which is the healthy direction.
294 pairs of types, where a type in repository uses a type in localPackages~BitFoundation~BitFoundation. Showing 25 of them; the rest are in namespace-graph.json in this report's bundle.
repository uses localPackages~BitFoundation~BitFoundation, so a change to localPackages~BitFoundation~BitFoundation can break repository, while a change to repository can't break localPackages~BitFoundation~BitFoundation.
Position
Below the diagonal: repository uses a module listed above it, which is the healthy direction.
6→7 repository uses localPackages~Artipart of a loop✕
Connections
2 pairs of types, where a type in repository uses a type in localPackages~Arti.
repository uses localPackages~Arti, so a change to localPackages~Arti can break repository, while a change to repository can't break localPackages~Arti.
Position
Above the diagonal, so it is part of a loop. Neither module can be changed, tested or released on its own until one of these dependencies is removed.
localPackages~Arti uses repository, so a change to repository can break localPackages~Arti, while a change to localPackages~Arti can't break repository.
Position
Below the diagonal: localPackages~Arti uses a module listed above it, which is the healthy direction.
localPackages~BitLogger uses repository, so a change to repository can break localPackages~BitLogger, while a change to localPackages~BitLogger can't break repository.
Position
Below the diagonal: localPackages~BitLogger uses a module listed above it, which is the healthy direction.
At a glance — Code Health · 75% · Adequate · gated by D2 ·
Findings mapped to OWASP categories; the specific CVEs/secrets are in the Security dimension cards below and findings.md (redacted only on the public version of this report).
OWASP category
Findings
Severity
A05:2025 — Injection
15
High / Critical
A03:2025 — Software Supply Chain Failures
7
Medium
Roadmap
Top priorities: Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource; 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; Adopt the transactional outbox pattern so DB writes and message publishes commit atomically — no lost or phantom events on a crash.
Ranked by impact ÷ effort. "Helps" is the estimated gain on the 0–100 health score.
Do this
Helps
Effort
Dimension
Replace the synchronous wait with `async`/`await` so the handler never blocks on a peer/resource.
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.
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.
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.
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 — 24
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 — 494
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 — 31
Recorded, with no effect on how the codebase functions.
Present so the survey is complete, not because it needs doing.
Could not be resolved — 32
Something this survey could not settle
from the outside, and which could be critical or serious. Either a control was required and no
positive evidence of it exists in the repository — a backup job that nothing shows was ever restored from proves
nothing about restores — or our own analysis could not run over that part of the tree. This is not a clean
result. These are excluded from the score rather than awarded a pass, so the number on the cover neither
rewards nor penalises them: if you act on this survey without resolving them, you carry that risk yourself. Each
one is named under Limitations.
Methodology & how to trust this report
This survey is a deep, periodic assessment — run each sprint, monthly, or quarterly, taking the time to go wider and deeper than a quick check and surfacing in one coherent report what you'd otherwise piece together from a dozen separate tools. It scores deterministically: the same commit yields the same score, every run. All 43 evaluated dimensions are computed by tools and static analysis; no language model sets or judges any of them. Overall confidence is 0.8, the weighted average across measured dimensions.
Every figure here is one of two kinds, and we label which: ✓ Measured — a deterministic fact (LoC, complexity, coverage); ~ Modeled — an estimate from a stated model (cost, effort, value-at-risk), always a range with its assumptions, never a precise fact. We never present a modelled estimate as if it were measured. Perfect or absent scores carry their provenance too (ADR-0011): ✓ Tool-verified means the property itself was measured across the surface; ○ Nothing flagged means the probes came back clean — a claim bounded by what a repository can show; ⊘ Not evidenced means a working control (a tested restore, an automated rollback) showed no positive evidence — absence of evidence is not evidence of a control, so it's excluded from the score rather than awarded a spurious 10.
What we checked — 43 dimensions across the health lenses
Each chip is a dimension scored from real signals across architecture, testing, dependencies, security & compliance, documentation, git-history and code quality — in one coherent pass. A surface report typically covers a handful.
How to trust any code-health report — three questions
Can you open the finding? Real findings cite a repo-relative file and line you can open at the cited line — never an absolute scratch path. Here, 536 of 549 do; the remainder are repo-wide signals — a dimension-level measurement, not a single line. (Every path in this report is repo-relative by construction: paths are normalized at the producer and the report is rejected if any rooted path leaks through.)
Is there a tool behind the number? Every score below names the method that produced it: Roslyn, git or a scanner, not a narrative.
Does re-running give the same result? Run it again on the same commit and the score — and this report, byte for byte — is identical. A report whose numbers move between runs is describing the run, not the code.
This report answers yes to all three. That's the bar to hold any assessment to.
Tools & methods
The actual versions used this run (captured at analysis time) — re-run on the same commit for the identical score.
Method
Backs
Version
Evaluator
Roslyn static analysis
Complexity, cohesion, coupling, dead code, API surface, layering
What ran differently this time — a tool absent, degraded, or that fell back to an estimate. Named openly, not folded silently into the scores. A degraded run also records its exact cause in diagnostics.md.
D11 Test Reliability — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test reliability not included — the Swift suite (3 packages) did not finish re-running within its budget: the Swift suite did not finish re-running within its tier budget.
D12 Dependency Hygiene — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Dependency Hygiene couldn't be assessed within its 5-minute budget on a solution this large — not included in this run.
D14 License Compliance — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a 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.
D19 Documentation Quality — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Each ecosystem's manifests (what makes a folder runnable or a published package) need their own proof before D19 judges its units. Until then those folders' READMEs are judged only as documents (boilerplate, structure), never counted as complete.
D21 Naming Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
D24 Comment Value — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
D30 Dependency Vulnerabilities — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Osv: osv-scanner exited 127 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 127 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
D32 Data Compliance (PII/GDPR) — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `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.
D43 Malicious Dependencies — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Osv: osv-scanner exited 127 with no findings — dependency CVEs were not measured. 'osv-scanner' exited 127 and produced no findings, and that exit code has no documented repo-side meaning — so this run measured nothing, and nothing here is a statement about the repository.
D44 Platform End-of-Life — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Subject: 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. We then boot it in an isolated sandbox and gathers real runtime evidence — you change nothing in your pipeline (no CI step, no SDK).
C1 Data Protection — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
C2 Access Controls — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
C3 Audit Trail — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's 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.
M4 Documentation accuracy — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. M4 checks only the claim kinds adjudicated at or above 95 % precision: links and versions (PREREGISTRATION version 9), and artefact counts an order of magnitude off. Paths, command arguments, installs, environment variables, settings, projects, packages, routes, cd targets, infrastructure products and removed modules are read but not checked, and none of them is reported or counted.
S1 Web-Security Posture — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
X1 Async correctness — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X12 Unreachable branch — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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.
X13 Undrained process stream — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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.
X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check 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.
X17 Uncapped recursion over a caller-supplied document — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Python, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Python, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and 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.
X19 Unrestored process-global state — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Python, 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 — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and 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, got, undici, node:http; 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.
X22 Contradicted release guard — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and Java, TypeScript/JavaScript, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded, and this repository's C, 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.
X23 Unguarded diagnostic materialisation — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, F#, Python, Dart, Ruby, Scala, Kotlin 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.
X24 Document value interpolated into markup unescaped — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Scala, Ruby and Python source only, and no C# was loaded and no JavaScript/TypeScript, Java, Scala, Ruby or Python 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.
X25 Inert configuration knob — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart and Ruby source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Scala, PHP, Erlang, Python, Dart or Ruby 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.
X4 Structured logging — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, 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: 9 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
We assess the repository exactly as committed, and only the repository. By design we do not reach outside the source tree: the live cloud account, the running CI/CD pipeline, the host's branch-protection and approval rules, the production configuration, or a restore actually exercised against a backup are all out of scope. That boundary is a feature, not a gap — a repo-relative, deterministic scan re-runs identically on any commit and every finding opens at a real file and line, where a live audit can neither be reproduced nor traced. The visible consequence is that controls which leave no in-repo evidence are reported as "not evidenced" and excluded from the score rather than awarded a number a static scan cannot justify.
Per-dimension blind spots
For each dimension that was measured, what a static, repo-only scan structurally cannot see — the honest edge of the measurement, not a failure of it.
D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
D8 Code Coverage: Coverage is measured by building and running the test suite inside our isolated image — the target repo is never modified, and nothing on your systems runs. So coverage exists only when the suite builds and runs within the inline time budget; one that needs external services, can't build, or exceeds the budget yields no coverage (D8 then degrades to not-measured, not a low score). Line coverage also says nothing about assertion quality.
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.
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.
D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
D27 Navigability: Indirection/navigability is structural — it measures hops to follow a call, not whether that indirection buys real flexibility or just ceremony.
D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
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.
AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
M4 Documentation accuracy: Documentation accuracy checks links, versions and artefact counts against the tree: other claims (paths, commands, settings, routes) are read but not checked, and it cannot run the onboarding or measure how long a real new joiner takes.
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.
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.
101 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.
+ 96 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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 6.0 to about 6.5/10.
Detailed fixes: d1_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: How hard the code is for a person to follow, beyond raw branching.
Method: Cognitive complexity per method (Sonar-style nesting-penalized score), computed exhaustively over production code, excluding test projects. Deterministic.
+ 137 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
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.
Detailed fixes: d2_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
Resolve the 19 FileTooLong finding(s) in God Classes — start with BLEService.swift, ChatMediaTransferCoordinator.swift, ChatViewModel.swift. — One of this dimension's main actionable groups (19 warning-level).
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).
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).
Detailed fixes: d3_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
81 duplicated block group(s) detected. A further 8 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted.
+ 50 more group(s) — more in Appendix A; the complete list is findings.md.
What to do
Resolve the 7 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with CommandProcessor.swift, BridgeService.swift, MessageFormattingEngine.swift. — One of this dimension's main actionable groups (7 warning-level).
Resolve the 6 Duplicated block (12 lines × 2) finding(s) in Code Duplication — start with CourierStore.swift, ChatPrivateConversationCoordinator.swift, ConnectivityStatusBanner.swift. — One of this dimension's main actionable groups (6 warning-level).
Resolve the 6 Duplicated block (10 lines × 2) finding(s) in Code Duplication — start with NoiseSessionManager.swift, XChaCha20Poly1305Compat.swift, BLEService.swift. — One of this dimension's main actionable groups (6 warning-level).
Detailed fixes: d4_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
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.
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
Resolve the 1 Off the main sequence finding(s) in Coupling. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d5_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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).
Detailed fixes: d6_recommendation.md · top locations in Appendix A, every location in findings.md.
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.
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.
Do you agree with this assessment?
D9 · Test Distribution10.0 / 10Exemplary✓ Tool-verified
What it measures: Whether the test suite has a healthy mix of unit / integration / end-to-end tests.
Method: Test projects classified (Unit/Integration/BDD/E2E) from compiled metadata; test methods counted exhaustively across projects with placement-agnostic disk fallback. Deterministic.
2639 test methods: 2550 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.
Do you agree with this assessment?
D10 · Test Quality9.7 / 10Stronggated by 55 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.
0 skipped, 55 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 2619 tests.
No assertions: garbagePayloadsNeverCrash · ×55bitchatTests/CashuTokenDecoderTests.swift:272
What to do
Resolve the 55 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 (55 warning-level).
Detailed fixes: d10_recommendation.md · top locations in Appendix A, every location in findings.md.
What it measures: Whether any secrets (keys, tokens, passwords) have leaked into the code.
Method: In-process native secret scanner (entropy plus signature patterns) across all tracked files; no external tool. A clean result is a measured 10, not no-data zero. Deterministic.
What it measures: Whether the licenses of third-party packages are compatible with your policy.
Method: Third-party package licenses resolved from declared package metadata and checked against the configured policy (allow/deny/copyleft). Deterministic; clean = no incompatible license found at metadata depth.
0 of 464 shipped crate(s) use a banned license. Licences were resolved from crates.io over the crates a consumer compiles — this repository's Cargo.lock closed over its manifests' `[dependencies]` and `[build-dependencies]`. Crates it asks for ONLY under `[dev-dependencies]` are excluded: they are not compiled by anything that depends on this repository. ★ 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.
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.
Resolve the 11 Hotspot finding(s) in Churn × Complexity Hotspots — start with ChatMessageFormatter.swift, BLEService.swift, ContentView.swift. — One of this dimension's main actionable groups (11 warning-level).
Detailed fixes: d15_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D16 · Bus Factor6.6 / 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.
83 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 241 of the 318 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
Resolve the 1 Off-boarding risk finding(s) in Bus Factor. — One of this dimension's main actionable groups (1 recommendation-level).
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.
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.
1 deducted task-comment markers across 77980 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.
Resolve the 1 TodoComment finding(s) in Explicit Debt — start with BLEService.swift. — One of this dimension's main actionable groups (1 warning-level).
Detailed fixes: d17_recommendation.md · top locations in Appendix A, every location in findings.md.
Do you agree with this assessment?
D20 · ADR Quality0.0 / 10Critical✓ Tool-verified
What it measures: Whether architecture decisions are recorded well (context, decision, consequences).
Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.
1 of 5 build units (Cargo, SwiftPM) flagged as possibly oversized/incoherent.
Projects may be oversized for their cohesion
What to do
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.
What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.
Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.
Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.
14 % of calls cross a namespace and 4 % go through an interface, but 100 % of collaborators are co-located — so a call's collaborators sit together and tracing stays easy. Baseline: small — navigation cost is tolerated.
What it measures: Whether any secrets were ever committed — scanned across the full git history, not just now.
Method: 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.
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).
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
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).
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.
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.
7 of 241 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is bitchat/Services/BLE/MimeType.swift. Counted over 241 of the 318 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.
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.
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).
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).
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.
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.
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).
Resolve the 1 REDACTED finding(s) in Supply-chain Provenance & Signing. — One of this dimension's main actionable groups (1 warning-level).
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.
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.
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.
Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).
Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.
Other · Architecture — Whether dependencies point inward (Domain ← Application ← Infrastructure/Web) — the clean-architecture dependency rule, checked across the project graph.
Method: Layer violations by name-segment inference (Domain/Core to Application to Infrastructure/Web) over the project-reference graph. Exhaustive over all projects, deterministic.
Do you agree with this assessment?
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.
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.
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.
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.
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
Describe the projects a newcomer cannot place from the root README: 4 of 4 have no README of their own, in their folder or in their family's project (`localPackages/Arti`, `localPackages/Arti/arti-bitchat`, `localPackages/BitFoundation`, `localPackages/BitLogger`).
Maturity · Maturity — Whether key decisions (ADRs) and the high-level shape (C4/diagrams) are written down.
Method: Filesystem scan: ADR folder/naming conventions or content, plus Mermaid/PlantUML/C4/architecture.md discovery. Exhaustive, deterministic.
No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
What to do
Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.
Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.
Readiness · Readiness — Whether an automated pipeline builds and tests every change.
Method: Filesystem scan: CI workflow files (.github/workflows, .gitlab-ci.yml, etc.) for build and test stages. Exhaustive, deterministic.
Do you agree with this assessment?
P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged
Readiness · Readiness — For a library: a deliberate (small) public API surface and explicit semantic versioning so consumers can depend on it safely.
Method: Roslyn scan: public API surface area and semantic-versioning markers (SemVer attributes, changelog entries) for libraries; off .NET, a library is the ecosystem's publication act (an npm package that is not private and names an entry point, a PyPI distribution with a build system, a Rust library crate, a Maven/Gradle module that publishes, a Go module with no package main, a gemspec, a Composer library, a SwiftPM library product, a pub.dev or Hex package), its surface is the share of types the language's code model records as public (Rust, Swift, Java, Kotlin, Go, Dart; not measured where the model records no type visibility or, as in TypeScript, only module-level export), and its version is read from the manifest, a semver CHANGELOG, release tooling or semver git tags. Exhaustive, deterministic.
Do you agree with this assessment?
P2 · Observability8.0 / 10Strong✓ Tool-verified
Readiness · Readiness — Whether the code is diagnosable in production — structured logging, tracing/metrics, health checks.
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 6 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner. — REDACTED:16
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.
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.
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.
Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.
Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from each language's code model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.
Do you agree with this assessment?
X28 · Index access outside its own emptiness guard10.0 / 10Exemplary○ Nothing flagged
Other · Code Health — Whether a condition that tests a value for emptiness indexes that same value only where the test holds — an `||` written one parenthesis too far to the left leaves an index access outside the guard beside it, so the empty case the guard exists to anticipate reaches the index and throws.
Method: Roslyn syntax only, no semantic model: the OUTERMOST `&&`/`||` of every boolean condition, read for a symbol the condition tests for emptiness (`string.IsNullOrEmpty`/`IsNullOrWhiteSpace`, a `Length`/`Count` comparison against a literal, `Any()`, a `Length`/`Count` pattern, or a comparison against `""`) and ALSO indexes. Each `symbol[...]` access is placed by a boolean-reachability walk from the access up to the outermost connective: an access is COVERED when some enclosing step has it in the right operand and the left operand, under the truth value that step forces, proves the symbol non-empty — a recursion over `&&`/`||` whose true- and false-directions are asymmetric. A finding needs BOTH an uncovered access and a covered one on the same symbol in the same condition, which is the agreeing twin that separates a misplaced parenthesis from an unrelated length test. Bare index accesses with no emptiness test in the condition are neither counted nor reported; a non-identifier receiver and a lambda nested inside the condition are outside the population. Deterministic, provable per finding. Advisory.
Other · Code Health — Whether exceptions are handled rather than silently swallowed or rethrown with lost stack traces.
Method: Roslyn syntax scan: every catch clause counted; empty catches and bare rethrows flagged. Population is all catch clauses, not estimated. Deterministic, hard fact.
`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) — localPackages/Arti/Sources/TorManager.swift:156, bitchat/ViewModels/ChatViewModel.swift:1109, bitchat/Services/NoiseEncryptionService.swift:1135, …
What to do
Swallowed exception (caught, then discarded)
Do you agree with this assessment?
Reference — by lens
The score is the rank-weighted fold of these lenses (worst-heaviest), each including its meta-dimensions; a lens with a Critical contributor is capped at Fair (its band reads "gated by …") and is never the strongest area however high its average.
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 — 10 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 — 75 check(s) not relevant to this codebase
These checks had nothing to measure here (no tests, no git history, the codebase is small, or the architecture style doesn't apply), so they're omitted above rather than scored low.
AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
AX1 Captive dependencies — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
AX2 Stateful singletons — 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.
D11 Test Reliability — Test reliability not included
D12 Dependency Hygiene — Dependency Hygiene not included (time budget)
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.
D19 Documentation Quality — D19 reads .NET projects and npm packages as units; 2 folder(s) declared by Cargo.toml were not judged for an overview, an example or the map.
D21 Naming Consistency — Naming consistency is measured on C# and TypeScript only; Python, Rust, Swift not measured.
D22 Internal API Consistency — API consistency is measured on C# only; the exposed Swift surface was not measured.
D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. 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 — D24 reads C#, Visual Basic, TypeScript and JavaScript comments only — this repository's production source is .py, .rs, .swift, which was left unread. Not scored: this is a gap in the analyzer, not a verdict about this repository.
D25 ADR Conformance — no ADRs to check
D30 Dependency Vulnerabilities — Scanner failed to run — not a clean result
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.
D43 Malicious Dependencies — Scanner failed to run — not a clean result
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 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.
PF2 Allocation hygiene — Not scored: this check counted allocation-aware idioms (Span, pools, stackalloc) per line, which describes what kind of code a repository is rather than whether it has an allocation problem, so it was withdrawn. Nothing here is a finding about your code.
S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
X1 Async correctness — X1 reached only 1% of this repository's production lines — swift (77,293 lines), c (132 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
X12 Unreachable branch — 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
X13 Undrained process stream — 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
X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X16 Unfloored truncation loop — 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
X17 Uncapped recursion over a caller-supplied document — 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
X19 Unrestored process-global state — 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.
X21 Side-effecting pattern guard — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X22 Contradicted release guard — 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
X23 Unguarded diagnostic materialisation — 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
X24 Document value interpolated into markup unescaped — 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
X25 Inert configuration knob — 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
X26 Unsynchronised callback handoff — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X27 Collection changed while being enumerated — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X29 Per-element action decided by a fixed element — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X30 Support guard that admits what it rejects — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
X32 Type resolved by simple name across every loaded assembly — This check is about how a .NET program searches the assemblies loaded into its process for a type, and this repository contains no .NET source, so there is nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
X4 Structured logging — X4 reached only 1% of this repository's production lines — swift (77,293 lines), c (132 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
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.
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.
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.
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).
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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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*, in the test body and in the helpers it calls in the test and test-support code (a helper there that throws when its check fails counts as an assertion) — so verification routed through a callback object whose members hold the assertions, or through a harness in production code that fails by throwing, 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.
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 — 1300 significant lines (blank, comment-only and punctuation-only lines excluded), about 93% of them inside a single declaration: ChatViewModel (125-2362). The bar is 500 significant lines; this is 800 over it, 2.60× 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: Globe/GlobeView.swift bitchat/Views/Globe/GlobeView.swift— FileTooLong — 581 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 81 over it, 1.16× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: ViewModels/ChatPrivateConversationCoordinator.swift bitchat/ViewModels/ChatPrivateConversationCoordinator.swift— FileTooLong — 562 significant lines (blank, comment-only and punctuation-only lines excluded), about 79% of them inside a single declaration: ChatPrivateConversationCoordinator (238-951). The bar is 500 significant lines; this is 62 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: 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: 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 — 528 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 28 over it, 1.06× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
FileTooLong: 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.
FileTooLong: Views/LocationChannelsSheet.swift bitchat/Views/LocationChannelsSheet.swift— FileTooLong — 506 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: LocationChannelsSheet (8-671). The bar is 500 significant lines; this is 6 over it, 1.01× 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.
MethodTooLong: ChatMessageFormatter.formatMessageAsText bitchat/ViewModels/ChatMessageFormatter.swift:31— 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:98— MethodTooLong — body runs 153 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 53 over it, 1.53× 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: 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: MeshPeerList.body bitchat/Views/MeshPeerList.swift:39— 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:735— 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: ChatViewModel.panicClearAllData bitchat/ViewModels/ChatViewModel.swift:1559— MethodTooLong — panicClearAllData runs 110 significant lines (blank, comment-only and punctuation-only lines excluded) 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.
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: 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.
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 — 1213 significant lines (blank, comment-only and punctuation-only lines excluded), 372 methods. The bar is 400 significant lines; this is 813 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: LocationChannelsSheet bitchat/Views/LocationChannelsSheet.swift:8— ClassTooLong — 483 significant lines (blank, comment-only and punctuation-only lines excluded), 13 methods. The bar is 400 significant lines; this is 83 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 — 442 significant lines (blank, comment-only and punctuation-only lines excluded), 21 methods. The bar is 400 significant lines; this is 42 over it, 1.11× 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.
TooManyMethods: ChatViewModel bitchat/ViewModels/ChatViewModel.swift:125— TooManyMethods — 372 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 342 over it, 12.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
TooManyMethods: 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 — 35 methods. The bar is 30 methods; this is 5 over it, 1.17× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
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.
Hotspot: bitchat/ViewModels/ChatMessageFormatter.swift bitchat/ViewModels/ChatMessageFormatter.swift:31— bitchat/ViewModels/ChatMessageFormatter.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in ChatMessageFormatter.formatMessageAsText at line 31. 2 of those changes were fix/bug commits, 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/BLE/BLEService.swift bitchat/Services/BLE/BLEService.swift:2261— bitchat/Services/BLE/BLEService.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 32 in BLEService.sendOnAllLinks at line 2261. 4 of those changes were fix/bug commits, and the other 9 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/Views/ContentView.swift bitchat/Views/ContentView.swift:229— bitchat/Views/ContentView.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 23 in ContentView.body at line 229. 2 of those changes were fix/bug commits, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/MessageListView.swift bitchat/Views/MessageListView.swift:98— bitchat/Views/MessageListView.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 36 in MessageListView.body at line 98. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/Views/ContentSheetViews.swift bitchat/Views/ContentSheetViews.swift:125— bitchat/Views/ContentSheetViews.swift changed 5 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in ContentPeopleSheetView.body at line 125. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/App/PeerListModel.swift bitchat/App/PeerListModel.swift:258— bitchat/App/PeerListModel.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in PeerListModel.refresh at line 258. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +02:00' --full-history --no-merges -- bitchat/App/PeerListModel.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 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in ContentHeaderView.body at line 43. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/Views/Components/TextMessageView.swift bitchat/Views/Components/TextMessageView.swift:35— bitchat/Views/Components/TextMessageView.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in TextMessageView.body at line 35. 1 of those changes was a fix/bug commit, and the other 2 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/Services/CommandProcessor.swift bitchat/Services/CommandProcessor.swift:302— bitchat/Services/CommandProcessor.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in CommandProcessor.handleBlock at line 302. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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/GeohashPeopleList.swift bitchat/Views/GeohashPeopleList.swift:34— bitchat/Views/GeohashPeopleList.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in GeohashPeopleList.body at line 34. 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +02:00' --full-history --no-merges -- bitchat/Views/GeohashPeopleList.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 2 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-07-27..2026-10-25, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-27 02:55:00 +02:00' --until='2026-10-25 02:55:00 +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.
Duplicated block (5 lines × 2) bitchat/Services/CommandProcessor.swift:458— bitchat/Services/CommandProcessor.swift:458-462 | bitchat/Services/CommandProcessor.swift:485-489 — both copies are in the same file, so extract the 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:352-356 — 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:342— bitchat/ViewModels/ChatMessageFormatter.swift:342-346 | bitchat/ViewModels/ChatMessageFormatter.swift:354-358 — both copies are in the same file, so extract the 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) 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.
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.
Swallowed exception (caught, then discarded) bitchat/ViewModels/ChatViewModel.swift:1109— `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/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/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.
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.
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/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:130— localPackages/BitFoundation/Sources/BitFoundation/CourierEnvelope.swift:130-141 | localPackages/BitFoundation/Sources/BitFoundation/PrekeyBundle.swift:131-142 — 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 (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. Read the line range as the matched WINDOW rather than a finished unit: at `localPackages/Arti/arti-bitchat/src/lib.rs:76` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
Duplicated block (10 lines × 2) bitchat/Noise/NoiseSessionManager.swift:231— bitchat/Noise/NoiseSessionManager.swift:231-240 | bitchat/Noise/NoiseSessionManager.swift:279-288 — both copies are in the same file, so extract the 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 after the matched lines, `bitchat/Noise/NoiseSessionManager.swift:241` calls `cancelSuppressedInitiationRecoveryLocked` and `bitchat/Noise/NoiseSessionManager.swift:289` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
Duplicated block (10 lines × 2) 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.
Duplicated block (10 lines × 2) bitchat/Services/Courier/MessageOutboxStore.swift:824— bitchat/Services/Courier/MessageOutboxStore.swift:824-833 | bitchat/Services/MessageRouter.swift:529-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.
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/ViewModels/ChatMessageFormatter.swift:217— bitchat/ViewModels/ChatMessageFormatter.swift:217-227 | bitchat/ViewModels/ChatMessageFormatter.swift:330-340 — both copies are in the same file, so extract the 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:217` 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.
Low cohesion: ChatViewModel (LCOM4 32) bitchat/ViewModels/ChatViewModel.swift:125— ChatViewModel's methods fall into 32 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 32 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.
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/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.
Duplicated block (9 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:50— bitchat/ViewModels/ChatMessageFormatter.swift:50-58 | bitchat/ViewModels/ChatMessageFormatter.swift:377-385 — both copies are in the same file, so extract the 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: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 (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.
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.
Duplicated block (7 lines × 2) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:289— localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:289-295 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:300-306 — both copies are in the same file, so extract the 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 (7 lines × 2) bitchat/Services/BLE/BLEService.swift:5083— bitchat/Services/BLE/BLEService.swift:5083-5089 | bitchat/Services/BLE/BLEService.swift:5137-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:5083` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
Duplicated block (7 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:118— bitchat/ViewModels/ChatMessageFormatter.swift:118-124 | bitchat/ViewModels/ChatMessageFormatter.swift:127-133 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `bitchat/ViewModels/ChatMessageFormatter.swift:125` calls `matches`, `NSRange` and `bitchat/ViewModels/ChatMessageFormatter.swift:134` 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.
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· Edited copy of a member (13 corresponding lines) · ×2
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.
Edited copy of a member (13 corresponding lines) bitchat/Nostr/NostrProtocol.swift:382— bitchat/Nostr/NostrProtocol.swift:382-395 | bitchat/Nostr/NostrProtocol.swift:460-473 — 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.
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.
Duplicated block (18 lines × 2) bitchat/Services/BLE/BLEService.swift:1022— bitchat/Services/BLE/BLEService.swift:1022-1039 | bitchat/Services/BLE/BLEService.swift:1045-1062 — both copies are in the same file, so extract the 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:1022` 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 (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.
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.
Duplicated block (8–9 lines × 2) bitchat/App/PeerListModel.swift:384— bitchat/App/PeerListModel.swift:384-392 | bitchat/ViewModels/ChatViewModel.swift:1884-1891 — 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:384` 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.
ChatMessageFormatter.formatMessageAsText (cyclomatic 95) bitchat/ViewModels/ChatMessageFormatter.swift:31— 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.
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.
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.
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.
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.
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.
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.
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.
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.
MessageListView.body (cyclomatic 36) bitchat/Views/MessageListView.swift:98— MessageListView.body has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
MeshPeerList.body (cyclomatic 35) bitchat/Views/MeshPeerList.swift:39— MeshPeerList.body 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.
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.
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.
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.
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.
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.
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.
CommandProcessor.process (cyclomatic 30) bitchat/Services/CommandProcessor.swift:108— 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.
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.
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.
PrivateChatManager.consolidateMessages (cyclomatic 27) bitchat/Services/PrivateChatManager.swift:93— PrivateChatManager.consolidateMessages 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.
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.
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.
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.
BitchatMessage.init (cyclomatic 26) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:253— 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.
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.
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.
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.
ChatViewModel.performPrivateChatClear (cyclomatic 25) bitchat/ViewModels/ChatViewModel.swift:735— 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.
NostrInboundPipeline.handleNostrEvent (cyclomatic 25) bitchat/ViewModels/NostrInboundPipeline.swift:215— NostrInboundPipeline.handleNostrEvent has cyclomatic complexity 25 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
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.
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.
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.
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.
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.
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.
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.
GlobeGeometry.frontRuns (cyclomatic 23) bitchat/Views/Globe/GlobeGeometry.swift:62— GlobeGeometry.frontRuns 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.
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.
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.
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.
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.
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.
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.
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.
NostrInboundPipeline.subscribeNostrEvent (cyclomatic 21) bitchat/ViewModels/NostrInboundPipeline.swift:128— NostrInboundPipeline.subscribeNostrEvent 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.
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.
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.
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.
BitchatMessage.toBinaryPayload (cyclomatic 21) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:157— 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.
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.
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.
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.
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.
ChatPublicConversationCoordinator.handlePublicMessage (cyclomatic 20) bitchat/ViewModels/ChatPublicConversationCoordinator.swift:447— 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.
GeoPresenceTracker.subscribeNostrEvent (cyclomatic 20) bitchat/ViewModels/GeoPresenceTracker.swift:98— GeoPresenceTracker.subscribeNostrEvent 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.
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.
GeohashPeopleList.body (cyclomatic 20) bitchat/Views/GeohashPeopleList.swift:34— GeohashPeopleList.body 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
CommandProcessor.handleBlock (cyclomatic 18) bitchat/Services/CommandProcessor.swift:302— 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.
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.
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.
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.
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.
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.
ChatMessageFormatter.formatMessageHeader (cyclomatic 18) bitchat/ViewModels/ChatMessageFormatter.swift:369— ChatMessageFormatter.formatMessageHeader 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.
ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cyclomatic 18) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:847— ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded 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.
NostrInboundPipeline.processGeohashGiftWrap (cyclomatic 18) bitchat/ViewModels/NostrInboundPipeline.swift:354— 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.
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.
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.
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.
NostrInboundPipeline.processNostrMessage (cyclomatic 17) bitchat/ViewModels/NostrInboundPipeline.swift:450— 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.
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.
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.
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.
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.
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.
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.
GlobeRenderer.drawCities (cyclomatic 17) bitchat/Views/Globe/GlobeView.swift:439— GlobeRenderer.drawCities 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.
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.
PeerListModel.refresh (cyclomatic 16) bitchat/App/PeerListModel.swift:258— PeerListModel.refresh 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
ChatMessageFormatter.formatMessageAsText (cognitive 286) bitchat/ViewModels/ChatMessageFormatter.swift:31— 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.
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.
MeshPeerList.body (cognitive 90) bitchat/Views/MeshPeerList.swift:39— MeshPeerList.body has cognitive complexity 90 (threshold 15). Drivers by points: if/else 27 (55 pts), ternaries 11 (35 pts) (nesting depth added 52). 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.
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.
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.
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.
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.
PrivateChatManager.consolidateMessages (cognitive 61) bitchat/Services/PrivateChatManager.swift:93— PrivateChatManager.consolidateMessages has cognitive complexity 61 (threshold 15). Drivers by points: if/else 15 (38 pts), loops 4 (9 pts), ternaries 2 (8 pts), boolean chains 6 (nesting depth added 34). 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.
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.
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.
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.
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.
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.
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.
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.
GeohashPeopleList.body (cognitive 45) bitchat/Views/GeohashPeopleList.swift:34— GeohashPeopleList.body has cognitive complexity 45 (threshold 15). Drivers by points: if/else 14 (25 pts), ternaries 9 (20 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.
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.
BitchatMessage.init (cognitive 43) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:253— 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.
ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded (cognitive 42) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:847— ChatPrivateConversationCoordinator.migratePrivateChatsIfNeeded has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (31 pts), loops 3 (7 pts), boolean chains 4 (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.
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.
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.
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.
MessageListView.body (cognitive 40) bitchat/Views/MessageListView.swift:98— MessageListView.body has cognitive complexity 40 (threshold 15). Drivers by points: if/else 23 (28 pts), boolean chains 10, ternaries 2 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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.
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.
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.
CommandProcessor.handleBlock (cognitive 36) bitchat/Services/CommandProcessor.swift:302— 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.
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.
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.
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.
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.
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.
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.
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.
GlobeGeometry.frontRuns (cognitive 34) bitchat/Views/Globe/GlobeGeometry.swift:62— GlobeGeometry.frontRuns has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 11, loops 1, ternaries 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
NostrInboundPipeline.processNostrMessage (cognitive 27) bitchat/ViewModels/NostrInboundPipeline.swift:450— 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.
BitchatMessage.toBinaryPayload (cognitive 27) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:157— 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
NostrInboundPipeline.handleNostrEvent (cognitive 24) bitchat/ViewModels/NostrInboundPipeline.swift:215— NostrInboundPipeline.handleNostrEvent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 12, boolean chains 10, ternaries 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.
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.
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.
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.
ChatPublicConversationCoordinator.handlePublicMessage (cognitive 23) bitchat/ViewModels/ChatPublicConversationCoordinator.swift:447— 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.
NostrInboundPipeline.subscribeNostrEvent (cognitive 23) bitchat/ViewModels/NostrInboundPipeline.swift:128— NostrInboundPipeline.subscribeNostrEvent has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 7, ternaries 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
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.
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.
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.
GlobeGeometry.fillPolygon (cognitive 23) bitchat/Views/Globe/GlobeGeometry.swift:109— GlobeGeometry.fillPolygon has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 2 (6 pts), loops 4, boolean chains 3 (nesting depth added 9). Of this number, 20 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
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.
GlobeRenderer.drawCities (cognitive 22) bitchat/Views/Globe/GlobeView.swift:439— GlobeRenderer.drawCities has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, ternaries 2 (4 pts), 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.
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.
PeerListModel.buildRecentChatRows (cognitive 21) bitchat/App/PeerListModel.swift:315— 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.
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.
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.
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.
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.
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.
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.
CommandProcessor.process (cognitive 20) bitchat/Services/CommandProcessor.swift:108— 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
GeoPresenceTracker.subscribeNostrEvent (cognitive 19) bitchat/ViewModels/GeoPresenceTracker.swift:98— GeoPresenceTracker.subscribeNostrEvent has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14, boolean chains 4, 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
ChatMessageFormatter.formatMessageHeader (cognitive 18) bitchat/ViewModels/ChatMessageFormatter.swift:369— ChatMessageFormatter.formatMessageHeader has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, ternaries 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
ChatViewModel.panicClearAllData (cognitive 18) bitchat/ViewModels/ChatViewModel.swift:1559— 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.
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.
GlobeRenderer.drawGeohashGrid (cognitive 18) bitchat/Views/Globe/GlobeView.swift:488— GlobeRenderer.drawGeohashGrid has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 3 (5 pts) (nesting depth added 8). Of this number, 14 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
GlobeTouchSurface.touchesMoved (cognitive 18) bitchat/Views/Globe/GlobeView.swift:635— GlobeTouchSurface.touchesMoved 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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
CommandProcessor.handleEmote (cognitive 16) bitchat/Services/CommandProcessor.swift:259— 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.
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.
ChatMessageFormatter.isSelfMessage (cognitive 16) bitchat/ViewModels/ChatMessageFormatter.swift:429— 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.
ChatViewModel.performPrivateChatClear::continueClear (cognitive 16) bitchat/ViewModels/ChatViewModel.swift:826— 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.
ChatViewModel.isSelfSender (cognitive 16) bitchat/ViewModels/ChatViewModel.swift:1326— 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.
GeohashSubscriptionManager.switchLocationChannel (cognitive 16) bitchat/ViewModels/GeohashSubscriptionManager.swift:190— GeohashSubscriptionManager.switchLocationChannel has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 1 (2 pts), boolean chains 1, 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.
NostrInboundPipeline.processGeohashGiftWrap (cognitive 16) bitchat/ViewModels/NostrInboundPipeline.swift:354— 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.
NostrInboundPipeline.findNoiseKey (cognitive 16) bitchat/ViewModels/NostrInboundPipeline.swift:540— 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.
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.
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.
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.
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.
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.
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.
GlobeRenderer.draw (cognitive 16) bitchat/Views/Globe/GlobeView.swift:210— GlobeRenderer.draw has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 3). Of this number, 15 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
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.
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· 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· Edited copy of a member (30 corresponding lines) · ×1
Edited copy of a member (30 corresponding lines) bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:572— bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:572-607 | bitchat/ViewModels/ChatPrivateConversationCoordinator.swift:609-638 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (19 corresponding lines) · ×1
Edited copy of a member (19 corresponding lines) bitchat/Services/NostrProcessedEventStore.swift:74— bitchat/Services/NostrProcessedEventStore.swift:74-94 | bitchat/Sync/GossipMessageArchive.swift:37-57 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (15 corresponding lines) · ×1
Edited copy of a member (15 corresponding lines) bitchat/Views/Components/ConnectivityStatusBanner.swift:101— bitchat/Views/Components/ConnectivityStatusBanner.swift:101-115 | bitchat/Views/Components/PanicWipeBlockedBanner.swift:27-41 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication· Edited copy of a member (8 corresponding lines) · ×1
Edited copy of a member (8 corresponding lines) bitchat/Nostr/NostrRelayManager.swift:1875— bitchat/Nostr/NostrRelayManager.swift:1875-1882 | bitchat/Nostr/NostrRelayManager.swift:1885-1892 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
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.
Duplicated block (29–30 lines × 2) bitchat/Views/Components/TextMessageView.swift:72— bitchat/Views/Components/TextMessageView.swift:72-101 | 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:72` 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:102` 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.
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.
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.
Duplicated block (21–22 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:34— bitchat/ViewModels/ChatMessageFormatter.swift:34-54 | bitchat/ViewModels/ChatMessageFormatter.swift:430-451 — both copies are in the same file, so extract the 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.
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.
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.
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.
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.
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.
Duplicated block (19 lines × 2) bitchat/ViewModels/ChatViewModel.swift:866— bitchat/ViewModels/ChatViewModel.swift:866-884 | bitchat/ViewModels/ChatViewModel.swift:896-914 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
Duplicated block (13–17 lines × 3) bitchat/Services/PrivateChatManager.swift:106— bitchat/Services/PrivateChatManager.swift:106-118 | bitchat/Services/PrivateChatManager.swift:175-191 | bitchat/ViewModels/ChatTransportEventCoordinator.swift:395-409 — there are 3 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 3 sites; resolving a subset leaves the remainder to drift apart.
Duplicated block (14–17 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:75— bitchat/ViewModels/ChatMessageFormatter.swift:75-91 | bitchat/ViewModels/ChatMessageFormatter.swift:411-424 — both copies are in the same file, so extract the 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:75` 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 (16–17 lines × 2) bitchat/Views/Globe/GeohashPickerView.swift:178— bitchat/Views/Globe/GeohashPickerView.swift:178-193 | bitchat/Views/Globe/GeohashPickerView.swift:195-211 — both copies are in the same file, so extract the 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/Globe/GeohashPickerView.swift:195` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
Duplicated block (15–16 lines × 2) bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121— bitchat/Services/BLE/BLEService+LinkLayerCentralRole.swift:121-136 | bitchat/Services/BLE/BLEService+LinkLayerPeripheralRole.swift:72-86 — 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 (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.
Duplicated block (16 lines × 2) bitchat/Views/Components/TextMessageView.swift:44— bitchat/Views/Components/TextMessageView.swift:44-59 | 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.
Duplicated block (11–15 lines × 2) bitchat/ViewModels/ChatViewModelBootstrapper.swift:343— bitchat/ViewModels/ChatViewModelBootstrapper.swift:343-357 | bitchat/ViewModels/ChatViewModelBootstrapper.swift:423-433 — both copies are in the same file, so extract the 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 × 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.
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.
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.
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.
Duplicated block (10–12 lines × 3) bitchat/Services/MessageFormattingEngine.swift:220— bitchat/Services/MessageFormattingEngine.swift:220-231 | bitchat/ViewModels/ChatMessageFormatter.swift:75-84 | bitchat/ViewModels/ChatMessageFormatter.swift:411-420 — 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.
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.
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.
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.
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.
Duplicated block (10–11 lines × 2) bitchat/ViewModels/ChatMessageFormatter.swift:150— bitchat/ViewModels/ChatMessageFormatter.swift:150-160 | bitchat/ViewModels/ChatMessageFormatter.swift:271-280 — both copies are in the same file, so extract the 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:150` 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.
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.
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.
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.
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.
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.
Duplicated block (8 lines × 3) bitchat/Services/MessageFormattingEngine.swift:319— bitchat/Services/MessageFormattingEngine.swift:319-326 | bitchat/ViewModels/ChatMessageFormatter.swift:150-157 | bitchat/ViewModels/ChatMessageFormatter.swift:271-278 — 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. 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–8 lines × 3) localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:327— localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:327-334 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:336-343 | localPackages/BitFoundation/Sources/BitFoundation/BitchatMessage.swift:345-349 — 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:345` 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 (6 lines × 2) bitchat/Services/MessageFormattingEngine.swift:310— bitchat/Services/MessageFormattingEngine.swift:310-315 | bitchat/ViewModels/ChatMessageFormatter.swift:162-167 — 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.
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.
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:77— `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/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.
Orphaned file bitchat/Services/BLE/MimeType.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/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/Models/ReadReceipt.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.
Orphaned file bitchat/Views/Image Viewers/ImagePickerView.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.
Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 80 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 (+72 more). Pair on, review, or document these before any departure.
D16 · Bus Factor· Further sole-owners (lower concentration) · ×1
Further sole-owners (lower concentration) — 2 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 (83 single-owned of 241 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 241 of the 318 production source files in this repository met that bar). They are anonymized user #2 (2 file(s)), anonymized user #3 (1 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, bitchat/Services/ComposerDraftStore.swift.
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)` (74008 LoC, 677 module-visible types across 27 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 — 7 of 241 analysed file(s) have no living knowledge left — their last meaningful change has decayed away, so if one breaks, no one currently understands it (counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 241 of the 318 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/Services/BLE/MimeType.swift, bitchat/Views/Image Viewers/ImagePreviewView.swift, bitchat/Nostr/Bech32.swift, bitchat/Noise/NoiseRateLimiter.swift, bitchat/Models/ReadReceipt.swift, bitchat/Sync/RequestSyncManager.swift, bitchat/Views/Image Viewers/ImagePickerView.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.
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.
No SAST REDACTED:16— 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 6 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.
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.
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.)
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.
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.
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.
trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
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.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
Run 01a1ca9b-2535-7be3-af82-dedbf09daec4 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.
Issues: 24 · Warnings: 494 · Recommendations: 31 — Appendix A · all findings · full markdown report.
Generated by the Canine Code Analyzer: deterministic code-health analysis. 11-11-2026 @ 12:35 UTC.
Downloadable artifacts
Machine-readable and reproducible from this commit + frozen rubric — drop them straight into a contract appendix, a CRA dossier, or a downstream SCA / VEX tool.