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

adidshaft/atria

Measured 17 November 2026, 18:59 UTC, at code version 8fedbbd

First survey, so nothing to compare with yet Supply-chain provenance & signing: not measured

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

CAI score 50.9out of 100 Adequate
CriticalWeakAdequateStrongExemplary

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

A large codebase: 348,157 lines of product code in 3 projects, tests not counted · Estimated rebuild effort: about 3.6 person-years · Weakest lens: Production Readiness, 33.8

Findings by how serious they are

12 critical 3228 serious 72 minor

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

This survey was produced by

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

39of 39 dimensions measured by tools.
3305of 3312 findings point to an exact file and line, so you can open each one in the code. The other 7 concern the repository as a whole, such as missing documentation.
39dimensions across 6 lenses, read from 348,157 lines of product code in 3 projects.
Chapters

Executive summary

adidshaft/atria falls short of our standard for production because we found no logging, tracing or health checks in the code and no automated security scanning of the code, its secrets or its dependencies. It scores 50.9 out of 100 and is rated Adequate, and all 12 of its critical findings are security problems.

Production Readiness, at 33.8, is the weakest lens and counts most in the score. The best first step is adding a diagnostic log, worth about 8.6 points. Recording design decisions comes next, worth about 3.4 points. Raising Production Readiness to 70 would lift the score to about 64.3.

Ten passwords or keys are open to anyone who can read the repository. Two pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Replacing each exposed password or key and pinning each tool to an exact version would close both risks.

The product code is 348,157 lines, about €520,000 to rebuild.

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

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

If Production Readiness rose from 33.8 to 70, the lowest score rated Strong, the score would rise from 50.9 to about 64.3.

Code composition: what the lines of code are
Product code 63%Tests 37%
Rebuild cost: about €520,000 · Estimate
Cost to rebuild€170,000 to €870,000, for 2,877 to 9,127 hours of work, about 3.6 person-years for 2 to 7 engineers
Difficulty of the problemStandard, judged from the kind of software and how it is built. Code that solves a harder problem, such as payments or medical bookings, costs more per line to write.
Quality factor×0.7 at a score of 51. Better code takes more work to write, so the factor is ×1.0 at a score of 70, lower below it and higher above it.
SizeLarge: 348,157 lines of product code
What it is notNot a quotation: nobody has offered to build it for that. Not a valuation: it says nothing about what the business is worth. Not a certified figure: no professional has signed it as one.

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

Top priorities

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

1
Write a diagnostic trail the user can hand back with a bug report: log through `os.Logger` (one per subsystem), which the unified log keeps and a sysdiagnose carries to you.
Start with the error paths that emit nothing — a discarded error is the failure the user cannot describe and you cannot reproduce.
Raises the score by about 8.6 points · Medium effort · Observability
2
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.
Raises the score by about 3.4 points · Low effort · ADR Quality
3
Resolve the 10 REDACTED finding(s) in Secrets (history) — start with REDACTED (9), REDACTED.
Raises the score by about 2.2 points · Medium effort · Secrets (history)

Diagnosis: what the measurements show together

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

Where the investment is most exposed · Value at risk
This code would cost about €520,000 to build again, about 3.6 person-years of work. Its weakest lens is Production Readiness, at 33.8 (Weak). Production Readiness is about whether the product is ready to run in production and to change without breaking. Because the weakest lens counts most in the score, work on Production Readiness also moves the score most.
Based on: the rebuild estimate · the Production Readiness grade · how much each lens counts
What to do: Start with the Production Readiness actions in Top priorities.
If you do one thing first · First action
Write a diagnostic trail the user can hand back with a bug report: log through `os.Logger` (one per subsystem), which the unified log keeps and a sysdiagnose carries to you. Of all the actions in this report, it raises the score most for the work it takes: about 8.6 points for medium effort. The next survey will show the change in the score.
Based on: the ranked actions in Top priorities, by score gain and effort
What hard-to-read code costs each year · Cost
Four dimensions measure how easy the code is to work in: two measure how tangled its logic is, one how much of it is copied, and one how well each part sticks to a single job. In this codebase they average 5.0 out of 10. Code at that level is slower to change than clean code, and we estimate the extra work at 7% to 17% on every change. The history of the code shows how much it changes: about 566,053 lines over the last 90 days, which is about 2,295,659 lines a year. At that pace, the extra work comes to an estimated 430.4 to 2582.3 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of our own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, never less than 2% to 5% and never more than 40% to 60% in all; and an engineer changes 150 to 400 lines in a day. The result is a range for planning, not a measurement.
Based on: Cyclomatic Complexity · Cognitive Complexity · Code Duplication · Cohesion (LCOM4) · the code's change history
What to do: Start with the files listed under Churn × Complexity Hotspots, which change often and are hard to read, because that is where the extra work is paid most often.

Architecture — 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.

arch Atria Atria AtriaWidget AtriaWidget StrapProtocol StrapProtocol

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.

43 modules, with 12 dependencies between them. Every module uses only modules listed above it, so there are no loops.

The table shows the 40 modules with the most connections; 3 more are left out to keep it readable.

Which modules use which. The module on each row uses the module in each column, and the number counts the pairs of types that connect them. A cell above the diagonal is part of a loop.
uses →1 repository2 summarize_sniffer_trace3 tools.analyze_gate_e_workout_log4 tools.analyze_historical_2f5 tools.analyze_live_rr_windows6 tools.build_physical_window_manifests7 tools.decode_whoop_att_capture8 tools.evaluate_activity_classifier9 tools.evaluate_activity_detection10 tools.evaluate_overnight_load_model11 tools.evaluate_recovery_model12 tools.evaluate_sensor_decoder13 tools.pair_sensor_references14 tools.preflight_reference_csv15 tools.reconstruct_session_backup_from_log16 tools.replay_sensor_reference17 tools.strap-mac18 tools.strap-mac.ff_sweep19 tools.strap-mac.flush_probe20 tools.strap-mac.night_capture21 tools.strap-mac.overnight_watch22 tools.strap-mac.pairing_6a23 tools.strap-mac.pairing_window24 tools.strap-mac.r10_capture25 tools.strap-mac.r10r11_probe26 tools.strap-mac.session27 tools.strap-mac.strap_metrics28 tools.summarize_step_archive_coverage29 tools.upload_anonymous_daily30 tools.v4_morning_acceptance31 tools.validate_hr_reference32 tools.validate_hrv_reference33 tools.validate_research_corpus34 tools.validate_runtime_evidence35 tools.verify_gate2_release_artifacts36 tools.verify_whoop4_exact_history_transaction37 validate_hrv38 (global)39 tools40 tools~StrapProtocol~StrapProtocol
1 repository
2 summarize_sniffer_trace
3 tools.analyze_gate_e_workout_log
4 tools.analyze_historical_2f
5 tools.analyze_live_rr_windows
6 tools.build_physical_window_manifests
7 tools.decode_whoop_att_capture
8 tools.evaluate_activity_classifier
9 tools.evaluate_activity_detection
10 tools.evaluate_overnight_load_model
11 tools.evaluate_recovery_model
12 tools.evaluate_sensor_decoder
13 tools.pair_sensor_references
14 tools.preflight_reference_csv
15 tools.reconstruct_session_backup_from_log
16 tools.replay_sensor_reference
17 tools.strap-mac
18 tools.strap-mac.ff_sweep
19 tools.strap-mac.flush_probe
20 tools.strap-mac.night_capture
21 tools.strap-mac.overnight_watch
22 tools.strap-mac.pairing_6a
23 tools.strap-mac.pairing_window
24 tools.strap-mac.r10_capture
25 tools.strap-mac.r10r11_probe
26 tools.strap-mac.session
27 tools.strap-mac.strap_metrics
28 tools.summarize_step_archive_coverage
29 tools.upload_anonymous_daily
30 tools.v4_morning_acceptance
31 tools.validate_hr_reference
32 tools.validate_hrv_reference
33 tools.validate_research_corpus
34 tools.validate_runtime_evidence
35 tools.verify_gate2_release_artifacts
36 tools.verify_whoop4_exact_history_transaction
37 validate_hrv
38 (global)11
39 tools111111111
40 tools~StrapProtocol~StrapProtocol17
Uses a module listed above itPart of a loopThe module itself
1 repository2 summarize_sniffer_trace3 tools.analyze_gate_e_workout_log4 tools.analyze_historical_2f5 tools.analyze_live_rr_windows6 tools.build_physical_window_manifests7 tools.decode_whoop_att_capture8 tools.evaluate_activity_classifier9 tools.evaluate_activity_detection10 tools.evaluate_overnight_load_model11 tools.evaluate_recovery_model12 tools.evaluate_sensor_decoder13 tools.pair_sensor_references14 tools.preflight_reference_csv15 tools.reconstruct_session_backup_from_log16 tools.replay_sensor_reference17 tools.strap-mac18 tools.strap-mac.ff_sweep19 tools.strap-mac.flush_probe20 tools.strap-mac.night_capture21 tools.strap-mac.overnight_watch22 tools.strap-mac.pairing_6a23 tools.strap-mac.pairing_window24 tools.strap-mac.r10_capture25 tools.strap-mac.r10r11_probe26 tools.strap-mac.session27 tools.strap-mac.strap_metrics28 tools.summarize_step_archive_coverage29 tools.upload_anonymous_daily30 tools.v4_morning_acceptance31 tools.validate_hr_reference32 tools.validate_hrv_reference33 tools.validate_research_corpus34 tools.validate_runtime_evidence35 tools.verify_gate2_release_artifacts36 tools.verify_whoop4_exact_history_transaction37 validate_hrv38 (global)39 tools40 tools~StrapProtocol~StrapProtocolrepository1summarize_sniffer_trace2tools.analyze_gate_e_workout_log3tools.analyze_historical_2f4tools.analyze_live_rr_windows5tools.build_physical_window_manifests6tools.decode_whoop_att_capture7tools.evaluate_activity_classifier8tools.evaluate_activity_detection9tools.evaluate_overnight_load_model10tools.evaluate_recovery_model11tools.evaluate_sensor_decoder12tools.pair_sensor_references13tools.preflight_reference_csv14tools.reconstruct_session_backup_from_log15tools.replay_sensor_reference16tools.strap-mac17tools.strap-mac.ff_sweep18tools.strap-mac.flush_probe19tools.strap-mac.night_capture20tools.strap-mac.overnight_watch21tools.strap-mac.pairing_6a22tools.strap-mac.pairing_window23tools.strap-mac.r10_capture24tools.strap-mac.r10r11_probe25tools.strap-mac.session26tools.strap-mac.strap_metrics27tools.summarize_step_archive_coverage28tools.upload_anonymous_daily29tools.v4_morning_acceptance30tools.validate_hr_reference31tools.validate_hrv_reference32tools.validate_research_corpus33tools.validate_runtime_evidence34tools.verify_gate2_release_artifacts35tools.verify_whoop4_exact_history_transaction36validate_hrv37(global)38tools39tools~StrapProtocol~StrapProtocol401111111111117+3 more modules (most-connected shown)

At a glance — Code Health · 62.3 · Adequate · gated by D1, D2 ·

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

At a glance — Maturity · 59.3 · Adequate · gated by M2 ·

At a glance — Readiness · 33.8 · Weak · gated by P2, P3 ·

At a glance — Security · 66.7 · Checked 4 of 11 · gated by D28 ·

At a glance — Performance · 100.0 · Exemplary ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A07:2025 — Authentication Failures11High / Critical
A05:2025 — Injection2High / Critical

Roadmap

Top priorities: Write a diagnostic trail the user can hand back with a bug report: log through `os.Logger` (one per subsystem), which the unified log keeps and a sysdiagnose carries to you. Start with the error paths that emit nothing — a discarded error is the failure the user cannot describe and you cannot reproduce; Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery); Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.

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

Do thisHelpsEffortDimension
Write a diagnostic trail the user can hand back with a bug report: log through `os.Logger` (one per subsystem), which the unified log keeps and a sysdiagnose carries to you. Start with the error paths that emit nothing — a discarded error is the failure the user cannot describe and you cannot reproduce.+8.6 ptsMediumObservability
Resolve the 1 No ADRs found finding(s) in ADR Quality — start with project.pbxproj.+3.4 ptsLowADR Quality
Resolve the 10 REDACTED finding(s) in Secrets (history) — start with REDACTED (9), REDACTED.+2.2 ptsMediumSecrets (history)
Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).+4.3 ptsMediumDR & Backup
Resolve the 59 Hotspot finding(s) in Churn × Complexity Hotspots — start with Sessions.swift, REDACTED, AtriaHomeView.swift.+2.9 ptsHighChurn × Complexity Hotspots
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.+2.5 ptsMediumArchitecture documentation
Resolve the 1 `fallbackHrv` spells `Hrv` where 154 names in the project spell it `HRV` finding(s) in Naming Consistency — start with AtriaHomeView.swift.+0.4 ptsLowNaming Consistency
Swallowed exception (empty catch)+1.4 ptsMediumException handling

File quality

Per-file score 0–10 — a quality signature. Of 275 files carrying findings, judged against the Production bar: 1% slop · 78% mixed · 21% near-clean.

FileScoreBandWorst signal
REDACTED0.0SlopSecrets (history): REDACTED: REDACTED
REDACTED3.7SlopStatic Analysis (SAST): High: REDACTED
REDACTED4.4MixedSecrets (history): REDACTED: REDACTED
Atria/Atria/Sessions.swift5.5MixedCyclomatic Complexity: SessionStore.validateSessionBackupEnvelopeForImport (cyclomatic 293)
Atria/Atria/AtriaHeroConnectionSections.swift5.5MixedCognitive Complexity: AtriaHeroStatusCardHost.body (cognitive 24)
Atria/Atria/AtriaCustomizeSheet.swift5.7MixedCode Duplication: Edited copy of a member (22 corresponding lines)
test_handoff_static_checks.py6.4MixedExplicit Debt: TodoComment
Atria/Atria/AtriaHomeView.swift6.5MixedCyclomatic Complexity: AtriaTopStatusProjection.presentation (cyclomatic 70)
Atria/Atria/AtriaWhoop4CompactIMU.swift6.9MixedCognitive Complexity: AtriaWhoop4CompactIMUAssembler.push (cognitive 21)
Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift7.0MixedCyclomatic Complexity: AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify (cyclomatic 126)
Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift7.0MixedCyclomatic Complexity: AtriaHistoricalFullDrainCoverageStore.validate (cyclomatic 121)
validate_hrv.py7.0MixedCyclomatic Complexity: validate_hrv.main (cyclomatic 101)
Atria/Atria/HistoricalArchive.swift7.0MixedCyclomatic Complexity: HistoricalArchive.compactArchive (cyclomatic 95)
Atria/Atria/WidgetSnapshot.swift7.0MixedCyclomatic Complexity: WidgetSnapshotPublisher.publish (cyclomatic 81)
Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift7.0MixedCyclomatic Complexity: AtriaWhoop4MotionTickCompactStore.latestNightMotionRead (cyclomatic 69)
Atria/Atria/AtriaWhoop4MotionTickStepModel.swift7.0MixedCyclomatic Complexity: AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow (cyclomatic 63)
Atria/Atria/AtriaLiveWorkoutView.swift7.0MixedCyclomatic Complexity: AtriaLiveWorkoutTRIMPAccumulator.metrics (cyclomatic 60)
Atria/Atria/AtriaHistoricalAggregateReader.swift7.0MixedCyclomatic Complexity: AtriaHistoricalAggregateReader.streamedWholeArchiveDigest (cyclomatic 54)
Atria/AtriaWidget/AtriaWidget.swift7.0MixedCyclomatic Complexity: AtriaWidgetMetric.statusText (cyclomatic 53)
Atria/Atria/AtriaHistoricalLongTermRollup.swift7.0MixedCyclomatic Complexity: AtriaHistoricalLongTermRollup.validate (cyclomatic 52)

How the grades work

Every finding carries one of four grades. Three say how serious it is. The fourth says this survey could not settle it — and it is a grade, not a gap.

Critical — 12

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

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

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

Could not be resolved — 26

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 39 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 — 39 dimensions across the health lenses
D1D2D3D4D5D6D10D13D14D15D17D19D20D21D26D27D28D29D34D35D37AX10AX3AX4AX6AX8AX9M1M2M3M4P1P2P3P5PF3X26X28X3

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

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

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

Tools & methods

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

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

Every finding is locatable in findings.md. Run 01a1eae0-a20e-79d8-8266-2e34a96c9ce6.

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

Run transparency — what happened this run

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

  • D8 Code Coverage — 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. Coverage NOT MEASURED: this repository's production source spans .py, .swift, and our analyzer cannot run the .swift test suite(s) — so no coverage was collected for the repository as a whole. The Python half did build and run, and its own line coverage came back at 48.4% — but that is a figure for one half of the product, and we do not publish a partial one as if it were complete. This is OUR limitation, not a defect in the repo — coverage is excluded from the score rather than counted as a near-zero.
  • D10 Test Quality — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. The 6,114 test(s) behind this row are the ones the code-model census could read, and this repository also carries at least 33 test source file(s) (.py) that it cannot: it reads the test types the .swift frontend declared, so a suite in any other language is invisible to it. Skipped tests, zero-assertion tests and the other quality signals on this row are UNMEASURED in that suite — their absence from the counts above is a gap in this analyzer's language coverage, not a finding that those tests are sound.
  • 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 source is present (.py, .swift) but the built-in reliability runner does not support this repository's ecosystem, so flakiness couldn't be assessed. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • 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. Not scored — 0 SwiftPM declaration(s) across 1 `Package.swift` and 0 committed pin(s) were read for PINNING discipline (0 defect(s) reported), but the outdated signal comes from listing each declared repository's release tags rather than from a registry, and none of them resolved to a version to compare, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D16 Bus Factor — not measured this run — This is a true statement about the repository that carries nothing for its owner to act on, so it is reported here rather than as a defect in their code. Single-contributor repository — bus factor is not applicable (1 contributor(s) across 2933 commit(s) sampled, automation and bot accounts excluded). Concentration needs a team to concentrate: with one contributor there is nobody to spread the knowledge to, so there is nothing here for the owner to act on.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D21 Naming Consistency — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. PREREGISTRATION version 20's fallback (adjudication D21-sample3-v3): this rule kind was adjudicated below the 95 % precision gate, so its candidates are counted here and not published, and the score covers only the acronym-spelling and awaitable-suffix rules. The kind returns as rows only after it shows a measured precision; this says nothing about whether these names are consistent.
  • D22 Internal API Consistency — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22 identifies the intentionally-exposed surface from `IsPackable` and `.Contracts` project names, MSBuild conventions read off the loaded project set. This target exposed no such projects, so the probe never ran; this says nothing about whether the repository has a public API. This repository commits no C#/VB source at all, so there was never an MSBuild project set to read these conventions off. That is OUR side and it is an ADMISSION gap, not an environment fault: no published-package marker D22 reads admitted any project here. D22 DOES collect the public API of every language in this tree, and admits a project only when its manifest makes that ecosystem's publication act in a form the marker recognises — so what is missing is not a collector but an admission rule for the publication act this repository makes, if it makes one. The remedy is a better discriminator for that marker — not a collector, and no change to the scan image can close it. The marker's rules are measured to refuse applications, so one refused repository is the rule working as calibrated; several are the evidence that it is too strict.
  • 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.
  • 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. `Atria/Atria/AtriaAICoach.swift`, `Atria/Atria/AtriaActivityMonitor.swift`, `Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift`, `Atria/Atria/AtriaBreathworkSession.swift`, `Atria/Atria/AtriaDaytimeQuiescentSleepDetector.swift`, … (+34 more) produced a parse error, so every rule in this engine's `gdpr.yml` was absent there. That absence is NOT a clean result: these rules detect personal data crossing a boundary into a log sink, a URL or browser storage, and a file that was never parsed cannot report any of the three. The rest of the tree analysed normally and its rows above stand; only these files are unaccounted for. You can widen what we reach: fix the syntax error (or exclude the file deliberately) and re-scan to cover it.
  • D44 Platform End-of-Life — not measured this run — 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 Atria/Atria/AtriaVitalsCollectionSections.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.
  • 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 (Atria/Atria.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.
  • C4 Data Retention — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:2), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • C5 Data-Subject Rights — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. 'SQLite3' is imported (Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:2), but no entity, schema, table or model declaration this check reads was found beside it, so whether personal data is stored could not be decided.
  • GD1 Unfinished & placeholder code — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust and Java source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby, Scala, Rust or Java was found, and this repository's Python, 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.
  • IC1 Incompleteness & stubs — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby, Scala and Rust source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby, Scala or Rust was found, and this repository's Python, 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.
  • 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's reader does not cover most of the languages this repository's product is written in. What it read is kept, but it is too small a share to grade the product by. That is a gap in this analyzer's language reach — not a finding about this repository.
  • X16 Unfloored truncation loop — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin and Rust source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala, Kotlin or Rust 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, PHP, Rust and Elixir source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala, PHP, Rust or Elixir 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.
  • X27 Collection changed while being enumerated — 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.
  • X29 Per-element action decided by a fixed element — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript (Vue and Svelte components included), Java, Rust, Dart, Ruby, Scala, Kotlin and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Rust, 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.
  • X3 Exception handling — measured, with a gap in what it reached — We measured this, but not all of it. What we did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 14 further occurrence(s) are not listed individually; the score already reflects all 54.
  • X5 Nullable reference types — not measured this run — We could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, Kotlin source, and Rust source only, and no C# was loaded, no TypeScript was found, and this repository's Python, 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 (.gitattributes linguist-generated/vendored, .editorconfig generated_code): none declared — every source file was scored.

Limitations & what we did not check

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D19 Documentation Quality: Documentation quality publishes two things only: a runnable or packaged unit with no example, and a multi-project root README that maps none of its parts. It does not judge clarity, and its other checks (overview, licence, boilerplate, structure, empty sections, XML-doc coverage) are withheld after adjudication: their candidates are counted in the card's gaps, not shown as rows. A false statement in a document is M4's; units are .NET projects only.
  • D20 ADR Quality: ADR quality checks the structure of the decision records present: it cannot know about decisions made and never recorded, and it does not judge how well a record argues its case. Records in a language the section lexicon does not cover are not evaluated.
  • D21 Naming Consistency: Naming consistency compares each name with the convention its structural peers follow in this repository: it cannot tell whether a consistently used name is a good one, and languages other than C# and TypeScript are not measured.
  • 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.
  • P5 DR & Backup: Backup/restore and disaster-recovery readiness is judged from in-repo evidence — a config that exists is not a tested restore, so the absence of positive evidence is reported as "not evidenced", never scored as present.

Dimensions

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

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

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

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

615 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was SessionStore.validateSessionBackupEnvelopeForImport at 293. A further 18 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 AtriaWorkoutActivityType.icon at 80 — they are counted neither in the figure above nor in this dimension's score. 4 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: Atria/Atria/AtriaJournalTab.swift (Tag.prompt at 41), Atria/Atria/AtriaCustomizeSheet.swift (AtriaCustomizePreview.sampleValue at 23), Atria/Atria/AtriaNotificationCategories.swift (AtriaNotificationCategory.kind at 18), Atria/Atria/AtriaRelativeSkinNightStore.swift (AtriaRelativeSkinSignalPresentation.content at 17). 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.

SessionStore.validateSessionBackupEnvelopeForImport (cyclomatic 293)Atria/Atria/Sessions.swift:48099
SessionStore.aggregateSleepCandidatesCore (cyclomatic 262)Atria/Atria/Sessions.swift:50025
AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cyclomatic 177)REDACTED:13289
SessionStore.logGateStatusFromLaunchIfRequested (cyclomatic 143)Atria/Atria/Sessions.swift:31247
AtriaBLEManager.applyLaunchAutomation (cyclomatic 139)REDACTED:24590

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

What to do

  1. Bring the 11 bodies over 120 down to 120 or less in Cyclomatic Complexity — start with SessionStore.validateSessionBackupEnvelopeForImport (cyclomatic 293), SessionStore.aggregateSleepCandidatesCore (cyclomatic 262), AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cyclomatic 177). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 11 together lifts Cyclomatic Complexity from 2.0 to about 3.4/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.

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

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

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

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

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

780 method(s) exceeded the cognitive complexity threshold of 15; the worst was SessionStore.aggregateSleepCandidatesCore at 330.

SessionStore.aggregateSleepCandidatesCore (cognitive 330)Atria/Atria/Sessions.swift:50025
SessionStore.validateSessionBackupEnvelopeForImport (cognitive 302)Atria/Atria/Sessions.swift:48099
HistoricalArchive.compactArchive (cognitive 257)Atria/Atria/HistoricalArchive.swift:9722
AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cognitive 236)REDACTED:13289
AtriaBLEManager.armHistoryOnlyProbe (cognitive 235)REDACTED:40410

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

What to do

  1. Bring the 80 bodies over 60 down to 60 or less in Cognitive Complexity — start with SessionStore.aggregateSleepCandidatesCore (cognitive 330), SessionStore.validateSessionBackupEnvelopeForImport (cognitive 302), HistoricalArchive.compactArchive (cognitive 257). — This score is capped by its worst body, so a finding fixed alone moves it by almost nothing — the next one down takes its place. Refactoring these 80 together lifts Cognitive Complexity from 2.0 to about 4.1/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.

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

D3 · God Classes8.8 / 10Strong✓ Tool-verified

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

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

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

366 god class(es) detected.

MethodTooLong: AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded · ×219REDACTED:13289
FileTooLong: Atria/Sessions.swift · ×68Atria/Atria/Sessions.swift
ClassTooLong: AtriaBLEManager · ×62REDACTED:558
TooManyMethods: AtriaBLEManager · ×17REDACTED:558

What to do

  1. Resolve the 219 MethodTooLong finding(s) in God Classes — start with REDACTED (72), Sessions.swift (72), HistoricalArchive.swift (8). — One of this dimension's main actionable groups (219 warning-level).
  2. Resolve the 68 FileTooLong finding(s) in God Classes — start with Sessions.swift, REDACTED, AtriaHomeView.swift. — One of this dimension's main actionable groups (68 warning-level).
  3. Resolve the 62 ClassTooLong finding(s) in God Classes — start with Sessions.swift (3), AtriaActivityMonitor.swift (2), AtriaStressMonitor.swift (2). — One of this dimension's main actionable groups (62 warning-level).

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

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

What it measures: How much of the production code is copy-pasted: the share of production lines inside a reported copy (every copy of a duplicated block or of an edited member, each line once), 10 at none and 0 at a quarter of the lines.

Method: Code duplication via token-stream sliding windows with type-aware normalization (locals masked, type names preserved), scored on the share of production lines inside a reported copy (each line once; 10 at none, 0 at a quarter). Deterministic.

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

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

Duplicated block (6 lines × 2) · ×52Atria/Atria/ActiveSessionJournal.swift:1028
Duplicated block (7 lines × 2) · ×46Atria/Atria/AtriaActiveSessionRestorePreparer.swift:398
Duplicated block (9 lines × 2) · ×43Atria/Atria/AtriaActiveSessionRestorePreparer.swift:298
Duplicated block (5 lines × 2) · ×40REDACTED:24794
Duplicated block (8 lines × 2) · ×39REDACTED:25321

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

What to do

  1. Resolve the 52 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with REDACTED (6), Sessions.swift (4), AtriaActivityMonitor.swift (3). — One of this dimension's main actionable groups (52 warning-level).
  2. Resolve the 46 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with Sessions.swift (10), AtriaOverviewSections.swift (4), AtriaAnalytics.swift (2). — One of this dimension's main actionable groups (46 warning-level).
  3. Resolve the 43 Duplicated block (9 lines × 2) finding(s) in Code Duplication — start with Sessions.swift (5), AtriaOverviewSections.swift (4), AtriaHomeView.swift (3). — One of this dimension's main actionable groups (43 warning-level).

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

D5 · Coupling10.0 / 10Exemplary✓ Tool-verified

What it measures: Whether volatile projects sit underneath others that depend on them (so their churn ripples upward), and whether project dependencies form cycles. A widely-depended-on but stable shared/kernel project is healthy, not penalised.

Method: Dependency cycles via elementary-DFS over real .csproj references, plus Martin instability (afferent/efferent) per project. Exhaustive over the reference graph, deterministic.

Coverage: Exhaustive · type-level: afferent/efferent coupling + cycles computed over every production type — the population is all types, not a name convention.

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

3 production modules (SwiftPM+Xcode), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; a workspace's implicit (product-name) dependency is not visible there; 0 module(s) off the main sequence, with abstractness counted on 1 of the 3 (the rest declare no modelled class or interface, export only macros, declare types in source no model reads, or have no source directory of their own).

✓ On the Gold path — maintain.

Detailed fixes: d5_recommendation.md.

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

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

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

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

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

2 of 113 classes have LCOM4 above 3.

Low cohesion: AtriaBLEManager (LCOM4 8) · ×2REDACTED:558

What to do

  1. Resolve the 2 Low cohesion finding(s) in Cohesion (LCOM4) — start with REDACTED, Sessions.swift. — One of this dimension's main actionable groups (2 warning-level).

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

D10 · Test Quality9.9 / 10Stronggated by 41 serious findings✓ Tool-verified

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

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

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

9 skipped, 32 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 6114 tests. Measured on the .swift suite only — at least 33 test source file(s) (.py) went unread, so its test quality is unmeasured and is not in these counts.

No assertions: testHealthKitExportIsANoOpWhileDemoIsActive · ×32Atria/AtriaTests/AtriaAppReviewDemoTests.swift:153
Skipped test: testPacerDutyCyclesOnceTheLeaseIsHeld · ×9Atria/AtriaTests/AtriaBackgroundProjectionTests.swift:4145

What to do

  1. Resolve the 32 No assertions finding(s) in Test Quality — start with AtriaRecordScanParserParityTests.swift (7), AtriaExistingRecordReplayTests.swift (4), AtriaHistoricalVerifiedConsumerReaderTests.swift (3). — One of this dimension's main actionable groups (32 warning-level).
  2. Resolve the 9 Skipped test finding(s) in Test Quality — start with AtriaWhiteboardCoachSentenceTests.swift (2), AtriaBackgroundProjectionTests.swift, AtriaDaytimeQuiescentSleepDetectorTests.swift. — One of this dimension's main actionable groups (9 warning-level).

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

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

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

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

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

REDACTED scan ran and found no leaked secrets. 1 detection(s) were excluded as holding no minted credential in material that runs: a name, reference or comparison rather than a value, a readable phrase or pattern, a value that declares itself fake, or development, test, example, mock or demo material.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 0 third-party package(s) use a banned license. This repository's 1 SwiftPM file(s) declare no third-party dependencies and no committed resolution pins any, so there is no third-party package licence to grade — a complete answer, not a gap in coverage. It also commits no CocoaPods or Carthage manifest, so SwiftPM is the only package manager it takes dependencies through. This repository's OWN licence is its own choice and is not judged here.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots4.5 / 10Weak✓ Tool-verified

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

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

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

Top hotspots: Atria/Atria/Sessions.swift (327×360=117720); REDACTED (383×177=67791); Atria/Atria/AtriaHomeView.swift (253×70=17710)

Hotspot: Atria/Atria/Sessions.swift · ×59Atria/Atria/Sessions.swift:48099

What to do

  1. Resolve the 59 Hotspot finding(s) in Churn × Complexity Hotspots — start with Sessions.swift, REDACTED, AtriaHomeView.swift. — One of this dimension's main actionable groups (59 warning-level).

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

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

What it measures: Acknowledged debt left in the code — TODOs, dead code, suppressed warnings.

Method: Roslyn syntactic debt markers (suppressions/TODO/FIXME/HACK/empty-catch/commented-code/Obsolete) plus SymbolFinder dead-code analysis; weighted-debt-per-KLoC density deducted 2.0x per unit. Deterministic, exhaustive.

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

10 deducted task-comment markers across 348157 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.

TodoComment · ×10test_handoff_static_checks.py:435

What to do

  1. Resolve the 10 TodoComment finding(s) in Explicit Debt — start with test_handoff_static_checks.py (10). — One of this dimension's main actionable groups (10 warning-level).

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

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

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

Method: Every README, docs/ document and root guide parsed by its markup and measured in Unicode letters. Published: a runnable or packaged .NET project whose README (or a document it links, or a root guide) shows no example, and a root README naming none of three or more projects. Overview, licence, boilerplate, wall-of-text, empty-section and XML-doc rows are measured and withheld (counted in gaps) after adjudication. Deterministic, exhaustive, advisory.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d19_recommendation.md.

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

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

Method: Every ADR read by its section structure: nine located rules (a missing Decision, Context or Consequences section, a stale status, two records deciding the same question, a dangling supersede link, a number-only title, a single option, no named cost, no status where the log uses one, no enforcement field where the log adopted one), each a fixed deduction from 10; the score is the mean over evaluated records. Deterministic, no model. Advisory.

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

No architecture decision records were found.

No ADRs foundAtria/Atria.xcodeproj/project.pbxproj:1

What to do

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

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

D21 · Naming Consistency9.0 / 10Strong✓ Tool-verified

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

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

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

2 naming inconsistencies among 192 declarations measured against a convention their peers follow.

`fallbackHrv` spells `Hrv` where 154 names in the project spell it `HRV`Atria/Atria/AtriaHomeView.swift:13429
`lastGyroCsvKey` spells `Csv` where 36 names in the project spell it `CSV`Atria/Atria/AtriaWhoop4CompactIMU.swift:387

What to do

  1. Resolve the 1 `fallbackHrv` spells `Hrv` where 154 names in the project spell it `HRV` finding(s) in Naming Consistency — start with AtriaHomeView.swift. — One of this dimension's main actionable groups (1 recommendation-level).
  2. Resolve the 1 `lastGyroCsvKey` spells `Csv` where 36 names in the project spell it… finding(s) in Naming Consistency — start with AtriaWhoop4CompactIMU.swift. — One of this dimension's main actionable groups (1 recommendation-level).

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

D26 · Project Cohesion0.0 / 10Critical✓ Tool-verified

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

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

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

2 of 3 build units (SwiftPM, Xcode, checkout) flagged as possibly oversized/incoherent.

Projects may be oversized for their cohesion · ×2Atria/Atria.xcodeproj/project.pbxproj:1

What to do

  1. Resolve the 2 Projects may be oversized for their cohesion finding(s) in Project Cohesion — start with project.pbxproj. — One of this dimension's main actionable groups (2 recommendation-level).

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

D27 · Navigability10.0 / 10Exemplary✓ Tool-verified

What it measures: How far you must trace to follow a call — low indirection and co-located slices read easier.

Method: Call indirection (interface hops, cross-namespace calls, slice-locality scaled) over a sampled set of method invocations, size-aware baseline. Sampled; confidence discounted by symbol-resolution gaps. C# also names each pass-through layer (a class whose every public method only forwards its own parameters to one collaborator) as a located finding; the score is not affected.

Coverage: Slice locality from the first namespace segments, SAMPLED (≤400 methods) — not exhaustive.

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

0 % of calls cross a namespace and 0 % 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.

✓ On the Gold path — maintain.

Detailed fixes: d27_recommendation.md.

D28 · Secrets (history)0.0 / 10Critical✓ Tool-verified

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

Method: REDACTED scan via TWO gitleaks detect passes in an isolated checkout — the full git history, then a second --no-git pass over the working tree as it stands — merged and de-duplicated by (rule, file, line); each match flagged High. Both invocations are recorded in the audit trail. Exhaustive; when the tool is absent, or when its output cannot be parsed into the expected shape, the dimension is WITHHELD as an explicit measurement gap on our side — unscored and excluded from the lens, never a hedged middling score.

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

10 finding(s): 0 critical, 10 high, 0 medium, 0 low. Remediation for historically-committed secrets is credential rotation — they remain in history regardless of later deletion.

REDACTED
REDACTED

What to do

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

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

D29 · Static Analysis (SAST)10.0 / 10Adequategated by 2 critical findings○ Nothing flagged

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

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

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

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

2 finding(s): 0 critical, 2 high, 0 medium, 0 low. 2 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 20 file(s) — `Atria/Atria/AtriaAICoach.swift` (lines 335–349, line 366), `Atria/Atria/AtriaHomeView.swift`, `Atria/Atria/AtriaIrregularRhythm.swift` (lines 107–109), `Atria/Atria/AtriaLiveWorkoutView.swift` (line 2249), `Atria/Atria/AtriaNightTimelineLoader.swift` (line 340), … (+15 more) — so no absence of findings in the named regions is evidence of anything; rows reported elsewhere in those files are real. Fix the syntax error (or exclude the file deliberately) and re-scan to cover them.

REDACTED

What to do

  1. No action in Static Analysis (SAST) — all 2 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 (2 issue-level, 0 of them charged here).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d34_recommendation.md.

D35 · Change Coupling9.9 / 10Stronggated by 3 serious findings✓ Tool-verified

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

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

Coverage: Population: PRODUCTION source files only — test and generated files are dropped before pairing, so a class co-changing with its own test (trivially ~100%) can't drown the real production↔production coupling. Pairs ranked by Degree-of-Coupling. A non-source file is never a coupling PARTICIPANT either: documentation, schemas, config and data files are dropped with the rest, so a code↔docs pair — a command and the reference page that restates it — is not reported however strongly the two co-change; nor is coupling that runs THROUGH a build step or config file.

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

Strongest change-coupling: AtriaCustomizeSheet.swift↔AtriaTodayScreen.swift 72%; AtriaAssistantScreen.swift↔AtriaOverviewSections.swift 64%; AtriaHeroConnectionSections.swift↔AtriaOverviewSections.swift 54%

Change coupling: AtriaCustomizeSheet.swift ↔ AtriaTodayScreen.swift · ×3Atria/Atria/AtriaCustomizeSheet.swift:1

What to do

  1. Resolve the 3 Change coupling finding(s) in Change Coupling — start with AtriaCustomizeSheet.swift, AtriaAssistantScreen.swift, AtriaHeroConnectionSections.swift. — One of this dimension's main actionable groups (3 warning-level).

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d37_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition10.0 / 10Exemplary✓ Tool-verified

Other · Architecture — How the codebase splits by code ROLE — domain, application, infrastructure, test, generated. The significance map behind the knowledge/coupling weighting, and a DDD signal in its own right: a thin domain core under fat infrastructure is the anemic-domain smell, quantified. How each file's role is decided, because the split is only as good as that: a generated name or a build-output tree makes it Generated, a test project makes it Test, and otherwise the file's NAMESPACE and PATH words are matched against fixed vocabularies in a fixed ORDER — domain, then infrastructure, then application — so a file whose words hit two layers is counted under the earlier one. A production file matching none of them counts as application, so that share reads 'application or unclassified' rather than a measured application layer. Roles come from naming convention, never from what the code does. On this repository the split was taken from the source tree on disk rather than from a loaded .NET workspace, so a file's role is decided by its PATH segments alone — no declared namespace was available to add to the evidence — and generated output is excluded from the census entirely rather than counted as a generated share.

Method: Roslyn line-count by code ROLE: every source file classified Domain/Application/Infrastructure/Test/Generated by namespace + path convention (the shared CodeRoleClassifier), then significant lines summed per role. Deterministic; the advisory score is the business-logic (domain+application) share of production code.

Coverage: Population: ALL source files, each bucketed into ONE of five roles (Domain/Application/Infrastructure/Test/Generated) by namespace + path convention — a file whose layer isn't named in the convention falls to Application (the neutral default), and the split is line-count, not semantic depth or business value.

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

Other · Architecture — Whether the project-reference graph is acyclic (cycles block independent build/deploy and signal eroding boundaries).

Method: Project reference cycles via elementary-DFS over real .csproj references, using the engine shared with D5/D7; cyclic versus acyclic. Exhaustive, deterministic.

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

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

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

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

Other · Architecture — Whether interfaces stay focused rather than fat — the Interface-Segregation principle (SOLID 'I').

Method: Roslyn scan: public interface declared-member counts (accessors fold into their property/event); fat-interface threshold (over 15 declared members) flagged per type. Each finding also reports the distinct-OPERATION count — members counted by name, so an overload group counts once — which decides whether it states the caller-side ISP harm or the implementer-side burden of an overload set. TypeScript: exported interfaces that declare behaviour, counted over their REQUIRED operations (method signatures and function-typed properties with no `?`, once per signature) — data-shape interfaces and ambient .d.ts declarations are outside the population; JavaScript declares no interfaces and is not applicable. Deterministic, type-level.

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

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

Method: Csproj graph: each production project checked for references to test projects (identified by test-framework presence, not name). Zero violations is clean. Deterministic.

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

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

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

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

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

Maturity · Maturity — Whether the repository and its projects have a README, and whether it is substantive.

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

M2 · Architecture documentation2.0 / 10Critical✓ Tool-verified

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

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

  • No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.

What to do

  • Record your significant design decisions. Write one short document per decision, giving its date, the situation, the decision and its consequences, and keep them together with your other design documents. A docs/adr folder with each file named by number and title is the easiest place to find them.
M3 · Folder & project structure8.0 / 10Strong✓ Tool-verified

Maturity · Maturity — Whether the repository is organised deliberately: production code and tests are set apart in a way its ecosystem or the repository itself declares.

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

  • Most of the production code is in directories of its own, but 35 application file(s) sit at the repository root beside the build and tooling files (`enumerate.py`, `listen.py`, `prepare_reference_rr.py`, `probe.py`, `scan.py` and 30 more).
M4 · Documentation accuracy10.0 / 10Exemplary○ Nothing flagged

Maturity · Maturity — Whether the project's current-state documentation describes the code that exists.

Method: Every current-state document's checkable claims looked up in the tree (links, versions, and artefact counts an order of magnitude off), plus two README checks: an advertised infrastructure product with no footprint, and a module the CHANGELOG records as removed. Deterministic, no model. Advisory.

P1 · CI/CD gates8.0 / 10Strong✓ Tool-verified

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.

  • A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.

What to do

  • Add an explicit build step to your CI pipeline — your stack's own build command, or, if the pipeline delegates to a task runner, a build task that runner executes in CI — so every change is built before merge.
P2 · Observability0.0 / 10Critical✓ Tool-verified

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

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

  • No logging or diagnostics emission found. This repository ships a binary its users launch rather than a service you operate, so there is no operator to page — but when a run fails on a user's machine, neither they nor you have anything to read.

What to do

  • Write a diagnostic trail the user can hand back with a bug report: log through `os.Logger` (one per subsystem), which the unified log keeps and a sysdiagnose carries to you. Start with the error paths that emit nothing — a discarded error is the failure the user cannot describe and you cannot reproduce.
P3 · Security & performance tooling0.0 / 10Critical✓ Tool-verified

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

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

  • No static application security testing detected. For this repository's stack, add CodeQL's Swift pack (Swift/Xcode) (or `semgrep --config=auto`, which runs on any language) as a CI step. What was searched, so you can tell an absence from a miss: the 1 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:6

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.
P5 · DR & Backup4.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether disaster recovery is planned and codified — backups, geo-recovery, RTO/RPO, persistence guarantees — from IaC + container manifests + docs, never the live cloud.

Method: Filesystem scan: disaster recovery, backup, geo-recovery, RTO/RPO, persistence guarantees from IaC, manifests, and docs. Exhaustive, deterministic, never a live environment.

What to do

  • Document RTO/RPO and a tested restore procedure (a backup config alone isn't disaster recovery).
PF3 · Async & latency hygiene10.0 / 10Exemplary✓ Tool-verified

Readiness · Performance — Whether asynchronous code stays responsive — it avoids sync-over-async blocking (a .NET .Wait()/.GetAwaiter().GetResult(), a time.sleep or blocking HTTP call inside a Python coroutine, a *Sync call inside an async JavaScript function, block_on inside a Rust async fn, runBlocking inside a Kotlin suspend function, block() inside a Reactor publisher) that stalls a thread or event loop and risks deadlock, and, where the code is a reusable library on .NET, awaits with ConfigureAwait(false) so it never captures and stalls its caller's context.

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from 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.

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

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

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

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

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

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

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

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

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

  • An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it. — listen.py:59
  • `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter. — symbolicate_atria_reports.py:12
  • `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. (×38) — REDACTED:19060, REDACTED:30799, REDACTED:42975, …

What to do

  • Swallowed exception (empty catch)

Reference — by lens

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

LensScoreRatingImpact
Code Health62.3Adequate — gated by D1, D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture93.3Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity59.3Adequate — gated by M2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Readiness33.8Weak — gated by P2, P3Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security66.7Checked 4 of 11Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance100.0ExemplaryStrongest area.
Unscored — 3 check(s) recorded observations but carry no score

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

  • D36 Supply-chain Provenance & Signing — 1 observation(s) recorded · The CI pipeline publishes no artifact — no package publish, container push or release with files to download. Supply-chain provenance, signing and an SBOM describe a PUBLISHED artifact for the people who obtain it, so there is nothing to attest here; a deployment of the service itself publishes nothing for anyone else to verify. Add them to the release pipeline when this repo starts publishing artifacts (a package, a container image, or a release with downloadable files). Build integrity and workflow-token hygiene are reported below: they describe what the CI runs and the token it runs with, neither of which is affected by whether the pipeline ships an artifact.
  • X10 Duplicated predicate — 40 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 21 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 5 control(s) we could not find positive evidence for

These checks grade a working control, and the repository shows no evidence of one. That is deliberately not scored as a zero: a repository cannot show an ops runbook, a database TTL or an infrastructure-side audit log, so absence of evidence here is not evidence the control is missing. It is also not a statement that the check is irrelevant to this codebase — the thing it grades applies; we just could not see it. Excluded from the score either way.

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — Not assessed: this repository stores data through 'SQLite3' (Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:2) but declares no persisted model this check reads (SwiftData @Model, Core Data, Realm, GRDB and Fluent types, GRDB and SQLite.swift columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL migrations). Personal data may be written through raw SQL or a hosted backend, so whether a retention limit applies here could not be established, and its absence is not scored.
  • C5 Data-Subject Rights — Not assessed: this repository stores data through 'SQLite3' (Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:2) but declares no persisted model this check reads (SwiftData @Model, Core Data NSManagedObject, Realm Object, GRDB record and Fluent Model properties, GRDB and SQLite.swift columns, CREATE TABLE and ALTER TABLE … ADD columns in SQL files). Personal data may be written through raw SQL or a hosted backend, so whether data-subject rights apply here could not be established, and their absence is not scored.
  • P4 Deployment & Rollback — not evidenced — no deploy/rollback/approval signal in the repo; absence of evidence is not evidence of a manual release
  • P6 Release Hygiene — not evidenced — no changelog, version stamp or semver release tag in the repo
Not included — 68 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.
  • 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.
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • 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.
  • D11 Test Reliability — Test reliability not included — no .swift test runner
  • D12 Dependency Hygiene — Not scored — 0 SwiftPM declaration(s) across 1 `Package.swift` and 0 committed pin(s) were read for PINNING discipline (0 defect(s) reported), but the outdated signal comes from listing each declared repository's release tags rather than from a registry, and none of them resolved to a version to compare, so this dimension's own question is only partly answered. NOT a finding that these dependencies are current or healthy.
  • D16 Bus Factor — single-contributor repository — bus factor is not applicable
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D22 Internal API Consistency — The exposed public-API surface could not be collected — no C#/VB projects loaded.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. 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, .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 — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
  • 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) — 39 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • 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 — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).
  • 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
  • D8 Code Coverage — Coverage not measured — polyglot repository, one half has no runner
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (28 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
  • 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, Scala, Rust and Java, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P7 Outbound HTTP resilience — not applicable — no HTTP server, API framework or worker entry point was found in the Python, 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 33 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 7% of this repository's production lines — swift (323,735 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X12 Unreachable branch — X12 reached only 7% of this repository's production lines — swift (323,735 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X13 Undrained process stream — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X14 Bypassable address classification — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X15 Unvalidated length from an untrusted reader — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X16 Unfloored truncation loop — 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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X18 Disposal-pattern correctness — not 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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • 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 applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X23 Unguarded diagnostic materialisation — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X24 Document value interpolated into markup unescaped — not applicable — the code was read and holds no site of this kind, so there is nothing for this check to judge
  • X25 Inert configuration knob — 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 — X27 reached only 7% of this repository's production lines — swift (323,735 lines), javascript (30 lines) was left unread. Not scored: a score over a minority of the product would be published as the whole of it.
  • X29 Per-element action decided by a fixed element — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X30 Support guard that admits what it rejects — 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 — This check asks whether log calls keep a message's values apart from its text, which needs a logger that can carry them as fields. This repository's Swift was read, and it logs through none: `print` and `NSLog` take one finished line, and os's `Logger` keeps each interpolated value as its own argument, so an assembled message there loses nothing the API could have kept (as with log4net in C#). Calls through swift-log (`import Logging`) and `os_log` calls would be judged.
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • X9 Subsumed condition operand — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.

Appendix A — Findings (grouped)

The findings behind the scores, grouped by severity, then by dimension and kind. The high-severity issues are enumerated in full below; items per group are capped at 25 with any overflow stated explicitly per group, never silently truncated. The complete machine-readable list of every finding (all severities) is the companion findings.md in this report's bundle.

Critical — 12 finding(s)
D28 · Secrets (history) · REDACTED · ×10
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
Serious — 3228 finding(s)
D3 · God Classes · MethodTooLong · ×219
  • MethodTooLong: AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded REDACTED:13289 — MethodTooLong — requestOfflineHistoricalSyncIfNeeded runs 869 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 769 over it, 8.69× 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: SessionStore.aggregateSleepCandidatesCore Atria/Atria/Sessions.swift:50025 — MethodTooLong — aggregateSleepCandidatesCore runs 806 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 706 over it, 8.06× 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: AtriaBLEManager.scheduleFullDrainConsumerMaterialization REDACTED:46608 — MethodTooLong — scheduleFullDrainConsumerMaterialization runs 745 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 645 over it, 7.45× 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: SessionStore.runRecoveredHeartRateProjection Atria/Atria/Sessions.swift:15199 — MethodTooLong — runRecoveredHeartRateProjection runs 700 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 600 over it, 7.00× 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: AtriaBLEManager.centralManager REDACTED:54164 — MethodTooLong — centralManager runs 692 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 592 over it, 6.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.
  • MethodTooLong: AtriaBLEManager.startOfflineHistoricalSync REDACTED:16963 — MethodTooLong — startOfflineHistoricalSync runs 594 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 494 over it, 5.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.
  • MethodTooLong: AtriaBLEManager.peripheral REDACTED:56686 — MethodTooLong — peripheral runs 547 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 447 over it, 5.47× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: WidgetSnapshotPublisher.publish Atria/Atria/WidgetSnapshot.swift:1653 — MethodTooLong — publish runs 522 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 422 over it, 5.22× 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: AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded REDACTED:38001 — MethodTooLong — resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded runs 495 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 395 over it, 4.95× 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: AtriaBLEManager.finishOfflineHistoricalSync REDACTED:19222 — MethodTooLong — finishOfflineHistoricalSync runs 473 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 373 over it, 4.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: AtriaBLEManager.init REDACTED:6959 — MethodTooLong — init runs 422 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 322 over it, 4.22× 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: AtriaBLEManager.armHistoryOnlyProbe REDACTED:40410 — MethodTooLong — armHistoryOnlyProbe runs 422 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 322 over it, 4.22× 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: SessionStore.validateSessionBackupEnvelopeForImport Atria/Atria/Sessions.swift:48099 — MethodTooLong — validateSessionBackupEnvelopeForImport runs 410 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 310 over it, 4.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: AtriaBLEManager.peripheral REDACTED:55594 — MethodTooLong — peripheral runs 386 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 286 over it, 3.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: AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:88 — MethodTooLong — verify runs 385 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 285 over it, 3.85× 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: SessionStore.handleRecoveredDataRecomputeEffects Atria/Atria/Sessions.swift:18410 — MethodTooLong — handleRecoveredDataRecomputeEffects runs 384 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 284 over it, 3.84× 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: AtriaBLEManager.processHistoricalDrainEffects REDACTED:45898 — MethodTooLong — processHistoricalDrainEffects runs 358 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 258 over it, 3.58× 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: SessionStore.resumedSleepReviewCandidatesCore Atria/Atria/Sessions.swift:51622 — MethodTooLong — resumedSleepReviewCandidatesCore runs 340 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 240 over it, 3.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AtriaBLEManager.centralManager REDACTED:53660 — MethodTooLong — centralManager runs 336 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 236 over it, 3.36× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: HistoricalArchive.motionTickDayEvidenceReadImpl Atria/Atria/HistoricalArchive.swift:3744 — MethodTooLong — motionTickDayEvidenceReadImpl runs 325 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 225 over it, 3.25× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AtriaBLEManager.applyLaunchAutomation REDACTED:24590 — MethodTooLong — applyLaunchAutomation runs 318 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 218 over it, 3.18× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: SessionStore.logGateStatusFromLaunchIfRequested Atria/Atria/Sessions.swift:31247 — MethodTooLong — logGateStatusFromLaunchIfRequested runs 315 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 215 over it, 3.15× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AtriaBLEManager.runForegroundKeepaliveTick REDACTED:10681 — MethodTooLong — runForegroundKeepaliveTick runs 300 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 200 over it, 3.00× 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: SessionStore.confirmWorkoutWindow Atria/Atria/Sessions.swift:34270 — MethodTooLong — confirmWorkoutWindow runs 277 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 177 over it, 2.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AtriaBLEManager.performHRContinuityWatchdogAction REDACTED:25889 — MethodTooLong — performHRContinuityWatchdogAction runs 265 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 165 over it, 2.65× 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.
  • + 194 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×68
  • FileTooLong: Atria/Sessions.swift Atria/Atria/Sessions.swift — FileTooLong — 46296 significant lines (blank, comment-only and punctuation-only lines excluded), about 80% of them inside a single declaration: SessionStore (8848-58663). The bar is 500 significant lines; this is 45796 over it, 92.59× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: REDACTED REDACTED — FileTooLong — 42163 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: AtriaBLEManager (559-53002). The bar is 500 significant lines; this is 41663 over it, 84.33× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Atria/AtriaHomeView.swift Atria/Atria/AtriaHomeView.swift — FileTooLong — 10648 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 10148 over it, 21.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Atria/HistoricalArchive.swift Atria/Atria/HistoricalArchive.swift — FileTooLong — 8440 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: HistoricalArchive (3-10858). The bar is 500 significant lines; this is 7940 over it, 16.88× 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: Atria/AtriaOverviewSections.swift Atria/Atria/AtriaOverviewSections.swift — FileTooLong — 7608 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 7108 over it, 15.22× 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: Atria/AtriaActivityMonitor.swift Atria/Atria/AtriaActivityMonitor.swift — FileTooLong — 4003 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3503 over it, 8.01× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Atria/AtriaVitalsCollectionSections.swift Atria/Atria/AtriaVitalsCollectionSections.swift — FileTooLong — 3647 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 3147 over it, 7.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: Atria/AtriaTodayScreen.swift Atria/Atria/AtriaTodayScreen.swift — FileTooLong — 3323 significant lines (blank, comment-only and punctuation-only lines excluded), about 62% of them inside a single declaration: AtriaTodayScreen (250-3459). The bar is 500 significant lines; this is 2823 over it, 6.65× 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: Atria/AtriaLiveWorkoutView.swift Atria/Atria/AtriaLiveWorkoutView.swift — FileTooLong — 3056 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2556 over it, 6.11× 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: Atria/AtriaStressMonitor.swift Atria/Atria/AtriaStressMonitor.swift — FileTooLong — 3036 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2536 over it, 6.07× 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: AtriaWidget/AtriaWidget.swift Atria/AtriaWidget/AtriaWidget.swift — FileTooLong — 2829 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 2329 over it, 5.66× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Atria/AtriaShareCard.swift Atria/Atria/AtriaShareCard.swift — FileTooLong — 2468 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1968 over it, 4.94× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Atria/AtriaHealthScreen.swift Atria/Atria/AtriaHealthScreen.swift — FileTooLong — 2396 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1896 over it, 4.79× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Atria/AtriaWhoop4MotionTickCompactStore.swift Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift — FileTooLong — 2228 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: AtriaWhoop4MotionTickCompactStore (11-3175). The bar is 500 significant lines; this is 1728 over it, 4.46× 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: Atria/WidgetSnapshot.swift Atria/Atria/WidgetSnapshot.swift — FileTooLong — 2174 significant lines (blank, comment-only and punctuation-only lines excluded), about 96% of them inside a single declaration: WidgetSnapshotPublisher (179-2881). The bar is 500 significant lines; this is 1674 over it, 4.35× 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: Atria/AtriaBLEHistoricalRecoveryPolicy.swift Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift — FileTooLong — 1992 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1492 over it, 3.98× 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: Atria/AtriaAnalytics.swift Atria/Atria/AtriaAnalytics.swift — FileTooLong — 1970 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: AtriaAnalytics (3-2644). The bar is 500 significant lines; this is 1470 over it, 3.94× 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: Atria/HealthKitExporter.swift Atria/Atria/HealthKitExporter.swift — FileTooLong — 1951 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: HealthKitExporter (5-2390). The bar is 500 significant lines; this is 1451 over it, 3.90× 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: Atria/LocalNotificationScheduler.swift Atria/Atria/LocalNotificationScheduler.swift — FileTooLong — 1888 significant lines (blank, comment-only and punctuation-only lines excluded), about 91% of them inside a single declaration: LocalNotificationScheduler (6-2413). The bar is 500 significant lines; this is 1388 over it, 3.78× 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: Atria/AtriaSettingsView.swift Atria/Atria/AtriaSettingsView.swift — FileTooLong — 1870 significant lines (blank, comment-only and punctuation-only lines excluded), about 61% of them inside a single declaration: AtriaSettingsView (120-1766). The bar is 500 significant lines; this is 1370 over it, 3.74× 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: Atria/AtriaHistoricalArchiveDurableStore.swift Atria/Atria/AtriaHistoricalArchiveDurableStore.swift — FileTooLong — 1622 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: AtriaHistoricalArchiveDurableStore (12-2430). The bar is 500 significant lines; this is 1122 over it, 3.24× 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: Atria/AtriaWhoop4MotionTickStepModel.swift Atria/Atria/AtriaWhoop4MotionTickStepModel.swift — FileTooLong — 1524 significant lines (blank, comment-only and punctuation-only lines excluded), about 90% of them inside a single declaration: AtriaWhoop4GravityCadenceStepModel (231-2071). The bar is 500 significant lines; this is 1024 over it, 3.05× 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: Atria/AtriaTrendChart.swift Atria/Atria/AtriaTrendChart.swift — FileTooLong — 1496 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 996 over it, 2.99× 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: Atria/AtriaIMUDiagnosticTransport.swift Atria/Atria/AtriaIMUDiagnosticTransport.swift — FileTooLong — 1458 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: AtriaIMUDiagnosticTransport (24-1901). The bar is 500 significant lines; this is 958 over it, 2.92× 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: Atria/AtriaR10Motion.swift Atria/Atria/AtriaR10Motion.swift — FileTooLong — 1384 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 884 over it, 2.77× 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.
  • + 43 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×62
  • ClassTooLong: AtriaBLEManager REDACTED:558 — ClassTooLong — 38143 significant lines (blank, comment-only and punctuation-only lines excluded), 1400 methods. The bar is 400 significant lines; this is 37743 over it, 95.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: SessionStore Atria/Atria/Sessions.swift:8847 — ClassTooLong — 37261 significant lines (blank, comment-only and punctuation-only lines excluded), 1127 methods. The bar is 400 significant lines; this is 36861 over it, 93.15× 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: HistoricalArchive Atria/Atria/HistoricalArchive.swift:3 — ClassTooLong — 7987 significant lines (blank, comment-only and punctuation-only lines excluded), 215 methods. The bar is 400 significant lines; this is 7587 over it, 19.97× 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: AtriaWhoop4MotionTickCompactStore Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:11 — ClassTooLong — 2226 significant lines (blank, comment-only and punctuation-only lines excluded), 67 methods. The bar is 400 significant lines; this is 1826 over it, 5.57× 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: WidgetSnapshotPublisher Atria/Atria/WidgetSnapshot.swift:178 — ClassTooLong — 2080 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 1680 over it, 5.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.
  • ClassTooLong: AtriaTodayScreen Atria/Atria/AtriaTodayScreen.swift:250 — ClassTooLong — 2064 significant lines (blank, comment-only and punctuation-only lines excluded), 52 methods. The bar is 400 significant lines; this is 1664 over it, 5.16× 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: AtriaAnalytics Atria/Atria/AtriaAnalytics.swift:3 — ClassTooLong — 1969 significant lines (blank, comment-only and punctuation-only lines excluded), 0 methods. The bar is 400 significant lines; this is 1569 over it, 4.92× 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: HealthKitExporter Atria/Atria/HealthKitExporter.swift:4 — ClassTooLong — 1948 significant lines (blank, comment-only and punctuation-only lines excluded), 64 methods. The bar is 400 significant lines; this is 1548 over it, 4.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: LocalNotificationScheduler Atria/Atria/LocalNotificationScheduler.swift:5 — ClassTooLong — 1723 significant lines (blank, comment-only and punctuation-only lines excluded), 85 methods. The bar is 400 significant lines; this is 1323 over it, 4.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AtriaHistoricalArchiveDurableStore Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:12 — ClassTooLong — 1619 significant lines (blank, comment-only and punctuation-only lines excluded), 59 methods. The bar is 400 significant lines; this is 1219 over it, 4.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AtriaActivityMonitorTab Atria/Atria/AtriaActivityMonitor.swift:1621 — ClassTooLong — 1456 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 1056 over it, 3.64× 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: AtriaIMUDiagnosticTransport Atria/Atria/AtriaIMUDiagnosticTransport.swift:24 — ClassTooLong — 1455 significant lines (blank, comment-only and punctuation-only lines excluded), 78 methods. The bar is 400 significant lines; this is 1055 over it, 3.64× 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: AtriaWhoop4GravityCadenceStepModel Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:231 — ClassTooLong — 1366 significant lines (blank, comment-only and punctuation-only lines excluded), 24 methods. The bar is 400 significant lines; this is 966 over it, 3.42× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: SleepHistorySnapshot Atria/Atria/Sessions.swift:59498 — ClassTooLong — 1188 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 788 over it, 2.97× 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: AtriaStressMonitorStore Atria/Atria/AtriaStressMonitor.swift:2886 — ClassTooLong — 1163 significant lines (blank, comment-only and punctuation-only lines excluded), 56 methods. The bar is 400 significant lines; this is 763 over it, 2.91× 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: AtriaSettingsView Atria/Atria/AtriaSettingsView.swift:120 — ClassTooLong — 1148 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 748 over it, 2.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AtriaHistoricalFullDrainCoverageStore Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:14 — ClassTooLong — 1094 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 694 over it, 2.74× 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: ActiveSessionJournal Atria/Atria/ActiveSessionJournal.swift:128 — ClassTooLong — 1086 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 686 over it, 2.72× 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: AtriaWhoop4HistoryAdmissionLedger Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:29 — ClassTooLong — 1068 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 668 over it, 2.67× 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: AtriaHistoricalGapLedger Atria/Atria/AtriaHistoricalGapLedger.swift:9 — ClassTooLong — 1049 significant lines (blank, comment-only and punctuation-only lines excluded), 63 methods. The bar is 400 significant lines; this is 649 over it, 2.62× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AtriaHistoricalStressReplay Atria/Atria/AtriaStressMonitor.swift:1276 — ClassTooLong — 989 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 589 over it, 2.47× 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: SavedSession Atria/Atria/Sessions.swift:1431 — ClassTooLong — 965 significant lines (blank, comment-only and punctuation-only lines excluded), 59 methods. The bar is 400 significant lines; this is 565 over it, 2.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: AtriaSleepWakeResearch Atria/Atria/AtriaSleepWakeResearch.swift:102 — ClassTooLong — 925 significant lines (blank, comment-only and punctuation-only lines excluded), 26 methods. The bar is 400 significant lines; this is 525 over it, 2.31× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: AtriaWhoop4ExactRangeTrialHarness Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:19 — ClassTooLong — 901 significant lines (blank, comment-only and punctuation-only lines excluded), 36 methods. The bar is 400 significant lines; this is 501 over it, 2.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: AtriaApp Atria/Atria/AtriaApp.swift:390 — ClassTooLong — 867 significant lines (blank, comment-only and punctuation-only lines excluded), 27 methods. The bar is 400 significant lines; this is 467 over it, 2.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.
  • + 37 more in this group — see findings.md.
D15 · Churn × Complexity Hotspots · Hotspot · ×59
  • Hotspot: Atria/Atria/Sessions.swift Atria/Atria/Sessions.swift:48099 — Atria/Atria/Sessions.swift changed 327 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 360 in SessionStore.validateSessionBackupEnvelopeForImport at line 48099. 78 of those changes were fix/bug commits, and the other 249 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/Sessions.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: REDACTED REDACTED:13289 — REDACTED changed 383 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 177 in AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded at line 13289. 61 of those changes were fix/bug commits, and the other 322 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- REDACTED`: merges are excluded because a merge re-states changes already counted at their own commits, and history is NOT path-simplified because a change that reached the file through a merged branch is still a change to it. That command counts raw commits and can read HIGHER than this row, which counts a cherry-picked re-land, and a revert together with the commit it undoes, once each — a difference of several commits on a file whose history was re-landed or reverted inside the window.
  • Hotspot: Atria/Atria/AtriaHomeView.swift Atria/Atria/AtriaHomeView.swift:14203 — Atria/Atria/AtriaHomeView.swift changed 253 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 70 in AtriaTopStatusProjection.presentation at line 14203. 27 of those changes were fix/bug commits, and the other 226 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaHomeView.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: Atria/Atria/AtriaOverviewSections.swift Atria/Atria/AtriaOverviewSections.swift:4783 — Atria/Atria/AtriaOverviewSections.swift changed 225 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 42 in AtriaMetricDetailSheet.detailTemplate at line 4783. 27 of those changes were fix/bug commits, and the other 198 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaOverviewSections.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: Atria/Atria/HistoricalArchive.swift Atria/Atria/HistoricalArchive.swift:9722 — Atria/Atria/HistoricalArchive.swift changed 83 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 95 in HistoricalArchive.compactArchive at line 9722. 24 of those changes were fix/bug commits, and the other 59 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/HistoricalArchive.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: Atria/Atria/AtriaTodayScreen.swift Atria/Atria/AtriaTodayScreen.swift:2960 — Atria/Atria/AtriaTodayScreen.swift changed 163 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 33 in AtriaTodayScreen.glanceItem at line 2960. 21 of those changes were fix/bug commits, and the other 142 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaTodayScreen.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: Atria/Atria/WidgetSnapshot.swift Atria/Atria/WidgetSnapshot.swift:1653 — Atria/Atria/WidgetSnapshot.swift changed 45 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 81 in WidgetSnapshotPublisher.publish at line 1653. 5 of those changes were fix/bug commits, and the other 40 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/WidgetSnapshot.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: Atria/Atria/AtriaDailyStepPresentation.swift Atria/Atria/AtriaDailyStepPresentation.swift:480 — Atria/Atria/AtriaDailyStepPresentation.swift changed 41 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 83 in AtriaDailyStepPresentation.resolve at line 480. 4 of those changes were fix/bug commits, and the other 37 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaDailyStepPresentation.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: Atria/Atria/AtriaActivityMonitor.swift Atria/Atria/AtriaActivityMonitor.swift:4025 — Atria/Atria/AtriaActivityMonitor.swift changed 106 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in AtriaActivityWorkoutDetailSheet.body at line 4025. 9 of those changes were fix/bug commits, and the other 97 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaActivityMonitor.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: Atria/AtriaWidget/AtriaWidget.swift Atria/AtriaWidget/AtriaWidget.swift:3653 — Atria/AtriaWidget/AtriaWidget.swift changed 50 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 53 in AtriaWidgetMetric.statusText at line 3653. 7 of those changes were fix/bug commits, and the other 43 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/AtriaWidget/AtriaWidget.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: Atria/Atria/AtriaHealthScreen.swift Atria/Atria/AtriaHealthScreen.swift:3284 — Atria/Atria/AtriaHealthScreen.swift changed 116 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in AtriaSleepStressCard.body at line 3284. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaHealthScreen.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: Atria/Atria/AtriaApp.swift Atria/Atria/AtriaApp.swift:1536 — Atria/Atria/AtriaApp.swift changed 40 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in AtriaApp.scheduleLaunchExportsIfRequested at line 1536. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaApp.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: Atria/Atria/AtriaVitalsCollectionSections.swift Atria/Atria/AtriaVitalsCollectionSections.swift:4709 — Atria/Atria/AtriaVitalsCollectionSections.swift changed 106 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 17 in AtriaHeartRateAxisChart.baseChart at line 4709. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaVitalsCollectionSections.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: Atria/Atria/AtriaDiagnosisReport.swift Atria/Atria/AtriaDiagnosisReport.swift:285 — Atria/Atria/AtriaDiagnosisReport.swift changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 78 in AtriaDiagnosisReport.discrepancies at line 285. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaDiagnosisReport.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: Atria/Atria/AtriaStressMonitor.swift Atria/Atria/AtriaStressMonitor.swift:1665 — Atria/Atria/AtriaStressMonitor.swift changed 32 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in AtriaHistoricalStressReplay.materialize at line 1665. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaStressMonitor.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: Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2820 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift changed 54 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in AtriaBLEManager.resilientHistoryDrainSeekUnix at line 2820. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.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: Atria/Atria/AtriaAnalytics.swift Atria/Atria/AtriaAnalytics.swift:1374 — Atria/Atria/AtriaAnalytics.swift changed 26 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in Recovery.estimate at line 1374. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaAnalytics.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: Atria/Atria/AtriaLiveWorkoutView.swift Atria/Atria/AtriaLiveWorkoutView.swift:2845 — Atria/Atria/AtriaLiveWorkoutView.swift changed 42 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in AtriaLiveWorkoutView.workoutActionsCard at line 2845. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaLiveWorkoutView.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: Atria/Atria/AtriaHistoricalArchiveDurableStore.swift Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1651 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 47 in AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry at line 1651. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaHistoricalArchiveDurableStore.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: Atria/Atria/AtriaSettingsView.swift Atria/Atria/AtriaSettingsView.swift:1121 — Atria/Atria/AtriaSettingsView.swift changed 44 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in AtriaSettingsView.dataSection at line 1121. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaSettingsView.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: Atria/Atria/AtriaTrendChart.swift Atria/Atria/AtriaTrendChart.swift:99 — Atria/Atria/AtriaTrendChart.swift changed 47 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 16 in AtriaTrendChartCard.body at line 99. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaTrendChart.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: Atria/Atria/AtriaR10Motion.swift Atria/Atria/AtriaR10Motion.swift:1829 — Atria/Atria/AtriaR10Motion.swift changed 20 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 30 in AtriaR10MotionPipeline.accept at line 1829. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaR10Motion.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: Atria/Atria/AtriaSleepWakeResearch.swift Atria/Atria/AtriaSleepWakeResearch.swift:693 — Atria/Atria/AtriaSleepWakeResearch.swift changed 11 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 51 in AtriaSleepWakeResearch.stage at line 693. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaSleepWakeResearch.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: Atria/Atria/LocalNotificationScheduler.swift Atria/Atria/LocalNotificationScheduler.swift:1167 — Atria/Atria/LocalNotificationScheduler.swift changed 23 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in LocalNotificationScheduler.schedule at line 1167. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/LocalNotificationScheduler.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: Atria/Atria/AtriaAboutMetricSheet.swift Atria/Atria/AtriaAboutMetricSheet.swift:267 — Atria/Atria/AtriaAboutMetricSheet.swift changed 27 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in AtriaAboutMetricTrend.make at line 267. 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-16..2026-10-14, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-16 02:25:31 +05:30' --until='2026-10-14 02:25:31 +05:30' --full-history --no-merges -- Atria/Atria/AtriaAboutMetricSheet.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.
  • + 34 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×52
  • Duplicated block (6 lines × 2) Atria/Atria/ActiveSessionJournal.swift:1028 — Atria/Atria/ActiveSessionJournal.swift:1028-1033 | REDACTED:52582-52587 — 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 `Atria/Atria/ActiveSessionJournal.swift:1028` 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 (6 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:3441 — Atria/Atria/AtriaActivityMonitor.swift:3441-3446 | Atria/Atria/AtriaActivityMonitor.swift:4835-4840 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) REDACTED:30803 — REDACTED:30803-30808 | Atria/Atria/Sessions.swift:54998-55003 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) REDACTED:34272 — REDACTED:34272-34277 | REDACTED:34655-34660 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:34272` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaBehaviorImpactPresentation.swift:288 — Atria/Atria/AtriaBehaviorImpactPresentation.swift:288-293 | Atria/Atria/AtriaJournalInsights.swift:175-180 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaExpandedChart.swift:31 — Atria/Atria/AtriaExpandedChart.swift:31-36 | Atria/Atria/AtriaVitalsCollectionSections.swift:209-214 — 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 `Atria/Atria/AtriaExpandedChart.swift:31` 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 (6 lines × 2) Atria/Atria/AtriaGraphGrammar.swift:762 — Atria/Atria/AtriaGraphGrammar.swift:762-767 | Atria/Atria/AtriaOverviewSections.swift:9059-9064 — 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 `Atria/Atria/AtriaGraphGrammar.swift:762` 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 first that the copies are not typed on the same thing: the declarations holding them bind `calendar` to `Calendar = .current` in one and `Calendar` 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 (6 lines × 2) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:174 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:174-179 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:257-262 — 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 `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:174` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1054 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1054-1059 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2239-2244 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:260 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:260-265 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:167-172 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:169 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:169-174 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:231-237 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:169` 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 (6 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:352 — Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:352-357 | Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:443-448 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:604 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:604-612 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:667-672 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:604` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. 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) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389-394 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:563-568 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:614 — Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:614-619 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:626-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note first that the copies are not typed on the same thing: the declarations holding them bind `bindings` to `[Binding] = []` in one and `[Binding]` 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 (6 lines × 2) Atria/Atria/AtriaHistoricalShadowCompactionCoordinator.swift:99 — Atria/Atria/AtriaHistoricalShadowCompactionCoordinator.swift:99-104 | Atria/Atria/HistoricalArchive.swift:9964-9969 — 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 `Atria/Atria/AtriaHistoricalShadowCompactionCoordinator.swift:99` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaLearnedInsightsBoard.swift:268 — Atria/Atria/AtriaLearnedInsightsBoard.swift:268-273 | Atria/Atria/AtriaOverviewSections.swift:10445-10450 — 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 `Atria/Atria/AtriaLearnedInsightsBoard.swift:268` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaLiveWorkoutView.swift:1934 — Atria/Atria/AtriaLiveWorkoutView.swift:1934-1939 | Atria/Atria/AtriaLiveWorkoutView.swift:1970-1975 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaLiveWorkoutView.swift:1934` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `4` in one and `12` 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 (6 lines × 2) Atria/Atria/AtriaNightTimelineView.swift:328 — Atria/Atria/AtriaNightTimelineView.swift:328-333 | Atria/Atria/HRV.swift:610-615 — 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 `Atria/Atria/AtriaNightTimelineView.swift:328` 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 (6 lines × 2) Atria/Atria/AtriaPhysiologicalStressModel.swift:667 — Atria/Atria/AtriaPhysiologicalStressModel.swift:667-672 | Atria/Atria/AtriaStressMonitor.swift:3328-3333 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaSharedChrome.swift:150 — Atria/Atria/AtriaSharedChrome.swift:150-155 | Atria/Atria/AtriaSharedChrome.swift:213-218 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaSleepHypnogram.swift:936 — Atria/Atria/AtriaSleepHypnogram.swift:936-941 | Atria/Atria/AtriaVitalsCollectionSections.swift:5212-5217 — 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 `Atria/Atria/AtriaSleepHypnogram.swift:936` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Atria/Atria/AtriaTrendChart.swift:939 — Atria/Atria/AtriaTrendChart.swift:939-944 | Atria/Atria/AtriaTrendChart.swift:1308-1313 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaTrendChart.swift:939` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Atria/Atria/HistoricalArchive.swift:7346 — Atria/Atria/HistoricalArchive.swift:7346-7351 | Atria/Atria/HistoricalArchive.swift:7425-7430 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6 lines × 2) Atria/Atria/Sessions.swift:22390 — Atria/Atria/Sessions.swift:22390-22395 | Atria/Atria/Sessions.swift:22512-22521 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • + 27 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×46
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaActiveSessionRestorePreparer.swift:398 — Atria/Atria/AtriaActiveSessionRestorePreparer.swift:398-404 | tools/replay_step_calibration.swift:485-491 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaAnalytics.swift:793 — Atria/Atria/AtriaAnalytics.swift:793-799 | Atria/Atria/Sessions.swift:20885-20891 — 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 `Atria/Atria/AtriaAnalytics.swift:793` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaAnalytics.swift:941 — Atria/Atria/AtriaAnalytics.swift:941-948 | Atria/Atria/AtriaAnalytics.swift:1231-1237 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaAnalytics.swift:941` 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 (7 lines × 2) REDACTED:34416 — REDACTED:34416-34422 | REDACTED:39867-39873 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:34416` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) REDACTED:41426 — REDACTED:41426-41432 | REDACTED:41795-41801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41426` 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 (7 lines × 2) Atria/Atria/AtriaColdSessionStore.swift:348 — Atria/Atria/AtriaColdSessionStore.swift:348-355 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:337-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 `Atria/Atria/AtriaColdSessionStore.swift:348` 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 (7 lines × 2) Atria/Atria/AtriaGraphGrammar.swift:711 — Atria/Atria/AtriaGraphGrammar.swift:711-717 | Atria/Atria/AtriaGraphGrammar.swift:720-726 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaHealthScreen.swift:2484 — Atria/Atria/AtriaHealthScreen.swift:2484-2490 | Atria/Atria/AtriaVitalsCollectionSections.swift:1963-1969 — 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 `Atria/Atria/AtriaHealthScreen.swift:2484` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaHistoricalActivityProjection.swift:603 — Atria/Atria/AtriaHistoricalActivityProjection.swift:603-610 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:984-990 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1235 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1235-1241 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1255-1261 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1235` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `property` to `String = identityObservedAtProperty` in one and `String = identityProperty` 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) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:740 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:740-746 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:755-761 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:451 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:451-457 | Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:465-471 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaHomeView.swift:4100 — Atria/Atria/AtriaHomeView.swift:4100-4106 | Atria/Atria/AtriaHomeView.swift:4139-4145 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaLiveWorkoutView.swift:3736 — Atria/Atria/AtriaLiveWorkoutView.swift:3736-3742 | Atria/Atria/AtriaLiveWorkoutView.swift:4090-4096 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaLiveWorkoutView.swift:3736` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaManualSleepSheet.swift:628 — Atria/Atria/AtriaManualSleepSheet.swift:628-634 | Atria/Atria/AtriaVitalsCollectionSections.swift:2727-2733 — 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 `Atria/Atria/AtriaManualSleepSheet.swift:628` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaManualSleepSheet.swift:679 — Atria/Atria/AtriaManualSleepSheet.swift:679-685 | Atria/Atria/AtriaVitalsCollectionSections.swift:5374-5380 — 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 `Atria/Atria/AtriaManualSleepSheet.swift:679` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaOverviewSections.swift:1817 — Atria/Atria/AtriaOverviewSections.swift:1817-1823 | Atria/Atria/AtriaOverviewSections.swift:2541-2547 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaR10Motion.swift:101 — Atria/Atria/AtriaR10Motion.swift:101-107 | Atria/Atria/AtriaStrapCalibrationArchive.swift:196-202 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaStrapCalibrationArchive.swift:205` calls `crc32` and `Atria/Atria/AtriaR10Motion.swift:108` 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 (7 lines × 2) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:211 — Atria/Atria/AtriaRecoveredHeartRateProjection.swift:211-217 | Atria/Atria/AtriaRecoveredHeartRateProjection.swift:222-228 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaRecoveredHeartRateProjection.swift:211` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaSensorReferenceCapture.swift:171 — Atria/Atria/AtriaSensorReferenceCapture.swift:171-177 | Atria/Atria/AtriaStepCalibrationPlan.swift:88-95 — 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 `Atria/Atria/AtriaSensorReferenceCapture.swift:171` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaShareCard.swift:945 — Atria/Atria/AtriaShareCard.swift:945-951 | Atria/Atria/AtriaShareCard.swift:1573-1579 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:945` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/AtriaStressMonitor.swift:2475 — Atria/Atria/AtriaStressMonitor.swift:2475-2481 | Atria/Atria/AtriaStressMonitor.swift:2507-2513 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaStressMonitor.swift:2475` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7 lines × 2) Atria/Atria/Sessions.swift:7239 — Atria/Atria/Sessions.swift:7239-7245 | Atria/Atria/Sessions.swift:56222-56228 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 2) Atria/Atria/Sessions.swift:22074 — Atria/Atria/Sessions.swift:22074-22080 | Atria/Atria/Sessions.swift:49052-49058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (7 lines × 2) Atria/Atria/Sessions.swift:22800 — Atria/Atria/Sessions.swift:22800-22806 | Atria/Atria/Sessions.swift:23069-23075 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:22800` 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.
  • + 21 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×43
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaActiveSessionRestorePreparer.swift:298 — Atria/Atria/AtriaActiveSessionRestorePreparer.swift:298-306 | Atria/Atria/Sessions.swift:30038-30046 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) REDACTED:7810 — REDACTED:7810-7818 | REDACTED:7926-7934 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (9 lines × 2) REDACTED:28304 — REDACTED:28304-28312 | REDACTED:39737-39745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaColdSessionFacts.swift:152 — Atria/Atria/AtriaColdSessionFacts.swift:152-160 | Atria/Atria/AtriaLiveWorkoutView.swift:604-612 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:349 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:349-357 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:447-455 — 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 `Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:349` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:535 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:535-543 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:570-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 `Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:535` 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 (9 lines × 2) Atria/Atria/AtriaHistoricalGapLedger.swift:651 — Atria/Atria/AtriaHistoricalGapLedger.swift:651-659 | Atria/Atria/AtriaHistoricalGapLedger.swift:675-683 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalGapLedger.swift:651` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:84 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:84-92 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:60-68 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:84` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:613 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:613-621 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:1045-1053 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:613` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHomeView.swift:3347 — Atria/Atria/AtriaHomeView.swift:3347-3355 | Atria/Atria/AtriaHomeView.swift:3403-3411 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaHomeView.swift:7820 — Atria/Atria/AtriaHomeView.swift:7820-7828 | Atria/Atria/AtriaHomeView.swift:7844-7856 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHomeView.swift:7820` 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) Atria/Atria/AtriaHomeView.swift:14369 — Atria/Atria/AtriaHomeView.swift:14369-14382 | Atria/Atria/AtriaHomeView.swift:14384-14392 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHomeView.swift:14384` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaLiveWorkoutView.swift:2715 — Atria/Atria/AtriaLiveWorkoutView.swift:2715-2723 | Atria/Atria/AtriaLiveWorkoutView.swift:2860-2868 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaLiveWorkoutView.swift:2715` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaLiveWorkoutView.swift:3724 — Atria/Atria/AtriaLiveWorkoutView.swift:3724-3732 | Atria/Atria/AtriaLiveWorkoutView.swift:4079-4087 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaLiveWorkoutView.swift:3724` 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, `Atria/Atria/AtriaLiveWorkoutView.swift:3733` calls `minimumScaleFactor` and `Atria/Atria/AtriaLiveWorkoutView.swift:4088` 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 (9 lines × 2) Atria/Atria/AtriaOverviewSections.swift:9219 — Atria/Atria/AtriaOverviewSections.swift:9219-9227 | Atria/Atria/AtriaOverviewSections.swift:9228-9236 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaOverviewSections.swift:10869 — Atria/Atria/AtriaOverviewSections.swift:10869-10877 | Atria/Atria/AtriaTrendChart.swift:1501-1509 — 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 `Atria/Atria/AtriaOverviewSections.swift:10869` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaRecoveredMotionProjection.swift:167 — Atria/Atria/AtriaRecoveredMotionProjection.swift:167-175 | Atria/Atria/AtriaRecoveredMotionProjection.swift:237-245 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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) Atria/Atria/AtriaSleepWakeResearch.swift:283 — Atria/Atria/AtriaSleepWakeResearch.swift:283-291 | Atria/Atria/AtriaSleepWakeResearch.swift:309-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaSleepWakeResearch.swift:283` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaSleepWakeResearch.swift:1102 — Atria/Atria/AtriaSleepWakeResearch.swift:1102-1110 | Atria/Atria/AtriaSleepWakeResearch.swift:1177-1185 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaSleepWakeResearch.swift:1102` 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 (9 lines × 2) Atria/Atria/AtriaStressDetailView.swift:1629 — Atria/Atria/AtriaStressDetailView.swift:1629-1637 | Atria/Atria/AtriaVitalsCollectionSections.swift:3387-3395 — 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 `Atria/Atria/AtriaStressDetailView.swift:1629` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaStressDetailView.swift:1638` calls `Text` and `Atria/Atria/AtriaVitalsCollectionSections.swift:3396` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaTodayScreen.swift:4704 — Atria/Atria/AtriaTodayScreen.swift:4704-4712 | Atria/Atria/AtriaVitalsCollectionSections.swift:2510-2518 — 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 `Atria/Atria/AtriaTodayScreen.swift:4704` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `10` in one and `8` 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, `Atria/Atria/AtriaTodayScreen.swift:4713` calls `HStack` and `Atria/Atria/AtriaVitalsCollectionSections.swift:2519` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (9 lines × 2) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1360 — Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1360-1368 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1379-1387 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (9 lines × 2) Atria/Atria/DailyRollupStore.swift:826 — Atria/Atria/DailyRollupStore.swift:826-834 | Atria/Atria/Sessions.swift:3338-3346 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/Sessions.swift:3336` calls `decode` and `Atria/Atria/DailyRollupStore.swift:824` 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 (9 lines × 2) Atria/Atria/HistoricalArchive.swift:8320 — Atria/Atria/HistoricalArchive.swift:8320-8328 | Atria/Atria/HistoricalArchive.swift:8439-8447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (9 lines × 2) Atria/Atria/LocalNotificationScheduler.swift:993 — Atria/Atria/LocalNotificationScheduler.swift:993-1001 | Atria/Atria/LocalNotificationScheduler.swift:1848-1856 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/LocalNotificationScheduler.swift:993` 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.
  • + 18 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×40
  • Duplicated block (5 lines × 2) REDACTED:24794 — REDACTED:24794-24798 | REDACTED:24843-24847 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:24794` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaDeviceUseJournal.swift:190 — Atria/Atria/AtriaDeviceUseJournal.swift:190-194 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:954-960 — 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 `Atria/Atria/AtriaDeviceUseJournal.swift:190` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaHealthScreen.swift:2754 — Atria/Atria/AtriaHealthScreen.swift:2754-2761 | Atria/Atria/AtriaHealthScreen.swift:2804-2808 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHealthScreen.swift:2754` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaHealthScreen.swift:2818 — Atria/Atria/AtriaHealthScreen.swift:2818-2822 | Atria/Atria/AtriaStrapScreen.swift:467-471 — 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) Atria/Atria/AtriaHeroConnectionSections.swift:973 — Atria/Atria/AtriaHeroConnectionSections.swift:973-977 | Atria/Atria/AtriaHeroConnectionSections.swift:980-984 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaStrapCalibrationArchive.swift:186 — Atria/Atria/AtriaStrapCalibrationArchive.swift:186-190 | Atria/Atria/AtriaStrapCalibrationArchive.swift:205-209 — both copies are in the same file, so extract the 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) Atria/Atria/HRV.swift:365 — Atria/Atria/HRV.swift:365-370 | Atria/Atria/Sessions.swift:2024-2028 — 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 `Atria/Atria/HRV.swift:365` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Atria/Atria/Sessions.swift:7812 — Atria/Atria/Sessions.swift:7812-7816 | Atria/Atria/Sessions.swift:7910-7916 — both copies are in the same file, so extract the 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) Atria/Atria/Sessions.swift:7883 — Atria/Atria/Sessions.swift:7883-7887 | Atria/Atria/Sessions.swift:7981-7991 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:7883` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (5 lines × 2) Atria/Atria/Sessions.swift:21356 — Atria/Atria/Sessions.swift:21356-21360 | Atria/Atria/Sessions.swift:21397-21402 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:21356` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) Atria/Atria/Sessions.swift:23373 — Atria/Atria/Sessions.swift:23373-23377 | Atria/Atria/Sessions.swift:23791-23795 — both copies are in the same file, so extract the 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) Atria/Atria/Sessions.swift:33962 — Atria/Atria/Sessions.swift:33962-33968 | Atria/Atria/Sessions.swift:35055-35059 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:33962` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 2) Atria/Atria/Sessions.swift:54707 — Atria/Atria/Sessions.swift:54707-54711 | Atria/Atria/Sessions.swift:54736-54740 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:54707` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Atria/Atria/Sessions.swift:55280 — Atria/Atria/Sessions.swift:55280-55284 | Atria/Atria/Sessions.swift:55285-55289 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaHistoricalActivityProjection.swift:350 — Atria/Atria/AtriaHistoricalActivityProjection.swift:350-354 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:30-34 — 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) Atria/Atria/AtriaMonthlyReport.swift:194 — Atria/Atria/AtriaMonthlyReport.swift:194-198 | Atria/Atria/AtriaWeeklyReport.swift:167-171 — 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) Atria/Atria/AtriaOverviewSections.swift:9570 — Atria/Atria/AtriaOverviewSections.swift:9570-9574 | Atria/Atria/AtriaSmartWakeView.swift:130-134 — 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) Atria/Atria/AtriaRoutineCard.swift:240 — Atria/Atria/AtriaRoutineCard.swift:240-244 | Atria/Atria/AtriaWeeklyPlan.swift:145-149 — 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) Atria/Atria/AtriaWhoop4HistoryACKGate.swift:123 — Atria/Atria/AtriaWhoop4HistoryACKGate.swift:123-127 | Atria/Atria/AtriaWhoop4HistoryReadPreflightGate.swift:95-99 — 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) Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:102 — Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:102-106 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:611-615 — before extracting anything, compare `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift` and `Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:675 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:675-681 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:279-283 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:683 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:683-689 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:285-289 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:25 — Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:25-29 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:74-84 — before extracting anything, compare `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift` and `Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 2) REDACTED:24986 — REDACTED:24986-24990 | REDACTED:25052-25056 — both copies are in the same file, so extract the 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) REDACTED:52804 — REDACTED:52804-52808 | Atria/Atria/Sessions.swift:56751-56755 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×39
  • Duplicated block (8 lines × 2) REDACTED:25321 — REDACTED:25321-25328 | REDACTED:25740-25747 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaBehaviorImpact.swift:97 — Atria/Atria/AtriaBehaviorImpact.swift:97-104 | Atria/Atria/Sessions.swift:47475-47482 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaGraphGrammar.swift:770 — Atria/Atria/AtriaGraphGrammar.swift:770-777 | Atria/Atria/AtriaOverviewSections.swift:9072-9079 — 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 `Atria/Atria/AtriaGraphGrammar.swift:770` 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 (8 lines × 2) Atria/Atria/AtriaHealthScreen.swift:2373 — Atria/Atria/AtriaHealthScreen.swift:2373-2380 | Atria/Atria/AtriaTodayScreen.swift:676-683 — 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 `Atria/Atria/AtriaHealthScreen.swift:2373` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaHeroConnectionSections.swift:1089 — Atria/Atria/AtriaHeroConnectionSections.swift:1089-1096 | Atria/Atria/AtriaManualSleepSheet.swift:677-684 — 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 `Atria/Atria/AtriaHeroConnectionSections.swift:1089` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `alignment` to `.center` in one and `.top` 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, `Atria/Atria/AtriaHeroConnectionSections.swift:1098` calls `lineLimit`, `minimumScaleFactor` and `Atria/Atria/AtriaManualSleepSheet.swift:686` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:219 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:219-226 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:282-289 — 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 (8 lines × 2) Atria/Atria/AtriaHistoricalGapLedger.swift:642 — Atria/Atria/AtriaHistoricalGapLedger.swift:642-649 | Atria/Atria/AtriaHistoricalGapLedger.swift:666-673 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalGapLedger.swift:642` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaIMUDiagnosticTransport.swift:1282 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:1282-1289 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:1632-1639 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaIMUDiagnosticTransport.swift:1282` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:4573 — Atria/Atria/AtriaOverviewSections.swift:4573-4586 | Atria/Atria/AtriaOverviewSections.swift:4591-4598 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:4573` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:4897 — Atria/Atria/AtriaOverviewSections.swift:4897-4904 | Atria/Atria/AtriaOverviewSections.swift:4933-4940 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:4897` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:10233 — Atria/Atria/AtriaOverviewSections.swift:10233-10240 | Atria/Atria/AtriaOverviewSections.swift:10864-10871 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:10233` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:10251 — Atria/Atria/AtriaOverviewSections.swift:10251-10258 | Atria/Atria/AtriaTrendChart.swift:1496-1503 — 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 `Atria/Atria/AtriaOverviewSections.swift:10251` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaRecoveredDataRecomputeCoordinator.swift:272 — Atria/Atria/AtriaRecoveredDataRecomputeCoordinator.swift:272-279 | Atria/Atria/AtriaRecoveredDataRecomputeCoordinator.swift:376-383 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaRoutineCard.swift:257 — Atria/Atria/AtriaRoutineCard.swift:257-264 | Atria/Atria/AtriaWeeklyPlan.swift:292-299 — 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 (8 lines × 2) Atria/Atria/AtriaSettingsView.swift:1468 — Atria/Atria/AtriaSettingsView.swift:1468-1475 | Atria/Atria/AtriaSettingsView.swift:1477-1484 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Atria/Atria/AtriaSleepPlanner.swift:111 — Atria/Atria/AtriaSleepPlanner.swift:111-118 | Atria/Atria/AtriaStrainPacing.swift:57-64 — 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 `Atria/Atria/AtriaSleepPlanner.swift:111` 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 (8 lines × 2) Atria/Atria/HealthKitExporter.swift:2046 — Atria/Atria/HealthKitExporter.swift:2046-2053 | Atria/Atria/Sessions.swift:54931-54938 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) Atria/Atria/Sessions.swift:4098 — Atria/Atria/Sessions.swift:4098-4105 | Atria/Atria/Sessions.swift:4136-4143 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:4098` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 2) Atria/Atria/Sessions.swift:7869 — Atria/Atria/Sessions.swift:7869-7876 | Atria/Atria/Sessions.swift:7883-7890 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (8 lines × 2) Atria/Atria/Sessions.swift:31375 — Atria/Atria/Sessions.swift:31375-31382 | Atria/Atria/Sessions.swift:31597-31604 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:31605` calls `currentCollectionStatus` and `Atria/Atria/Sessions.swift:31383` 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 (8 lines × 2) Atria/Atria/Sessions.swift:51475 — Atria/Atria/Sessions.swift:51475-51482 | Atria/Atria/Sessions.swift:51522-51529 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:51475` 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 (8 lines × 2) Atria/Atria/Sessions.swift:54224 — Atria/Atria/Sessions.swift:54224-54231 | Atria/Atria/Sessions.swift:54660-54667 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:54224` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Atria/Atria/Sessions.swift:59867 — Atria/Atria/Sessions.swift:59867-59874 | Atria/Atria/Sessions.swift:59937-59944 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) Atria/AtriaWidget/AtriaWidget.swift:2274 — Atria/AtriaWidget/AtriaWidget.swift:2274-2281 | Atria/AtriaWidget/AtriaWidget.swift:3225-3232 — both copies are in the same file, so extract the 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 `Atria/AtriaWidget/AtriaWidget.swift:2274` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) REDACTED:50864 — REDACTED:50864-50871 | Atria/Atria/Sessions.swift:62389-62396 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `targetCount` to `Int = 18` in one and `Int = 320` 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.
  • + 14 more in this group — see findings.md.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×39
  • Swallowed exception (caught, then discarded) symbolicate_atria_reports.py:12 — `except Exception` takes every exception and records none of it — the body neither logs it, rethrows it, nor even names it, so the failure is discarded as completely as by an empty catch and only the substituted value survives. Log it through whatever this codebase already uses to report problems, narrow the catch to the exception this call can actually raise, or say in a comment on the catch why the failure genuinely cannot matter.
  • Swallowed exception (caught, then discarded) REDACTED:19060 — `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) REDACTED:30799 — `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) REDACTED:42975 — `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) REDACTED:43458 — `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) REDACTED:43566 — `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) REDACTED:45320 — `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) REDACTED:45358 — `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) REDACTED:45375 — `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) Atria/Atria/AtriaBreathworkSession.swift:555 — `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) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:697 — `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) Atria/Atria/AtriaGeneratedArtifactRetention.swift:133 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:219 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:409 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:415 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:507 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:597 — `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) Atria/Atria/AtriaHistoricalAggregateReader.swift:656 — `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) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:771 — `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) Atria/Atria/AtriaHistoricalGapLedger.swift:1261 — `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) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:164 — `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) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:315 — `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) Atria/Atria/AtriaHomeView.swift:2850 — `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) Atria/Atria/AtriaHomeView.swift:6405 — `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) Atria/Atria/AtriaIMUDiagnosticTransport.swift:1825 — `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.
  • + 14 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (4 corresponding lines) · ×34
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:184 — Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:184-187 | tools/verify_whoop4_autonomous_step_corpus.swift:492-499 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaAnonymousDailyUploadSchedule.swift:39 — Atria/Atria/AtriaAnonymousDailyUploadSchedule.swift:39-42 | Atria/Atria/Sessions.swift:24375-24379 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1586 — Atria/Atria/AtriaOverviewSections.swift:1586-1589 | Atria/Atria/AtriaTodayScreen.swift:4679-4682 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaAppIntents.swift:379 — Atria/Atria/AtriaAppIntents.swift:379-383 | Atria/AtriaWidget/AtriaControlIntents.swift:27-30 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaWeeklyPlan.swift:278 — Atria/Atria/AtriaWeeklyPlan.swift:278-281 | Atria/Atria/Sessions.swift:61298-61301 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaDeviceUseJournal.swift:152 — Atria/Atria/AtriaDeviceUseJournal.swift:152-155 | Atria/Atria/AtriaMotionBankDutyCycleDiag.swift:72-76 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaAssistantScreen.swift:222 — Atria/Atria/AtriaAssistantScreen.swift:222-225 | Atria/Atria/AtriaStrapScreen.swift:112-115 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaTrendChart.swift:1191 — Atria/Atria/AtriaTrendChart.swift:1191-1194 | Atria/Atria/Sessions.swift:56332-56335 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaCivilDayStepAuthority.swift:156 — Atria/Atria/AtriaCivilDayStepAuthority.swift:156-160 | Atria/Atria/AtriaTrendChart.swift:1816-1819 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaAppIntents.swift:219 — Atria/Atria/AtriaAppIntents.swift:219-222 | Atria/AtriaWidget/AtriaControlIntents.swift:49-52 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaAICoach.swift:46 — Atria/Atria/AtriaAICoach.swift:46-49 | Atria/Atria/AtriaHapticAlerts.swift:54-57 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaCycleTracking.swift:213 — Atria/Atria/AtriaCycleTracking.swift:213-216 | Atria/Atria/AtriaJournalStore.swift:204-207 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaMainThreadWatchdog.swift:155 — Atria/Atria/AtriaMainThreadWatchdog.swift:155-159 | Atria/Atria/AtriaStressMonitor.swift:566-569 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaResearchBundle.swift:583 — Atria/Atria/AtriaResearchBundle.swift:583-586 | Atria/Atria/AtriaWorkoutRoute.swift:84-91 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3625 — Atria/Atria/AtriaOverviewSections.swift:3625-3628 | Atria/Atria/AtriaSettingsView.swift:2099-2102 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3565 — Atria/Atria/AtriaOverviewSections.swift:3565-3568 | Atria/Atria/AtriaSettingsView.swift:2035-2038 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3570 — Atria/Atria/AtriaOverviewSections.swift:3570-3573 | Atria/Atria/AtriaSettingsView.swift:2048-2051 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3596 — Atria/Atria/AtriaOverviewSections.swift:3596-3599 | Atria/Atria/AtriaSettingsView.swift:2070-2073 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3601 — Atria/Atria/AtriaOverviewSections.swift:3601-3604 | Atria/Atria/AtriaSettingsView.swift:2075-2078 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3606 — Atria/Atria/AtriaOverviewSections.swift:3606-3609 | Atria/Atria/AtriaSettingsView.swift:2080-2083 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3611 — Atria/Atria/AtriaOverviewSections.swift:3611-3614 | Atria/Atria/AtriaSettingsView.swift:2085-2088 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3616 — Atria/Atria/AtriaOverviewSections.swift:3616-3619 | Atria/Atria/AtriaSettingsView.swift:2090-2093 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3630 — Atria/Atria/AtriaOverviewSections.swift:3630-3633 | Atria/Atria/AtriaSettingsView.swift:2104-2107 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaMetricConfidencePresentation.swift:164 — Atria/Atria/AtriaMetricConfidencePresentation.swift:164-167 | Atria/Atria/Metrics.swift:324-327 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (4 corresponding lines) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:278 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:278-281 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:358-361 — These two members are one piece of code written twice and then edited apart: 4 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 9 more in this group — see findings.md.
D10 · Test Quality · No assertions · ×32
  • No assertions: testHealthKitExportIsANoOpWhileDemoIsActive Atria/AtriaTests/AtriaAppReviewDemoTests.swift:153 — 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: testReviewSliceCancellationStopsMidTraversal Atria/AtriaTests/AtriaCompactLatestNightSettlementTests.swift:349 — 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: testJuly15CapturedNightCannotRecoverFromLegacyRRAndUnvalidatedMotion Atria/AtriaTests/AtriaExistingRecordReplayTests.swift:430 — 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: testJuly16CapturedNightDoesNotPromoteSparseQualifiedRRWithoutSleepEvidence Atria/AtriaTests/AtriaExistingRecordReplayTests.swift:455 — 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: testJuly17CapturedNightKeepsQualifiedHRVSeparateFromRejectedSleep Atria/AtriaTests/AtriaExistingRecordReplayTests.swift:467 — 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: testJuly18CapturedNightKeepsQualifiedHRVSeparateFromFragmentedWear Atria/AtriaTests/AtriaExistingRecordReplayTests.swift:480 — 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: testTwoKilobyteFrameIsCheap Atria/AtriaTests/AtriaFrameCRCTests.swift:48 — 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: testArtifactByteLimitFailsClosedBeforeDecode Atria/AtriaTests/AtriaHistoricalVerifiedConsumerReaderTests.swift:142 — 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: testAggregateByteLimitFailsClosedBeforeAggregateDecode Atria/AtriaTests/AtriaHistoricalVerifiedConsumerReaderTests.swift:160 — 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: testTotalAggregateByteLimitFailsClosedBeforeAggregateDecode Atria/AtriaTests/AtriaHistoricalVerifiedConsumerReaderTests.swift:178 — 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: testRecoveryCardRendersWithTimestampAndStatus Atria/AtriaTests/AtriaMetricProvenanceCardRenderTests.swift:81 — 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: testUngradedCardRendersNeutral Atria/AtriaTests/AtriaMetricProvenanceCardRenderTests.swift:105 — 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: testPartialStrainCardRendersInDarkMode Atria/AtriaTests/AtriaMetricProvenanceCardRenderTests.swift:122 — 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: testProbeMisalignedLedgerVetoesOverlappingRowRun Atria/AtriaTests/AtriaMotionRowDerivedCoverageTests.swift:277 — 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: testProbePartialOffloadTailVetoesRowRun Atria/AtriaTests/AtriaMotionRowDerivedCoverageTests.swift:299 — 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: testGaitQualityChallengerHundredHertzCost Atria/AtriaTests/AtriaR10MotionTests.swift:1196 — 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: testRoundTripParityFullyPopulated Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:132 — 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: testRoundTripParityAllOptionalsAbsent Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:136 — 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: testHandWrittenLineWithNullsAndUnknownKeys Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:140 — 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: testBothRejectMissingRequiredKey Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:158 — 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: testBothRejectMalformedLine Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:170 — 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: testNegativeZeroRoundTripsWithFullParity Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:187 — 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: testParityAcrossRepresentativeVariations Atria/AtriaTests/AtriaRecordScanParserParityTests.swift:219 — 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: testEightHourDenseReviewPublishesParityStagesWithinSharedDeadline Atria/AtriaTests/AtriaSleepReviewCacheTests.swift:1519 — 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: testTwelveHourDenseReviewPublishesParityStagesWithinSharedDeadline Atria/AtriaTests/AtriaSleepReviewCacheTests.swift:1525 — 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.
  • + 7 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (10 lines × 2) · ×30
  • Duplicated block (10 lines × 2) REDACTED:5052 — REDACTED:5052-5061 | REDACTED:5099-5108 — both copies are in the same file, so extract the 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, `REDACTED:5062` calls `set` and `REDACTED:5109` 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) REDACTED:10086 — REDACTED:10086-10095 | REDACTED:10119-10128 — both copies are in the same file, so extract the 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) REDACTED:15809 — REDACTED:15809-15818 | REDACTED:34834-34843 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:15809` 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 (10 lines × 2) REDACTED:55343 — REDACTED:55343-55352 | REDACTED:56118-56127 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaCivilDayStepAuthority.swift:210 — Atria/Atria/AtriaCivilDayStepAuthority.swift:210-219 | Atria/Atria/AtriaCivilDayStepAuthority.swift:266-275 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaCivilDayStepAuthority.swift:210` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Atria/Atria/AtriaHealthspanDetailView.swift:514 — Atria/Atria/AtriaHealthspanDetailView.swift:514-523 | Atria/Atria/AtriaHealthspanDetailView.swift:532-541 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHealthspanDetailView.swift:514` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1693 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1693-1702 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1719-1728 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaHomeView.swift:3272 — Atria/Atria/AtriaHomeView.swift:3272-3281 | Atria/Atria/AtriaLiveWorkoutView.swift:3175-3184 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10 lines × 2) Atria/Atria/AtriaJournalTab.swift:203 — Atria/Atria/AtriaJournalTab.swift:203-212 | Atria/Atria/AtriaOverviewSections.swift:10570-10579 — 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 `Atria/Atria/AtriaJournalTab.swift:203` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Atria/Atria/AtriaOnboardingPersonalization.swift:54 — Atria/Atria/AtriaOnboardingPersonalization.swift:54-63 | Atria/Atria/AtriaTodayScreen.swift:1414-1423 — 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 `Atria/Atria/AtriaOnboardingPersonalization.swift:54` 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 (10 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3059 — Atria/Atria/AtriaOverviewSections.swift:3059-3068 | Atria/Atria/AtriaTodayScreen.swift:2875-2884 — 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 `Atria/Atria/AtriaOverviewSections.swift:3059` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Atria/Atria/AtriaOverviewSections.swift:9255 — Atria/Atria/AtriaOverviewSections.swift:9255-9264 | Atria/Atria/AtriaOverviewSections.swift:9265-9274 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaSleepHypnogram.swift:1148 — Atria/Atria/AtriaSleepHypnogram.swift:1148-1157 | Atria/Atria/AtriaSleepHypnogram.swift:1167-1176 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaSleepHypnogram.swift:1148` 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 (10 lines × 2) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:741 — Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:741-750 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1280-1289 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:741` 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 (10 lines × 2) Atria/Atria/DailyRollupStore.swift:1030 — Atria/Atria/DailyRollupStore.swift:1030-1039 | Atria/Atria/DailyRollupStore.swift:1061-1070 — both copies are in the same file, so extract the 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) Atria/Atria/HealthKitExporter.swift:286 — Atria/Atria/HealthKitExporter.swift:286-295 | Atria/Atria/HealthKitExporter.swift:309-318 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/HealthKitExporter.swift:286` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/HealthKitExporter.swift:285` calls `predicateForSamples` and `Atria/Atria/HealthKitExporter.swift:308` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) Atria/Atria/HistoricalArchive.swift:1518 — Atria/Atria/HistoricalArchive.swift:1518-1527 | Atria/Atria/HistoricalArchive.swift:1580-1589 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:1518` 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 (10 lines × 2) Atria/Atria/HistoricalArchive.swift:7374 — Atria/Atria/HistoricalArchive.swift:7374-7383 | Atria/Atria/HistoricalArchive.swift:7391-7400 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:7374` 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) Atria/Atria/Sessions.swift:25758 — Atria/Atria/Sessions.swift:25758-25767 | Atria/Atria/Sessions.swift:25784-25793 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:25758` 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 (10 lines × 2) Atria/Atria/Sessions.swift:34496 — Atria/Atria/Sessions.swift:34496-34505 | Atria/Atria/Sessions.swift:36131-36140 — both copies are in the same file, so extract the 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) Atria/Atria/Sessions.swift:37863 — Atria/Atria/Sessions.swift:37863-37872 | Atria/Atria/Sessions.swift:43266-43275 — both copies are in the same file, so extract the 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) Atria/Atria/Sessions.swift:41103 — Atria/Atria/Sessions.swift:41103-41112 | Atria/Atria/Sessions.swift:41158-41167 — both copies are in the same file, so extract the 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) Atria/AtriaWidget/AtriaWidget.swift:2055 — Atria/AtriaWidget/AtriaWidget.swift:2055-2064 | Atria/AtriaWidget/AtriaWidget.swift:2070-2079 — both copies are in the same file, so extract the 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 `Atria/AtriaWidget/AtriaWidget.swift:2055` 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 (10 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:2843 — Atria/Atria/AtriaActivityMonitor.swift:2843-2852 | Atria/Atria/AtriaStressDetailView.swift:1732-1741 — 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 `Atria/Atria/AtriaActivityMonitor.swift:2843` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Atria/Atria/HealthKitExporter.swift:1503 — Atria/Atria/HealthKitExporter.swift:1503-1512 | Atria/Atria/HealthKitExporter.swift:1539-1548 — both copies are in the same file, so extract the 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 `Atria/Atria/HealthKitExporter.swift:1503` 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.
  • + 5 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (9 corresponding lines) · ×26
  • Edited copy of a member (9 corresponding lines) Atria/Atria/Sessions.swift:54682 — Atria/Atria/Sessions.swift:54682-54690 | Atria/Atria/Sessions.swift:54947-54955 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) REDACTED:50863 — REDACTED:50863-50871 | Atria/Atria/Sessions.swift:62388-62396 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaRecoveryDrivers.swift:104 — Atria/Atria/AtriaRecoveryDrivers.swift:104-112 | Atria/Atria/AtriaTrendShift.swift:95-106 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaColdSessionStore.swift:331 — Atria/Atria/AtriaColdSessionStore.swift:331-341 | Atria/Atria/AtriaWhoop4HistoricalOrphanVault.swift:252-260 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/Sessions.swift:4097 — Atria/Atria/Sessions.swift:4097-4105 | Atria/Atria/Sessions.swift:4135-4143 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) REDACTED:3336 — REDACTED:3336-3345 | REDACTED:3347-3355 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaRecoveredRRProjection.swift:609 — Atria/Atria/AtriaRecoveredRRProjection.swift:609-618 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3021-3029 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/Sessions.swift:30135 — Atria/Atria/Sessions.swift:30135-30143 | Atria/Atria/Sessions.swift:30145-30153 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaHealthspanDetailView.swift:567 — Atria/Atria/AtriaHealthspanDetailView.swift:567-575 | Atria/Atria/AtriaVitalsCollectionSections.swift:779-789 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaShareCard.swift:960 — Atria/Atria/AtriaShareCard.swift:960-968 | Atria/Atria/AtriaShareCard.swift:1321-1329 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:5452 — Atria/Atria/AtriaOverviewSections.swift:5452-5460 | Atria/Atria/AtriaOverviewSections.swift:5462-5470 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:400 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:400-408 | Atria/Atria/AtriaHistoricalArchiveCatalog.swift:693-704 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaStrengthLog.swift:384 — Atria/Atria/AtriaStrengthLog.swift:384-394 | Atria/Atria/AtriaStrengthLog.swift:396-404 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:170 — Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:170-178 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:738-750 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaCycleTracking.swift:137 — Atria/Atria/AtriaCycleTracking.swift:137-146 | Atria/Atria/AtriaJournalStore.swift:126-134 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaNotificationCategories.swift:282 — Atria/Atria/AtriaNotificationCategories.swift:282-291 | Atria/Atria/AtriaHistoricalShadowCompactionCoordinator.swift:174-182 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/AtriaWidget/AtriaWidget.swift:176 — Atria/AtriaWidget/AtriaWidget.swift:176-184 | Atria/AtriaWidget/AtriaWidget.swift:186-194 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaWorkoutReviewSheet.swift:327 — Atria/Atria/AtriaWorkoutReviewSheet.swift:327-335 | tools/StrapProtocol/Sources/StrapProtocol/StrapProtocolApp.swift:133-142 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:282 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:282-292 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:211-219 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:3699 — Atria/Atria/AtriaOverviewSections.swift:3699-3707 | Atria/Atria/AtriaVitalsCollectionSections.swift:5296-5304 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaLiveWorkoutView.swift:4336 — Atria/Atria/AtriaLiveWorkoutView.swift:4336-4344 | Atria/Atria/AtriaLiveWorkoutView.swift:4351-4359 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaTriRing.swift:196 — Atria/Atria/AtriaTriRing.swift:196-204 | Atria/AtriaWidget/AtriaWidget.swift:3527-3536 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) REDACTED:6390 — REDACTED:6390-6401 | Atria/Atria/Sessions.swift:11569-11577 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) Atria/Atria/AtriaStrengthProgress.swift:39 — Atria/Atria/AtriaStrengthProgress.swift:39-47 | Atria/Atria/AtriaTrendChart.swift:1724-1734 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (9 corresponding lines) tools/strap-mac/session.py:78 — tools/strap-mac/session.py:78-86 | tools/strap-mac/session.py:90-98 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Edited copy of a member (7 corresponding lines) · ×26
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1306 — Atria/Atria/AtriaOverviewSections.swift:1306-1312 | Atria/Atria/AtriaVitalsCollectionSections.swift:285-291 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaAppReviewDemo.swift:33 — Atria/Atria/AtriaAppReviewDemo.swift:33-39 | Atria/Atria/AtriaAppReviewDemo.swift:41-48 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:193 — Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:193-199 | tools/verify_whoop4_autonomous_step_corpus.swift:501-510 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) REDACTED:30802 — REDACTED:30802-30808 | Atria/Atria/Sessions.swift:54997-55003 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/Sessions.swift:5162 — Atria/Atria/Sessions.swift:5162-5168 | Atria/Atria/Sessions.swift:5374-5380 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/Sessions.swift:22732 — Atria/Atria/Sessions.swift:22732-22738 | Atria/Atria/Sessions.swift:56230-56236 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/ActiveSessionJournal.swift:1027 — Atria/Atria/ActiveSessionJournal.swift:1027-1033 | REDACTED:52581-52587 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaAnalytics.swift:2300 — Atria/Atria/AtriaAnalytics.swift:2300-2310 | Atria/Atria/AtriaSleepWakeResearch.swift:1334-1340 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/Sessions.swift:61445 — Atria/Atria/Sessions.swift:61445-61451 | Atria/Atria/Sessions.swift:61453-61460 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaPhysiologicalStressModel.swift:666 — Atria/Atria/AtriaPhysiologicalStressModel.swift:666-672 | Atria/Atria/AtriaStressMonitor.swift:3327-3333 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaManualSleepSheet.swift:140 — Atria/Atria/AtriaManualSleepSheet.swift:140-147 | Atria/Atria/AtriaSharedUIComponents.swift:798-804 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/Sessions.swift:47547 — Atria/Atria/Sessions.swift:47547-47553 | Atria/Atria/Sessions.swift:47576-47582 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/Sessions.swift:47555 — Atria/Atria/Sessions.swift:47555-47562 | Atria/Atria/Sessions.swift:47584-47590 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaCivilDayStepAuthority.swift:373 — Atria/Atria/AtriaCivilDayStepAuthority.swift:373-381 | Atria/Atria/DailyRollupStore.swift:1155-1161 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:2817 — Atria/Atria/AtriaHealthScreen.swift:2817-2823 | Atria/Atria/AtriaStrapScreen.swift:343-349 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaWorkoutSegmentAttribution.swift:172 — Atria/Atria/AtriaWorkoutSegmentAttribution.swift:172-178 | Atria/Atria/Sessions.swift:61766-61772 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaRawExport.swift:128 — Atria/Atria/AtriaRawExport.swift:128-134 | Atria/Atria/AtriaRawExport.swift:136-142 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaHomeView.swift:12453 — Atria/Atria/AtriaHomeView.swift:12453-12459 | Atria/Atria/Sessions.swift:27601-27607 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tools/monitor_long_wear.py:43 — tools/monitor_long_wear.py:43-49 | validate_hrv.py:38-44 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:2301 — Atria/Atria/AtriaHealthScreen.swift:2301-2307 | Atria/Atria/AtriaTodayScreen.swift:3578-3584 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaCustomizeSheet.swift:570 — Atria/Atria/AtriaCustomizeSheet.swift:570-576 | Atria/Atria/AtriaLearnedInsights.swift:53-60 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2509 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2509-2519 | Atria/Atria/Sessions.swift:16207-16213 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tools/strap-mac/night_capture.py:77 — tools/strap-mac/night_capture.py:77-83 | tools/strap-mac/r10_capture.py:95-103 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tools/build_physical_window_manifests.py:117 — tools/build_physical_window_manifests.py:117-126 | tools/validate_research_corpus.py:48-54 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (7 corresponding lines) tools/strap-mac/score_walks.py:32 — tools/strap-mac/score_walks.py:32-38 | tools/strap-mac/score_walks.py:56-62 — These two members are one piece of code written twice and then edited apart: 7 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×26
  • Duplicated block (11 lines × 2) REDACTED:25653 — REDACTED:25653-25663 | REDACTED:26538-26548 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:25653` 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) REDACTED:55356 — REDACTED:55356-55366 | REDACTED:55610-55620 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:55356` 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 (11 lines × 2) REDACTED:56375 — REDACTED:56375-56385 | REDACTED:56688-56698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:180 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:180-190 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:130-141 — before extracting anything, compare `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift` and `Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:180` 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) Atria/Atria/AtriaHistoricalActivityProjection.swift:438 — Atria/Atria/AtriaHistoricalActivityProjection.swift:438-448 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:76-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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:438` 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) Atria/Atria/AtriaHistoricalActivityProjection.swift:493 — Atria/Atria/AtriaHistoricalActivityProjection.swift:493-503 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:178-188 — 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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:493` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:183 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:183-193 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:246-256 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:738 — Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:738-748 | Atria/Atria/AtriaHistoricalLongTermRollup.swift:1001-1011 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) Atria/Atria/AtriaHistoricalGapLedger.swift:549 — Atria/Atria/AtriaHistoricalGapLedger.swift:549-559 | Atria/Atria/AtriaHistoricalGapLedger.swift:600-610 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalGapLedger.swift:549` 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 (11 lines × 2) Atria/Atria/AtriaSleepPlannerCharts.swift:271 — Atria/Atria/AtriaSleepPlannerCharts.swift:271-281 | Atria/Atria/AtriaSmartWakeView.swift:205-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 `Atria/Atria/AtriaSleepPlannerCharts.swift:271` 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 (11 lines × 2) Atria/Atria/AtriaSleepWakeResearch.swift:401 — Atria/Atria/AtriaSleepWakeResearch.swift:401-411 | Atria/Atria/AtriaSleepWakeResearch.swift:441-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. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaSleepWakeResearch.swift:401` 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) Atria/Atria/AtriaSleepWakeResearch.swift:1078 — Atria/Atria/AtriaSleepWakeResearch.swift:1078-1088 | Atria/Atria/AtriaSleepWakeResearch.swift:1306-1316 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaSleepWakeResearch.swift:1078` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 2) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1786 — Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1786-1796 | Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1861-1871 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1786` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1860` calls `reduce` and `Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1785` 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 (11 lines × 2) Atria/Atria/HistoricalArchive.swift:2880 — Atria/Atria/HistoricalArchive.swift:2880-2890 | Atria/Atria/HistoricalArchive.swift:2911-2921 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:1118 — Atria/Atria/Sessions.swift:1118-1128 | Atria/Atria/Sessions.swift:1225-1235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:12358 — Atria/Atria/Sessions.swift:12358-12368 | Atria/Atria/Sessions.swift:57621-57631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:30987 — Atria/Atria/Sessions.swift:30987-30997 | Atria/Atria/Sessions.swift:31028-31038 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:30985` calls `replaceAll` and `Atria/Atria/Sessions.swift:31026` 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 × 2) Atria/Atria/Sessions.swift:41104 — Atria/Atria/Sessions.swift:41104-41114 | Atria/Atria/Sessions.swift:45256-45266 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:41102` calls `UserConfirmedSleep`, `Date` and `Atria/Atria/Sessions.swift:45255` 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 × 2) Atria/Atria/Sessions.swift:50813 — Atria/Atria/Sessions.swift:50813-50823 | Atria/Atria/Sessions.swift:50844-50854 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:55653 — Atria/Atria/Sessions.swift:55653-55663 | Atria/Atria/Sessions.swift:55700-55710 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:55653` 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) Atria/Atria/AtriaBehaviorImpact.swift:63 — Atria/Atria/AtriaBehaviorImpact.swift:63-73 | Atria/Atria/AtriaJournalInsights.swift:183-193 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note first that the copies are not typed on the same thing: the declarations holding them bind `days` to `[Day]` in one and `[AtriaBehaviorImpact.Day]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:56107 — Atria/Atria/Sessions.swift:56107-56117 | Atria/Atria/Sessions.swift:56149-56159 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:56161` calls `detached`, `AtriaDebugLog` and `Atria/Atria/Sessions.swift:56119` 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 (11 lines × 2) Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:35 — Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:35-45 | Atria/Atria/AtriaRecoveredRRProjection.swift:413-423 — 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 `Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:35` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 2) Atria/Atria/Sessions.swift:31383 — Atria/Atria/Sessions.swift:31383-31393 | Atria/Atria/Sessions.swift:31606-31616 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:31605` calls `currentCollectionStatus` and `Atria/Atria/Sessions.swift:31382` 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 (11 lines × 2) Atria/Atria/Sessions.swift:2417 — Atria/Atria/Sessions.swift:2417-2427 | Atria/Atria/Sessions.swift:2449-2459 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:2417` 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.
  • + 1 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×25
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaAnalytics.swift:1578 — Atria/Atria/AtriaAnalytics.swift:1578-1589 | Atria/Atria/AtriaAnalytics.swift:1815-1826 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaAnalytics.swift:1578` 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 (12 lines × 2) REDACTED:5169 — REDACTED:5169-5180 | REDACTED:5202-5213 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:5169` 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) REDACTED:31779 — REDACTED:31779-31790 | REDACTED:31794-31805 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) REDACTED:55423 — REDACTED:55423-55434 | REDACTED:55683-55694 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaHeroConnectionSections.swift:483 — Atria/Atria/AtriaHeroConnectionSections.swift:483-494 | Atria/Atria/AtriaHomeView.swift:8417-8428 — 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 `Atria/Atria/AtriaHeroConnectionSections.swift:483` 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) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:627 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:627-638 | Atria/Atria/AtriaManagedStorageInventory.swift:273-284 — 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 `Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:627` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:396 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:396-407 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:796-807 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:448 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:448-459 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:848-859 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:448` 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 (12 lines × 2) Atria/Atria/AtriaLearnedInsights.swift:723 — Atria/Atria/AtriaLearnedInsights.swift:723-734 | Atria/Atria/AtriaLearnedInsights.swift:929-940 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaLiveWorkoutView.swift:2699 — Atria/Atria/AtriaLiveWorkoutView.swift:2699-2713 | Atria/Atria/AtriaLiveWorkoutView.swift:2847-2858 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaLiveWorkoutView.swift:2699` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaLiveWorkoutView.swift:2846` calls `VStack` and `Atria/Atria/AtriaLiveWorkoutView.swift:2698` 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 (12 lines × 2) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:436 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:436-447 | Atria/Atria/Sessions.swift:33388-33399 — 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 `Atria/Atria/AtriaRecoveredMotionAnalytics.swift:436` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaStressDetailView.swift:1461 — Atria/Atria/AtriaStressDetailView.swift:1461-1472 | Atria/Atria/AtriaVitalsCollectionSections.swift:3254-3265 — 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 `Atria/Atria/AtriaStressDetailView.swift:1461` 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) Atria/Atria/AtriaWeeklyPlan.swift:313 — Atria/Atria/AtriaWeeklyPlan.swift:313-324 | Atria/Atria/AtriaWeeklyReport.swift:198-209 — 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) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:256 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:256-267 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:339-350 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:339` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:268` calls `merged` and `Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:351` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:533 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:533-544 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:672-683 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.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 (12 lines × 2) Atria/Atria/HistoricalArchive.swift:1843 — Atria/Atria/HistoricalArchive.swift:1843-1854 | Atria/Atria/HistoricalArchive.swift:2056-2067 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:1843` 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) Atria/Atria/Sessions.swift:2524 — Atria/Atria/Sessions.swift:2524-2535 | Atria/Atria/Sessions.swift:27350-27361 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:2524` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 2) Atria/Atria/Sessions.swift:13030 — Atria/Atria/Sessions.swift:13030-13041 | Atria/Atria/Sessions.swift:13060-13071 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:13030` 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) Atria/Atria/Sessions.swift:15138 — Atria/Atria/Sessions.swift:15138-15149 | Atria/Atria/Sessions.swift:15150-15161 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) Atria/Atria/Sessions.swift:46392 — Atria/Atria/Sessions.swift:46392-46403 | Atria/Atria/Sessions.swift:46993-47004 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:46392` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/Sessions.swift:46391` calls `checkpoint` and `Atria/Atria/Sessions.swift:46992` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (12 lines × 2) Atria/Atria/WidgetSnapshot.swift:2346 — Atria/Atria/WidgetSnapshot.swift:2346-2357 | Atria/Atria/WidgetSnapshot.swift:2374-2385 — both copies are in the same file, so extract the 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 `Atria/Atria/WidgetSnapshot.swift:2346` 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 (12 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:3259 — Atria/Atria/AtriaActivityMonitor.swift:3259-3270 | Atria/Atria/AtriaActivityMonitor.swift:3275-3286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) Atria/Atria/AtriaColdSessionMigration.swift:104 — Atria/Atria/AtriaColdSessionMigration.swift:104-115 | Atria/Atria/AtriaColdSessionMigration.swift:399-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 `Atria/Atria/AtriaColdSessionMigration.swift:104` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) validate_hrv.py:107 — validate_hrv.py:107-118 | validate_hrv.py:134-145 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (12 lines × 2) validate_hrv.py:833 — validate_hrv.py:833-844 | validate_hrv.py:1047-1058 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `validate_hrv.py:847` calls `join`, `sorted`, `items` and `validate_hrv.py:1059` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Edited copy of a member (8 corresponding lines) · ×22
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1333 — Atria/Atria/AtriaOverviewSections.swift:1333-1340 | Atria/Atria/AtriaVitalsCollectionSections.swift:293-300 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/FrameParser.swift:106 — Atria/Atria/FrameParser.swift:106-113 | tools/StrapProtocol/Sources/StrapProtocol/FrameCodec.swift:45-58 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHomeView.swift:9107 — Atria/Atria/AtriaHomeView.swift:9107-9122 | Atria/Atria/AtriaHomeView.swift:9123-9130 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/HRV.swift:238 — Atria/Atria/HRV.swift:238-245 | Atria/Atria/Sessions.swift:32483-32490 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaGraphGrammar.swift:710 — Atria/Atria/AtriaGraphGrammar.swift:710-717 | Atria/Atria/AtriaGraphGrammar.swift:719-726 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHomeView.swift:5417 — Atria/Atria/AtriaHomeView.swift:5417-5426 | Atria/Atria/AtriaTodayScreen.swift:2712-2719 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/Sessions.swift:33561 — Atria/Atria/Sessions.swift:33561-33572 | Atria/Atria/Sessions.swift:43031-43038 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1152 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1152-1161 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1165-1172 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHistoricalActivityProjection.swift:387 — Atria/Atria/AtriaHistoricalActivityProjection.swift:387-394 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:941-950 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:540 — Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:540-558 | Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:336-343 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaTriRing.swift:129 — Atria/Atria/AtriaTriRing.swift:129-138 | Atria/Atria/AtriaTriRing.swift:140-147 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/Sessions.swift:54079 — Atria/Atria/Sessions.swift:54079-54086 | Atria/Atria/Sessions.swift:54088-54095 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) REDACTED:22386 — REDACTED:22386-22393 | REDACTED:22395-22402 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:718 — Atria/Atria/AtriaHealthScreen.swift:718-725 | Atria/Atria/AtriaHealthScreen.swift:796-803 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:519 — Atria/Atria/AtriaHeroConnectionSections.swift:519-527 | Atria/Atria/AtriaSharedUIComponents.swift:246-253 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaAboutMetricSheet.swift:526 — Atria/Atria/AtriaAboutMetricSheet.swift:526-533 | Atria/Atria/AtriaSharedUIComponents.swift:352-359 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaRecoveredRRProjection.swift:594 — Atria/Atria/AtriaRecoveredRRProjection.swift:594-601 | REDACTED:6941-6949 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHistoricalLongTermRollup.swift:1018 — Atria/Atria/AtriaHistoricalLongTermRollup.swift:1018-1025 | Atria/Atria/AtriaMorningCheckIn.swift:161-168 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:877 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:877-884 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:229-236 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1188 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1188-1200 | REDACTED:5983-5990 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3202 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3202-3215 | REDACTED:5344-5351 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (8 corresponding lines) tools/app_build_provenance.py:151 — tools/app_build_provenance.py:151-159 | tools/v4_morning_acceptance.py:76-83 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (14 lines × 2) · ×22
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaApp.swift:1553 — Atria/Atria/AtriaApp.swift:1553-1566 | Atria/Atria/AtriaApp.swift:1602-1615 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (14 lines × 2) REDACTED:25928 — REDACTED:25928-25941 | REDACTED:25958-25971 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:25928` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) REDACTED:46928 — REDACTED:46928-46941 | REDACTED:47358-47372 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:46928` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) REDACTED:54018 — REDACTED:54018-54031 | REDACTED:54476-54489 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaHistoricalAggregateReader.swift:845 — Atria/Atria/AtriaHistoricalAggregateReader.swift:845-858 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:679-692 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:413 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:413-426 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:537-550 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:413` 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) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:482 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:482-495 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:880-893 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:482` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaMonthlyReport.swift:165 — Atria/Atria/AtriaMonthlyReport.swift:165-178 | Atria/Atria/AtriaWeeklyReport.swift:110-123 — 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 (14 lines × 2) Atria/Atria/AtriaOverviewSections.swift:1861 — Atria/Atria/AtriaOverviewSections.swift:1861-1874 | Atria/Atria/AtriaStressDetailView.swift:1086-1099 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaOverviewSections.swift:1876` calls `Spacer` and `Atria/Atria/AtriaStressDetailView.swift:1101` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaStressMonitor.swift:2392 — Atria/Atria/AtriaStressMonitor.swift:2392-2405 | Atria/Atria/Sessions.swift:8913-8926 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaVitalsCollectionSections.swift:1843 — Atria/Atria/AtriaVitalsCollectionSections.swift:1843-1856 | Atria/Atria/AtriaVitalsCollectionSections.swift:1963-1976 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaVitalsCollectionSections.swift:1843` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaVitalsCollectionSections.swift:1859 — Atria/Atria/AtriaVitalsCollectionSections.swift:1859-1872 | Atria/Atria/AtriaVitalsCollectionSections.swift:1979-1992 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:137 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:137-150 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:54-67 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:137` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Atria/Atria/AtriaWorkoutOnset.swift:14 — Atria/Atria/AtriaWorkoutOnset.swift:14-27 | Atria/Atria/AtriaWorkoutOnset.swift:73-86 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWorkoutOnset.swift:14` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (14 lines × 2) Atria/Atria/DailyRollupStore.swift:954 — Atria/Atria/DailyRollupStore.swift:954-967 | Atria/Atria/DailyRollupStore.swift:1138-1151 — both copies are in the same file, so extract the 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) Atria/Atria/HRV.swift:555 — Atria/Atria/HRV.swift:555-568 | Atria/Atria/Sessions.swift:32436-32449 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (14 lines × 2) Atria/Atria/HealthKitExporter.swift:2024 — Atria/Atria/HealthKitExporter.swift:2024-2037 | Atria/Atria/Sessions.swift:54909-54922 — 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 `Atria/Atria/HealthKitExporter.swift:2024` 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) Atria/Atria/HistoricalArchive.swift:8091 — Atria/Atria/HistoricalArchive.swift:8091-8104 | Atria/Atria/HistoricalArchive.swift:8512-8525 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:8091` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) Atria/Atria/Sessions.swift:21418 — Atria/Atria/Sessions.swift:21418-21431 | Atria/Atria/Sessions.swift:21446-21459 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:21418` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) tools/fit_step_calibration.swift:473 — tools/fit_step_calibration.swift:473-486 | tools/replay_step_calibration.swift:40-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `tools/fit_step_calibration.swift:473` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (14 lines × 2) tools/fit_step_calibration.swift:636 — tools/fit_step_calibration.swift:636-649 | tools/replay_step_calibration.swift:493-506 — 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 (14 lines × 2) tools/analyze_historical_2f.py:950 — tools/analyze_historical_2f.py:950-963 | tools/analyze_historical_2f.py:1054-1067 — both copies are in the same file, so extract the 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 `tools/analyze_historical_2f.py:950` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×19
  • Edited copy of a member (14 corresponding lines) Atria/Atria/Sessions.swift:30798 — Atria/Atria/Sessions.swift:30798-30811 | Atria/Atria/Sessions.swift:30824-30843 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaShareCard.swift:864 — Atria/Atria/AtriaShareCard.swift:864-877 | Atria/Atria/AtriaTriRing.swift:749-762 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaIMUDiagnosticTransport.swift:1097 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:1097-1111 | tools/StrapProtocol/Sources/StrapProtocol/FrameCodec.swift:102-115 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:123 — Atria/Atria/AtriaHealthScreen.swift:123-144 | Atria/Atria/AtriaVitalsCollectionSections.swift:904-917 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaRawExport.swift:144 — Atria/Atria/AtriaRawExport.swift:144-157 | Atria/Atria/AtriaRawExport.swift:159-172 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaNutritionContext.swift:36 — Atria/Atria/AtriaNutritionContext.swift:36-49 | Atria/Atria/AtriaOverviewSections.swift:6596-6610 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:664 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:664-678 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:1078-1091 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:737 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:737-750 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:752-765 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) REDACTED:31816 — REDACTED:31816-31830 | Atria/Atria/AtriaStrapCalibrationArchive.swift:697-710 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) REDACTED:25586 — REDACTED:25586-25599 | REDACTED:26469-26484 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaAnalytics.swift:452 — Atria/Atria/AtriaAnalytics.swift:452-467 | Atria/Atria/AtriaAnalytics.swift:469-482 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaHealthspanDetailView.swift:635 — Atria/Atria/AtriaHealthspanDetailView.swift:635-648 | Atria/Atria/AtriaHealthspanDetailView.swift:650-664 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/Sessions.swift:59095 — Atria/Atria/Sessions.swift:59095-59109 | Atria/Atria/Sessions.swift:61467-61480 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/Sessions.swift:43154 — Atria/Atria/Sessions.swift:43154-43167 | Atria/Atria/Sessions.swift:43169-43183 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:6897 — Atria/Atria/AtriaOverviewSections.swift:6897-6911 | Atria/Atria/AtriaOverviewSections.swift:9761-9774 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaDefault.swift:171 — Atria/Atria/AtriaDefault.swift:171-184 | Atria/Atria/AtriaDefault.swift:196-211 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaLiveWorkoutView.swift:420 — Atria/Atria/AtriaLiveWorkoutView.swift:420-433 | Atria/Atria/AtriaLiveWorkoutView.swift:435-448 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3234 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3234-3247 | Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3253-3266 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (14 corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:734 — Atria/Atria/AtriaHeroConnectionSections.swift:734-747 | Atria/Atria/AtriaHomeView.swift:5471-5489 — These two members are one piece of code written twice and then edited apart: 14 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (13 corresponding lines) · ×18
  • Edited copy of a member (13 corresponding lines) Atria/Atria/AtriaTrendChart.swift:2144 — Atria/Atria/AtriaTrendChart.swift:2144-2157 | Atria/Atria/AtriaTrendChart.swift:2159-2171 — 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) Atria/Atria/AtriaLiveActivityLockPreview.swift:62 — Atria/Atria/AtriaLiveActivityLockPreview.swift:62-74 | Atria/AtriaWidget/AtriaWidget.swift:3219-3235 — 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) Atria/Atria/AtriaSleepHypnogram.swift:930 — Atria/Atria/AtriaSleepHypnogram.swift:930-946 | Atria/Atria/AtriaVitalsCollectionSections.swift:5207-5219 — 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) Atria/Atria/AtriaTrendChart.swift:1588 — Atria/Atria/AtriaTrendChart.swift:1588-1600 | Atria/Atria/AtriaVitalsCollectionSections.swift:226-240 — 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) Atria/Atria/AtriaWeeklyPlan.swift:384 — Atria/Atria/AtriaWeeklyPlan.swift:384-398 | Atria/Atria/AtriaWeeklyReport.swift:217-229 — 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) Atria/Atria/AtriaSensorReferenceCapture.swift:171 — Atria/Atria/AtriaSensorReferenceCapture.swift:171-183 | Atria/Atria/AtriaStepCalibrationPlan.swift:88-103 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:23628 — REDACTED:23628-23640 | REDACTED:52519-52533 — 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) Atria/Atria/AtriaHapticAlerts.swift:539 — Atria/Atria/AtriaHapticAlerts.swift:539-555 | Atria/Atria/AtriaHapticAlerts.swift:557-569 — 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) Atria/Atria/AtriaHomeView.swift:12507 — Atria/Atria/AtriaHomeView.swift:12507-12521 | Atria/Atria/AtriaHomeView.swift:12523-12535 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (13 corresponding lines) REDACTED:33942 — REDACTED:33942-33954 | REDACTED:34012-34024 — 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) Atria/Atria/AtriaAnalytics.swift:2114 — Atria/Atria/AtriaAnalytics.swift:2114-2128 | Atria/Atria/AtriaFitnessAge.swift:265-277 — 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) Atria/Atria/AtriaWorkoutRuntime.swift:299 — Atria/Atria/AtriaWorkoutRuntime.swift:299-315 | Atria/Atria/AtriaWorkoutRuntime.swift:468-480 — 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) Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:499 — Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:499-513 | Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:515-527 — 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) Atria/Atria/Sessions.swift:10035 — Atria/Atria/Sessions.swift:10035-10047 | Atria/Atria/Sessions.swift:10058-10070 — 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) Atria/Atria/AtriaExpandedChart.swift:817 — Atria/Atria/AtriaExpandedChart.swift:817-829 | Atria/Atria/AtriaExpandedChart.swift:831-843 — 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) Atria/Atria/AtriaAICoach.swift:152 — Atria/Atria/AtriaAICoach.swift:152-164 | Atria/Atria/AtriaAICoach.swift:166-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) Atria/Atria/AtriaShareCard.swift:260 — Atria/Atria/AtriaShareCard.swift:260-273 | Atria/Atria/AtriaHomeView.swift:4565-4577 — 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) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:447 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:447-461 | REDACTED:6765-6777 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (5 corresponding lines) · ×18
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaTodayScreen.swift:4254 — Atria/Atria/AtriaTodayScreen.swift:4254-4258 | Atria/Atria/AtriaVitalsCollectionSections.swift:1790-1795 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaHomeView.swift:3468 — Atria/Atria/AtriaHomeView.swift:3468-3476 | Atria/Atria/AtriaSettingsView.swift:387-391 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/HealthKitExporter.swift:2039 — Atria/Atria/HealthKitExporter.swift:2039-2043 | Atria/Atria/Sessions.swift:54924-54928 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/Insights.swift:316 — Atria/Atria/Insights.swift:316-323 | Atria/Atria/Insights.swift:329-333 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaJournalStore.swift:136 — Atria/Atria/AtriaJournalStore.swift:136-140 | Atria/Atria/AtriaJournalStore.swift:190-197 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaTrendChart.swift:2209 — Atria/Atria/AtriaTrendChart.swift:2209-2213 | Atria/Atria/AtriaVitalsCollectionSections.swift:4669-4674 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:212 — Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:212-216 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1373-1377 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaFaceOff.swift:111 — Atria/Atria/AtriaFaceOff.swift:111-115 | Atria/Atria/AtriaWeeklyReport.swift:142-146 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:338 — Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:338-342 | Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:258-262 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaLiveWorkoutView.swift:1418 — Atria/Atria/AtriaLiveWorkoutView.swift:1418-1422 | Atria/Atria/AtriaWorkoutRoute.swift:918-926 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1300 — Atria/Atria/AtriaOverviewSections.swift:1300-1304 | Atria/Atria/AtriaVitalsCollectionSections.swift:279-283 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1362 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1362-1367 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:238-242 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:10262 — Atria/Atria/AtriaOverviewSections.swift:10262-10268 | Atria/Atria/AtriaTodayScreen.swift:3381-3385 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaHistoricalGapLedger.swift:1463 — Atria/Atria/AtriaHistoricalGapLedger.swift:1463-1467 | Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:448-452 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/HealthKitExporter.swift:196 — Atria/Atria/HealthKitExporter.swift:196-200 | Atria/Atria/LocalNotificationScheduler.swift:7-11 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:225 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:225-229 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:894-898 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) tools/analyze_sleep_store.py:101 — tools/analyze_sleep_store.py:101-105 | tools/verify_hist1_acceptance.py:178-182 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (5 corresponding lines) tools/strap-mac/overnight_watch.py:36 — tools/strap-mac/overnight_watch.py:36-40 | tools/strap-mac/session.py:64-68 — These two members are one piece of code written twice and then edited apart: 5 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D3 · God Classes · TooManyMethods · ×17
  • TooManyMethods: AtriaBLEManager REDACTED:558 — TooManyMethods — 1400 methods, declared across 6 files: REDACTED (1166), Atria/AtriaBLEHistoricalRecoveryPolicy.swift (142), Atria/AtriaStrapPowerPolicy.swift (31), Atria/AtriaBLEBatteryTransportPolicy.swift (26), +2 more file(s). The bar is 30 methods; this is 1370 over it, 46.67× 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: SessionStore Atria/Atria/Sessions.swift:8847 — TooManyMethods — 1127 methods. The bar is 30 methods; this is 1097 over it, 37.57× 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: AtriaHomeView Atria/Atria/AtriaHomeView.swift:465 — TooManyMethods — 138 methods. The bar is 30 methods; this is 108 over it, 4.60× 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: AtriaHomeModel Atria/Atria/AtriaHomeView.swift:8877 — TooManyMethods — 116 methods. The bar is 30 methods; this is 86 over it, 3.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AtriaWhoop4MotionTickCompactStore Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:11 — TooManyMethods — 67 methods. The bar is 30 methods; this is 37 over it, 2.23× 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: HealthKitExporter Atria/Atria/HealthKitExporter.swift:4 — TooManyMethods — 64 methods. The bar is 30 methods; this is 34 over it, 2.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: AtriaHistoricalArchiveDurableStore Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:12 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× 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: SavedSession Atria/Atria/Sessions.swift:1431 — TooManyMethods — 59 methods. The bar is 30 methods; this is 29 over it, 1.97× 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: AtriaStressMonitorStore Atria/Atria/AtriaStressMonitor.swift:2886 — TooManyMethods — 56 methods. The bar is 30 methods; this is 26 over it, 1.87× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AtriaTodayScreen Atria/Atria/AtriaTodayScreen.swift:250 — TooManyMethods — 52 methods. The bar is 30 methods; this is 22 over it, 1.73× 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: AtriaHistoricalFullDrainCoverageStore Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:14 — TooManyMethods — 38 methods. The bar is 30 methods; this is 8 over it, 1.27× 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: AtriaStrapCalibrationArchive Atria/Atria/AtriaStrapCalibrationArchive.swift:5 — TooManyMethods — 37 methods. The bar is 30 methods; this is 7 over it, 1.23× 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: AtriaWhoop4ExactRangeTrialHarness Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:19 — 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: AtriaR10MotionPipeline Atria/Atria/AtriaR10Motion.swift:1117 — 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: AtriaLiveWorkoutView Atria/Atria/AtriaLiveWorkoutView.swift:2505 — TooManyMethods — 33 methods. The bar is 30 methods; this is 3 over it, 1.10× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: AtriaWhoop4HistoryAdmissionLedger Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:29 — 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: SleepHistorySnapshot Atria/Atria/Sessions.swift:59498 — TooManyMethods — 32 methods, declared across 2 files: Atria/Sessions.swift (31), Atria/AtriaHistorySection.swift (1). The bar is 30 methods; this is 2 over it, 1.07× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Edited copy of a member (10 corresponding lines) · ×17
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaShareCard.swift:493 — Atria/Atria/AtriaShareCard.swift:493-504 | Atria/Atria/AtriaShareCard.swift:506-515 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaSleepBudget.swift:240 — Atria/Atria/AtriaSleepBudget.swift:240-251 | Atria/Atria/AtriaSleepBudget.swift:335-344 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaSleepHypnogram.swift:128 — Atria/Atria/AtriaSleepHypnogram.swift:128-137 | Atria/Atria/AtriaSmartWakeView.swift:51-60 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:2206 — Atria/Atria/AtriaHealthScreen.swift:2206-2215 | Atria/Atria/AtriaHealthScreen.swift:2217-2227 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:1468 — Atria/Atria/AtriaHealthScreen.swift:1468-1477 | Atria/Atria/AtriaOverviewSections.swift:5977-5986 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaTodayScreen.swift:1965 — Atria/Atria/AtriaTodayScreen.swift:1965-1974 | Atria/Atria/AtriaTodayScreen.swift:3601-3614 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaHistoricalActivityProjection.swift:505 — Atria/Atria/AtriaHistoricalActivityProjection.swift:505-519 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:267-276 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaDetectionLog.swift:140 — Atria/Atria/AtriaDetectionLog.swift:140-149 | Atria/Atria/Sessions.swift:40069-40080 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaVitalsCollectionSections.swift:358 — Atria/Atria/AtriaVitalsCollectionSections.swift:358-367 | Atria/Atria/AtriaVitalsCollectionSections.swift:749-758 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaOnboardingPersonalization.swift:72 — Atria/Atria/AtriaOnboardingPersonalization.swift:72-83 | Atria/Atria/AtriaTodayScreen.swift:1445-1454 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaShareCard.swift:3080 — Atria/Atria/AtriaShareCard.swift:3080-3091 | Atria/Atria/AtriaShareCard.swift:3102-3111 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaSmartWakeView.swift:69 — Atria/Atria/AtriaSmartWakeView.swift:69-81 | Atria/Atria/AtriaSmartWakeView.swift:83-92 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaHomeView.swift:453 — Atria/Atria/AtriaHomeView.swift:453-462 | Atria/Atria/AtriaOverviewSections.swift:5475-5486 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaApp.swift:1385 — Atria/Atria/AtriaApp.swift:1385-1396 | Atria/Atria/Sessions.swift:36624-36633 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:675 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:675-684 | REDACTED:6302-6311 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) REDACTED:35868 — REDACTED:35868-35888 | Atria/Atria/AtriaLiveActivityCoordinator.swift:500-509 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (10 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2999 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2999-3016 | REDACTED:6673-6682 — These two members are one piece of code written twice and then edited apart: 10 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (6 corresponding lines) · ×17
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHomeView.swift:9089 — Atria/Atria/AtriaHomeView.swift:9089-9095 | Atria/Atria/AtriaHomeView.swift:13397-13402 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalRetentionTransaction.swift:511 — Atria/Atria/AtriaHistoricalRetentionTransaction.swift:511-524 | Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:437-442 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:434 — Atria/Atria/AtriaActivityMonitor.swift:434-443 | Atria/Atria/Sessions.swift:4115-4120 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:476 — Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:476-481 | Atria/Atria/AtriaHistoricalGapLedger.swift:1168-1173 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaDeviceUseJournal.swift:189 — Atria/Atria/AtriaDeviceUseJournal.swift:189-194 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:953-960 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/ActiveSessionJournal.swift:1318 — Atria/Atria/ActiveSessionJournal.swift:1318-1324 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:271-276 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:832 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:832-837 | Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:272-277 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) tools/summarize_step_archive_coverage.py:51 — tools/summarize_step_archive_coverage.py:51-56 | whoop_codec.py:16-21 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalLongTermRollup.swift:559 — Atria/Atria/AtriaHistoricalLongTermRollup.swift:559-564 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:454-459 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaNightBaseline.swift:208 — Atria/Atria/AtriaNightBaseline.swift:208-213 | Atria/Atria/AtriaRecoveryDrivers.swift:134-139 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) REDACTED:835 — REDACTED:835-840 | Atria/Atria/Sessions.swift:30605-30612 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:910 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:910-917 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:586-591 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHistoricalRetentionTransaction.swift:498 — Atria/Atria/AtriaHistoricalRetentionTransaction.swift:498-503 | Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:478-483 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) Atria/Atria/AtriaHomeView.swift:8271 — Atria/Atria/AtriaHomeView.swift:8271-8276 | Atria/Atria/AtriaLiveWorkoutView.swift:3747-3752 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) tools/audit_handoff_status.py:280 — tools/audit_handoff_status.py:280-285 | tools/audit_handoff_status.py:680-688 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) tools/validate_hr_reference.py:113 — tools/validate_hr_reference.py:113-120 | tools/validate_hrv_reference.py:162-167 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (6 corresponding lines) tools/strap-mac/flush_probe.py:122 — tools/strap-mac/flush_probe.py:122-127 | tools/strap-mac/night_capture.py:164-171 — These two members are one piece of code written twice and then edited apart: 6 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (13 lines × 2) · ×17
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaAnalytics.swift:707 — Atria/Atria/AtriaAnalytics.swift:707-719 | Atria/Atria/AtriaColdSessionFacts.swift:213-225 — 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 (13 lines × 2) REDACTED:4871 — REDACTED:4871-4883 | REDACTED:4904-4916 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaGraphInspector.swift:339 — Atria/Atria/AtriaGraphInspector.swift:339-351 | Atria/Atria/AtriaGraphInspector.swift:394-406 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaGraphInspector.swift:339` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:437 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:437-449 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:526-538 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:437` 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 (13 lines × 2) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:534 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:534-546 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:610-622 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:534` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaHomeView.swift:4400 — Atria/Atria/AtriaHomeView.swift:4400-4413 | Atria/Atria/AtriaHomeView.swift:4422-4434 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHomeView.swift:4400` 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 (13 lines × 2) Atria/Atria/AtriaRecoveredRRProjection.swift:639 — Atria/Atria/AtriaRecoveredRRProjection.swift:639-651 | Atria/Atria/HistoricalArchive.swift:9592-9604 — 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 `Atria/Atria/AtriaRecoveredRRProjection.swift:639` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaWhoop4CompactIMU.swift:229 — Atria/Atria/AtriaWhoop4CompactIMU.swift:229-241 | Atria/Atria/AtriaWhoop4CompactIMU.swift:252-264 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4CompactIMU.swift:229` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:70 — Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:70-82 | Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:117-129 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `command` to `UInt8 = 0x0b` in one and `UInt8 = 0x22` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (13 lines × 2) Atria/Atria/HistoricalArchive.swift:1170 — Atria/Atria/HistoricalArchive.swift:1170-1182 | Atria/Atria/HistoricalArchive.swift:1198-1210 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:1198` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 2) Atria/Atria/Sessions.swift:3065 — Atria/Atria/Sessions.swift:3065-3077 | Atria/Atria/Sessions.swift:5470-5482 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Atria/Atria/Sessions.swift:48633 — Atria/Atria/Sessions.swift:48633-48645 | Atria/Atria/Sessions.swift:53226-53238 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:48633` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Atria/AtriaWidget/AtriaWidget.swift:3907 — Atria/AtriaWidget/AtriaWidget.swift:3907-3919 | Atria/AtriaWidget/AtriaWidget.swift:3950-3962 — both copies are in the same file, so extract the 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 `Atria/AtriaWidget/AtriaWidget.swift:3907` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) Atria/Atria/Sessions.swift:24800 — Atria/Atria/Sessions.swift:24800-24812 | Atria/Atria/Sessions.swift:56248-56260 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:24800` 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 (13 lines × 2) Atria/AtriaWidget/AtriaWidget.swift:3710 — Atria/AtriaWidget/AtriaWidget.swift:3710-3722 | Atria/AtriaWidget/AtriaWidget.swift:3733-3745 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/AtriaWidget/AtriaWidget.swift:3708` calls `atriaCumulativeDayStepsAreCurrent` and `Atria/AtriaWidget/AtriaWidget.swift:3729` 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) tools/replay_whoop4_day_steps.swift:149 — tools/replay_whoop4_day_steps.swift:149-161 | tools/verify_whoop4_autonomous_step_corpus.swift:459-471 — before extracting anything, compare `tools/replay_whoop4_day_steps.swift` and `tools/verify_whoop4_autonomous_step_corpus.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/replay_whoop4_day_steps.swift:149` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13 lines × 2) tools/analyze_historical_archive.py:78 — tools/analyze_historical_archive.py:78-90 | tools/analyze_historical_usability.py:77-89 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×16
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:3258 — Atria/Atria/AtriaActivityMonitor.swift:3258-3272 | Atria/Atria/AtriaActivityMonitor.swift:3274-3288 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1967 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1967-1988 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2028-2042 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaJournalTab.swift:196 — Atria/Atria/AtriaJournalTab.swift:196-212 | Atria/Atria/AtriaOverviewSections.swift:10565-10579 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/Sessions.swift:61649 — Atria/Atria/Sessions.swift:61649-61665 | Atria/Atria/Sessions.swift:61750-61764 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaBreathworkSession.swift:777 — Atria/Atria/AtriaBreathworkSession.swift:777-791 | Atria/Atria/AtriaHomeView.swift:3420-3434 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaDailyStepPresentation.swift:1125 — Atria/Atria/AtriaDailyStepPresentation.swift:1125-1142 | Atria/Atria/AtriaDailyStepPresentation.swift:1178-1192 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/Sessions.swift:60923 — Atria/Atria/Sessions.swift:60923-60937 | Atria/Atria/Sessions.swift:61157-61171 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaManualSleepSheet.swift:598 — Atria/Atria/AtriaManualSleepSheet.swift:598-615 | Atria/Atria/AtriaWorkoutReviewSheet.swift:156-170 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/HistoricalArchive.swift:11319 — Atria/Atria/HistoricalArchive.swift:11319-11333 | Atria/Atria/HistoricalArchive.swift:11335-11349 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaAICoach.swift:494 — Atria/Atria/AtriaAICoach.swift:494-508 | Atria/Atria/AtriaAICoach.swift:510-524 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:567 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:567-582 | Atria/Atria/AtriaManagedStorageInventory.swift:315-329 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaMetricTargets.swift:272 — Atria/Atria/AtriaMetricTargets.swift:272-286 | Atria/Atria/AtriaMetricTargets.swift:288-302 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/AtriaHomeView.swift:11425 — Atria/Atria/AtriaHomeView.swift:11425-11439 | Atria/Atria/AtriaHomeView.swift:12067-12081 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) Atria/Atria/Sessions.swift:41273 — Atria/Atria/Sessions.swift:41273-41287 | Atria/Atria/Sessions.swift:49341-49355 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) tools/analyze_sleep_store.py:165 — tools/analyze_sleep_store.py:165-185 | tools/analyze_workout_store.py:551-565 — These two members are one piece of code written twice and then edited apart: 15 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (15 corresponding lines) tools/analyze_historical_2f.py:245 — tools/analyze_historical_2f.py:245-264 | tools/analyze_historical_2f.py:414-428 — 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 (18 corresponding lines) · ×15
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaStressDetailView.swift:1629 — Atria/Atria/AtriaStressDetailView.swift:1629-1650 | Atria/Atria/AtriaVitalsCollectionSections.swift:3387-3404 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHomeView.swift:8252 — Atria/Atria/AtriaHomeView.swift:8252-8269 | Atria/Atria/AtriaOverviewSections.swift:550-572 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaStrengthSetLogging.swift:283 — Atria/Atria/AtriaStrengthSetLogging.swift:283-301 | Atria/Atria/AtriaStrengthSetLogging.swift:303-320 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:838 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:838-855 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:161-188 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/Sessions.swift:60968 — Atria/Atria/Sessions.swift:60968-60987 | Atria/Atria/Sessions.swift:60990-61007 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2086 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2086-2104 | Atria/Atria/AtriaWhoop4HistoricalOrphanVault.swift:204-221 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:8463 — REDACTED:8463-8480 | REDACTED:8623-8640 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1231 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1231-1249 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1251-1268 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/Sessions.swift:32728 — Atria/Atria/Sessions.swift:32728-32753 | Atria/Atria/Sessions.swift:32760-32777 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/Sessions.swift:26220 — Atria/Atria/Sessions.swift:26220-26237 | Atria/Atria/Sessions.swift:26243-26262 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHomeView.swift:2299 — Atria/Atria/AtriaHomeView.swift:2299-2316 | Atria/Atria/AtriaHomeView.swift:2324-2343 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/Sessions.swift:20549 — Atria/Atria/Sessions.swift:20549-20566 | Atria/Atria/Sessions.swift:20786-20803 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:337 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:337-357 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:392-409 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) REDACTED:4254 — REDACTED:4254-4274 | REDACTED:4286-4303 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (18 corresponding lines) Atria/Atria/Sessions.swift:49984 — Atria/Atria/Sessions.swift:49984-50001 | Atria/Atria/Sessions.swift:50003-50023 — 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 (4 members, 50+ identical tokens) · ×14
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/ActiveSessionJournal.swift:1326 — Atria/Atria/ActiveSessionJournal.swift:1326-1335 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:723-732 | Atria/Atria/AtriaStrapStepLedger.swift:538-547 | Atria/Atria/Sessions.swift:7218-7232 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:353 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:353-358 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:393-398 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:292-297 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:351-356 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:839 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:839-848 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2408-2417 | Atria/Atria/AtriaHistoricalRetentionTransaction.swift:592-601 | Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:529-538 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:480 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:480-485 | Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:344-349 | Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:382-387 | Atria/Atria/AtriaHistoricalReplayPayloadCompaction.swift:161-166 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:257 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:257-437 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:456-561 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:567-631 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:638-743 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaOverviewSections.swift:1859 — Atria/Atria/AtriaOverviewSections.swift:1859-1903 | Atria/Atria/AtriaOverviewSections.swift:2504-2538 | Atria/Atria/AtriaSleepPlannerCharts.swift:521-578 | Atria/Atria/AtriaStressDetailView.swift:1079-1143 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/AtriaTrendChart.swift:1736 — Atria/Atria/AtriaTrendChart.swift:1736-1746 | Atria/Atria/AtriaTrendChart.swift:1748-1758 | Atria/Atria/AtriaTrendChart.swift:1760-1770 | Atria/Atria/AtriaTrendChart.swift:1792-1802 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/HistoricalArchive.swift:4594 — Atria/Atria/HistoricalArchive.swift:4594-4676 | Atria/Atria/HistoricalArchive.swift:8014-8078 | Atria/Atria/HistoricalArchive.swift:8539-8568 | Atria/Atria/HistoricalArchive.swift:8572-8603 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/HistoricalArchive.swift:5824 — Atria/Atria/HistoricalArchive.swift:5824-5853 | Atria/Atria/HistoricalArchive.swift:5892-5914 | Atria/Atria/HistoricalArchive.swift:5918-5945 | Atria/Atria/HistoricalArchive.swift:5950-5980 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/Sessions.swift:2416 — Atria/Atria/Sessions.swift:2416-2437 | Atria/Atria/Sessions.swift:2445-2476 | Atria/Atria/Sessions.swift:2557-2588 | Atria/Atria/Sessions.swift:2763-2786 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/Sessions.swift:34739 — Atria/Atria/Sessions.swift:34739-34819 | Atria/Atria/Sessions.swift:34829-34886 | Atria/Atria/Sessions.swift:35571-35621 | Atria/Atria/Sessions.swift:35971-36230 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Atria/Atria/Sessions.swift:50025 — Atria/Atria/Sessions.swift:50025-51166 | Atria/Atria/Sessions.swift:52294-52330 | Atria/Atria/Sessions.swift:52339-52390 | Atria/Atria/Sessions.swift:53559-53714 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) tools/evaluate_activity_classifier.py:47 — tools/evaluate_activity_classifier.py:47-53 | tools/evaluate_overnight_load_model.py:33-39 | tools/evaluate_recovery_model.py:30-36 | tools/evaluate_sensor_decoder.py:31-37 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
  • Members sharing a duplicated core (4 members, 50+ identical tokens) tools/evaluate_activity_classifier.py:131 — tools/evaluate_activity_classifier.py:131-159 | tools/evaluate_overnight_load_model.py:112-139 | tools/evaluate_recovery_model.py:135-164 | tools/evaluate_sensor_decoder.py:136-159 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×14
  • Edited copy of a member (11 corresponding lines) REDACTED:27553 — REDACTED:27553-27563 | REDACTED:27565-27580 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1262 — Atria/Atria/AtriaOverviewSections.swift:1262-1275 | Atria/Atria/AtriaVitalsCollectionSections.swift:263-273 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:912 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:912-922 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:924-934 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:2370 — Atria/Atria/AtriaHealthScreen.swift:2370-2380 | Atria/Atria/AtriaTodayScreen.swift:673-683 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:180 — Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:180-190 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:752-765 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaHomeView.swift:337 — Atria/Atria/AtriaHomeView.swift:337-348 | Atria/AtriaWidget/AtriaWidget.swift:3483-3493 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/Sessions.swift:1171 — Atria/Atria/Sessions.swift:1171-1181 | Atria/Atria/Sessions.swift:1250-1260 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaShareCard.swift:1832 — Atria/Atria/AtriaShareCard.swift:1832-1845 | Atria/Atria/AtriaShareCard.swift:2267-2277 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaVitalsCollectionSections.swift:3956 — Atria/Atria/AtriaVitalsCollectionSections.swift:3956-3966 | Atria/Atria/AtriaVitalsCollectionSections.swift:3968-3979 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:303 — Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:303-313 | REDACTED:12412-12422 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:221 — Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:221-232 | REDACTED:35856-35866 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) tools/strap-mac/pairing_6a.py:148 — tools/strap-mac/pairing_6a.py:148-159 | tools/strap-mac/pairing_window.py:117-127 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) tools/analyze_sleep_store.py:34 — tools/analyze_sleep_store.py:34-44 | tools/analyze_workout_store.py:111-124 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (11 corresponding lines) tools/validate_hr_reference.py:46 — tools/validate_hr_reference.py:46-56 | tools/validate_hrv_reference.py:72-82 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×13
  • Duplicated block (16 lines × 2) REDACTED:14600 — REDACTED:14600-14615 | REDACTED:23313-23328 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) REDACTED:31857 — REDACTED:31857-31872 | Atria/Atria/AtriaResearchProbe.swift:387-402 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:31857` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) REDACTED:46820 — REDACTED:46820-46835 | REDACTED:46854-46869 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:46820` 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 (16 lines × 2) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:584 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:584-605 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:657-672 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:584` 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) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:656 — Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:656-671 | Atria/Atria/AtriaHistoricalLongTermRollup.swift:928-943 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit. Note first that the copies are not typed on the same thing: the declarations holding them bind `conflict` to `LedgerError` in one and `StoreError` 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 (16 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:137 — Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:137-152 | Atria/Atria/WidgetSnapshot.swift:357-372 — 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 `Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:137` 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 (16 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:431 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:431-446 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:831-846 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:431` 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 (16 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:497 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:497-512 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:895-910 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:497` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) Atria/Atria/AtriaHistorySection.swift:1345 — Atria/Atria/AtriaHistorySection.swift:1345-1360 | Atria/Atria/AtriaOverviewSections.swift:2572-2587 — 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 `Atria/Atria/AtriaHistorySection.swift:1345` 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, `Atria/Atria/AtriaHistorySection.swift:1362` calls `VStack` and `Atria/Atria/AtriaOverviewSections.swift:2589` 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 lines × 2) Atria/Atria/HistoricalArchive.swift:3532 — Atria/Atria/HistoricalArchive.swift:3532-3547 | Atria/Atria/HistoricalArchive.swift:3815-3830 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) Atria/Atria/Sessions.swift:22824 — Atria/Atria/Sessions.swift:22824-22839 | Atria/Atria/Sessions.swift:23087-23102 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16 lines × 2) Atria/Atria/Sessions.swift:52114 — Atria/Atria/Sessions.swift:52114-52129 | Atria/Atria/Sessions.swift:52195-52210 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (16 lines × 2) Atria/Atria/Sessions.swift:60277 — Atria/Atria/Sessions.swift:60277-60292 | Atria/Atria/Sessions.swift:60544-60559 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:60277` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6 lines × 3) · ×13
  • Duplicated block (6 lines × 3) Atria/Atria/AtriaActivityMonitor.swift:5363 — Atria/Atria/AtriaActivityMonitor.swift:5363-5368 | Atria/Atria/AtriaStressDetailView.swift:1460-1465 | Atria/Atria/AtriaVitalsCollectionSections.swift:3253-3258 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (6 lines × 3) REDACTED:25430 — REDACTED:25430-25435 | REDACTED:25653-25658 | REDACTED:26538-26543 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:25430` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:25428` calls `set` and `REDACTED:25651` 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 (6 lines × 3) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1379 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1379-1384 | Atria/Atria/AtriaHistoricalGapLedger.swift:1478-1483 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1165-1174 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 3) Atria/Atria/AtriaLiveActivityLockPreview.swift:67 — Atria/Atria/AtriaLiveActivityLockPreview.swift:67-72 | Atria/AtriaWidget/AtriaWidget.swift:2273-2278 | Atria/AtriaWidget/AtriaWidget.swift:3224-3229 — 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 `Atria/Atria/AtriaLiveActivityLockPreview.swift:67` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) Atria/Atria/AtriaStressDetailView.swift:1556 — Atria/Atria/AtriaStressDetailView.swift:1556-1561 | Atria/Atria/AtriaStressDetailView.swift:1815-1820 | Atria/Atria/AtriaVitalsCollectionSections.swift:3327-3332 — 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 `Atria/Atria/AtriaStressDetailView.swift:1556` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaVitalsCollectionSections.swift:3325` calls `atriaGraphPlotSurface` and `Atria/Atria/AtriaStressDetailView.swift:1554` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) Atria/Atria/Sessions.swift:13032 — Atria/Atria/Sessions.swift:13032-13037 | Atria/Atria/Sessions.swift:13062-13067 | Atria/Atria/Sessions.swift:13166-13171 — 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 `Atria/Atria/Sessions.swift:13032` 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 (6 lines × 3) Atria/Atria/Sessions.swift:30091 — Atria/Atria/Sessions.swift:30091-30096 | Atria/Atria/Sessions.swift:30114-30119 | Atria/Atria/Sessions.swift:30128-30133 — 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 `Atria/Atria/Sessions.swift:30091` 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 (6 lines × 3) Atria/Atria/AtriaColdSessionMigration.swift:123 — Atria/Atria/AtriaColdSessionMigration.swift:123-128 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:353-358 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:535-540 — 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 `Atria/Atria/AtriaColdSessionMigration.swift:123` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 3) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:473 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:473-478 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:716-721 | Atria/Atria/AtriaHistoricalLongTermRollup.swift:987-992 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 3) tools/analyze_gate_e_workout_log.py:22 — tools/analyze_gate_e_workout_log.py:22-27 | tools/analyze_historical_usability.py:150-155 | tools/verify_whoop4_exact_history_transaction.py:54-59 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/analyze_gate_e_workout_log.py:28` calls `group` and `tools/verify_whoop4_exact_history_transaction.py:60` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) tools/analyze_historical_2f.py:236 — tools/analyze_historical_2f.py:236-241 | tools/analyze_historical_2f.py:259-264 | tools/analyze_historical_2f.py:423-428 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) tools/run_hist1_resumable_recovery.py:223 — tools/run_hist1_resumable_recovery.py:223-228 | tools/run_hist1_resumable_recovery.py:270-275 | tools/run_hist1_resumable_recovery.py:303-308 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (6 lines × 3) tools/build_physical_window_manifests.py:108 — tools/build_physical_window_manifests.py:108-113 | tools/evaluate_activity_detection.py:61-66 | tools/validate_research_corpus.py:39-44 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×12
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:32 — Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:32-45 | Atria/Atria/AtriaRecoveredRRProjection.swift:412-423 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaRawExport.swift:63 — Atria/Atria/AtriaRawExport.swift:63-76 | Atria/Atria/HistoricalArchive.swift:7077-7088 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:445 — Atria/Atria/AtriaActivityMonitor.swift:445-456 | Atria/Atria/AtriaActivityMonitor.swift:755-768 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:450 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:450-462 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:636-647 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/Sessions.swift:1961 — Atria/Atria/Sessions.swift:1961-1972 | Atria/Atria/Sessions.swift:2272-2283 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:211 — Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:211-227 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:231-242 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) REDACTED:4937 — REDACTED:4937-4948 | Atria/Atria/AtriaHomeView.swift:12776-12787 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaShareCard.swift:2964 — Atria/Atria/AtriaShareCard.swift:2964-2977 | Atria/Atria/AtriaShareCard.swift:3044-3055 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaCivilDayStepAuthority.swift:66 — Atria/Atria/AtriaCivilDayStepAuthority.swift:66-81 | Atria/Atria/AtriaUnattributedMotionRuns.swift:238-249 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:683 — Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:683-694 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:699-710 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1036 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1036-1047 | REDACTED:5752-5763 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (12 corresponding lines) tools/strap-mac/ff_sweep.py:372 — tools/strap-mac/ff_sweep.py:372-383 | tools/strap-mac/ff_sweep.py:423-436 — These two members are one piece of code written twice and then edited apart: 12 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (18 lines × 2) · ×12
  • Duplicated block (18 lines × 2) REDACTED:24995 — REDACTED:24995-25012 | REDACTED:25061-25078 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:24995` 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 (18 lines × 2) REDACTED:52173 — REDACTED:52173-52190 | REDACTED:52241-52258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:52173` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) Atria/Atria/AtriaHomeView.swift:2272 — Atria/Atria/AtriaHomeView.swift:2272-2289 | Atria/Atria/AtriaWorkoutRuntime.swift:624-641 — 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 `Atria/Atria/AtriaHomeView.swift:2272` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaHomeView.swift:2290` calls `hasContinuousValidatedWorkoutMotion` and `Atria/Atria/AtriaWorkoutRuntime.swift:642` 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 (18 lines × 2) Atria/Atria/AtriaShareCard.swift:1977 — Atria/Atria/AtriaShareCard.swift:1977-1994 | Atria/Atria/AtriaShareCard.swift:2342-2359 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:1977` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaShareCard.swift:1995` calls `UUID` and `Atria/Atria/AtriaShareCard.swift:2360` 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 (18 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:561 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:561-578 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:173-190 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (18 lines × 2) Atria/Atria/HistoricalArchive.swift:1559 — Atria/Atria/HistoricalArchive.swift:1559-1576 | Atria/Atria/HistoricalArchive.swift:1604-1621 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:1559` 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 (18 lines × 2) Atria/Atria/LocalNotificationScheduler.swift:382 — Atria/Atria/LocalNotificationScheduler.swift:382-399 | Atria/Atria/LocalNotificationScheduler.swift:500-517 — both copies are in the same file, so extract the 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 `Atria/Atria/LocalNotificationScheduler.swift:382` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (18 lines × 2) Atria/Atria/Sessions.swift:20612 — Atria/Atria/Sessions.swift:20612-20629 | Atria/Atria/Sessions.swift:20740-20757 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:20612` 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 (18 lines × 2) Atria/Atria/Sessions.swift:21928 — Atria/Atria/Sessions.swift:21928-21945 | Atria/Atria/Sessions.swift:49031-49048 — both copies are in the same file, so extract the 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 (18 lines × 2) Atria/Atria/Sessions.swift:34145 — Atria/Atria/Sessions.swift:34145-34162 | Atria/Atria/Sessions.swift:34217-34234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18 lines × 2) Atria/Atria/Sessions.swift:52132 — Atria/Atria/Sessions.swift:52132-52149 | Atria/Atria/Sessions.swift:52213-52230 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:52132` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/Sessions.swift:52151` calls `Set`, `startOfDay` and `Atria/Atria/Sessions.swift:52232` 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 (18 lines × 2) Atria/Atria/Sessions.swift:54052 — Atria/Atria/Sessions.swift:54052-54069 | Atria/Atria/Sessions.swift:54111-54128 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:54052` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (12–13 lines × 2) · ×12
  • Duplicated block (12–13 lines × 2) REDACTED:14208 — REDACTED:14208-14220 | REDACTED:14310-14321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:14208` 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 `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 (12–13 lines × 2) REDACTED:47867 — REDACTED:47867-47879 | REDACTED:48077-48088 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:47867` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3233 — Atria/Atria/AtriaOverviewSections.swift:3233-3244 | Atria/Atria/AtriaSettingsView.swift:2196-2208 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3255 — Atria/Atria/AtriaOverviewSections.swift:3255-3266 | Atria/Atria/AtriaSettingsView.swift:2225-2237 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3346 — Atria/Atria/AtriaOverviewSections.swift:3346-3357 | Atria/Atria/AtriaSettingsView.swift:2383-2395 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3368 — Atria/Atria/AtriaOverviewSections.swift:3368-3379 | Atria/Atria/AtriaSettingsView.swift:2397-2409 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3390 — Atria/Atria/AtriaOverviewSections.swift:3390-3401 | Atria/Atria/AtriaSettingsView.swift:2426-2438 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3432 — Atria/Atria/AtriaOverviewSections.swift:3432-3443 | Atria/Atria/AtriaSettingsView.swift:2440-2452 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3459 — Atria/Atria/AtriaOverviewSections.swift:3459-3470 | Atria/Atria/AtriaSettingsView.swift:2480-2492 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3481 — Atria/Atria/AtriaOverviewSections.swift:3481-3492 | Atria/Atria/AtriaSettingsView.swift:2515-2527 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3533 — Atria/Atria/AtriaOverviewSections.swift:3533-3544 | Atria/Atria/AtriaSettingsView.swift:2354-2366 — 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–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:6426 — Atria/Atria/AtriaOverviewSections.swift:6426-6438 | Atria/Atria/AtriaOverviewSections.swift:6473-6484 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:6426` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Edited copy of a member (20 corresponding lines) · ×11
  • Edited copy of a member (20 corresponding lines) Atria/Atria/HistoricalArchive.swift:9407 — Atria/Atria/HistoricalArchive.swift:9407-9426 | Atria/Atria/HistoricalArchive.swift:9428-9449 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1910 — Atria/Atria/AtriaOverviewSections.swift:1910-1932 | Atria/Atria/AtriaOverviewSections.swift:2473-2492 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaSleepHypnogram.swift:1103 — Atria/Atria/AtriaSleepHypnogram.swift:1103-1122 | Atria/Atria/AtriaSleepHypnogram.swift:1124-1143 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:652 — Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:652-671 | Atria/Atria/AtriaHistoricalLongTermRollup.swift:924-943 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:8029 — Atria/Atria/AtriaOverviewSections.swift:8029-8048 | Atria/Atria/AtriaOverviewSections.swift:8050-8070 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/Sessions.swift:24820 — Atria/Atria/Sessions.swift:24820-24841 | Atria/Atria/Sessions.swift:61915-61934 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/Sessions.swift:48631 — Atria/Atria/Sessions.swift:48631-48651 | Atria/Atria/Sessions.swift:53171-53190 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaStressDetailView.swift:1303 — Atria/Atria/AtriaStressDetailView.swift:1303-1322 | Atria/Atria/AtriaStressDetailView.swift:1338-1364 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaR10Motion.swift:1523 — Atria/Atria/AtriaR10Motion.swift:1523-1548 | Atria/Atria/AtriaR10Motion.swift:1554-1573 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:131 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:131-150 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:159-179 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (20 corresponding lines) Atria/Atria/Sessions.swift:41443 — Atria/Atria/Sessions.swift:41443-41462 | Atria/Atria/Sessions.swift:41464-41487 — These two members are one piece of code written twice and then edited apart: 20 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (22 corresponding lines) · ×11
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaAnalytics.swift:369 — Atria/Atria/AtriaAnalytics.swift:369-392 | Atria/Atria/AtriaAnalytics.swift:612-633 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaStressMonitor.swift:499 — Atria/Atria/AtriaStressMonitor.swift:499-524 | Atria/Atria/AtriaStressMonitor.swift:1215-1236 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaCustomizeSheet.swift:496 — Atria/Atria/AtriaCustomizeSheet.swift:496-519 | Atria/Atria/AtriaOverviewSections.swift:10221-10242 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:426 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:426-447 | Atria/Atria/Sessions.swift:33378-33399 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:930 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:930-951 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3150-3174 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaSleepWakeResearch.swift:1211 — Atria/Atria/AtriaSleepWakeResearch.swift:1211-1232 | Atria/Atria/AtriaSleepWakeResearch.swift:1263-1295 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaAnalytics.swift:1202 — Atria/Atria/AtriaAnalytics.swift:1202-1223 | Atria/Atria/Sessions.swift:27246-27268 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaSleepWakeResearch.swift:283 — Atria/Atria/AtriaSleepWakeResearch.swift:283-304 | Atria/Atria/AtriaSleepWakeResearch.swift:309-333 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaShareCard.swift:1977 — Atria/Atria/AtriaShareCard.swift:1977-1999 | Atria/Atria/AtriaShareCard.swift:2342-2363 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) Atria/Atria/AtriaWhoop4HistoryACKGate.swift:52 — Atria/Atria/AtriaWhoop4HistoryACKGate.swift:52-78 | Atria/Atria/AtriaWhoop4HistoryReadPreflightGate.swift:43-64 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (22 corresponding lines) tools/preflight_reference_csv.py:93 — tools/preflight_reference_csv.py:93-114 | tools/preflight_reference_csv.py:118-139 — These two members are one piece of code written twice and then edited apart: 22 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (21 corresponding lines) · ×11
  • Edited copy of a member (21 corresponding lines) Atria/Atria/Sessions.swift:56357 — Atria/Atria/Sessions.swift:56357-56377 | Atria/Atria/Sessions.swift:56379-56420 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) REDACTED:31852 — REDACTED:31852-31872 | Atria/Atria/AtriaResearchProbe.swift:382-402 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/HealthKitExporter.swift:2017 — Atria/Atria/HealthKitExporter.swift:2017-2037 | Atria/Atria/Sessions.swift:54902-54922 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:708 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:708-729 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:300-320 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/Sessions.swift:1724 — Atria/Atria/Sessions.swift:1724-1746 | Atria/Atria/Sessions.swift:1748-1768 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:600 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:600-624 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:226-246 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) REDACTED:50972 — REDACTED:50972-50992 | REDACTED:51076-51097 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:510 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:510-530 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:661-686 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) REDACTED:6814 — REDACTED:6814-6834 | REDACTED:6836-6865 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/AtriaStressMonitor.swift:1532 — Atria/Atria/AtriaStressMonitor.swift:1532-1552 | Atria/Atria/AtriaStressMonitor.swift:1554-1580 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (21 corresponding lines) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:76 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:76-100 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:492-512 — These two members are one piece of code written twice and then edited apart: 21 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (19 corresponding lines) · ×11
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaExpandedChart.swift:26 — Atria/Atria/AtriaExpandedChart.swift:26-45 | Atria/Atria/AtriaVitalsCollectionSections.swift:205-223 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaManualSleepSheet.swift:675 — Atria/Atria/AtriaManualSleepSheet.swift:675-693 | Atria/Atria/AtriaSettingsView.swift:589-610 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1019 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1019-1037 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1024-1042 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaCustomizeSheet.swift:548 — Atria/Atria/AtriaCustomizeSheet.swift:548-566 | Atria/Atria/AtriaMetricIdentity.swift:32-71 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) REDACTED:24189 — REDACTED:24189-24207 | REDACTED:24254-24277 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/Dashboard.swift:270 — Atria/Atria/Dashboard.swift:270-288 | Atria/Atria/Dashboard.swift:402-424 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaHomeView.swift:11177 — Atria/Atria/AtriaHomeView.swift:11177-11203 | Atria/Atria/AtriaHomeView.swift:11212-11230 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaStressMonitor.swift:636 — Atria/Atria/AtriaStressMonitor.swift:636-654 | Atria/Atria/AtriaStressMonitor.swift:2965-2983 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) validate_hrv.py:85 — validate_hrv.py:85-103 | validate_hrv.py:173-191 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/AtriaTodayScreen.swift:2461 — Atria/Atria/AtriaTodayScreen.swift:2461-2479 | Atria/Atria/AtriaTodayScreen.swift:2486-2504 — These two members are one piece of code written twice and then edited apart: 19 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (19 corresponding lines) Atria/Atria/Sessions.swift:37200 — Atria/Atria/Sessions.swift:37200-37219 | Atria/Atria/Sessions.swift:37517-37535 — 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 · Duplicated block (15 lines × 2) · ×11
  • Duplicated block (15 lines × 2) REDACTED:10748 — REDACTED:10748-10762 | REDACTED:10780-10794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:10748` 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 (15 lines × 2) REDACTED:36133 — REDACTED:36133-36147 | REDACTED:38182-38196 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:36133` 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) Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:531 — Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:531-545 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:570-584 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:531` 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) Atria/Atria/AtriaHomeView.swift:5070 — Atria/Atria/AtriaHomeView.swift:5070-5084 | Atria/Atria/AtriaHomeView.swift:5116-5130 — both copies are in the same file, so extract the 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 (15 lines × 2) Atria/Atria/AtriaOverviewSections.swift:1884 — Atria/Atria/AtriaOverviewSections.swift:1884-1898 | Atria/Atria/AtriaStressDetailView.swift:1105-1119 — 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 `Atria/Atria/AtriaOverviewSections.swift:1884` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaOverviewSections.swift:1882` calls `Spacer` and `Atria/Atria/AtriaStressDetailView.swift:1103` 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 (15 lines × 2) Atria/Atria/Sessions.swift:7955 — Atria/Atria/Sessions.swift:7955-7969 | Atria/Atria/Sessions.swift:7982-7996 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (15 lines × 2) Atria/Atria/Sessions.swift:52152 — Atria/Atria/Sessions.swift:52152-52166 | Atria/Atria/Sessions.swift:52232-52246 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:52152` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/Sessions.swift:52151` calls `Set`, `startOfDay` and `Atria/Atria/Sessions.swift:52230` 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 (15 lines × 2) Atria/Atria/WidgetSnapshot.swift:877 — Atria/Atria/WidgetSnapshot.swift:877-891 | Atria/Atria/WidgetSnapshot.swift:913-927 — both copies are in the same file, so extract the 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 `Atria/Atria/WidgetSnapshot.swift:877` 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) Atria/Atria/Sessions.swift:31499 — Atria/Atria/Sessions.swift:31499-31513 | Atria/Atria/Sessions.swift:31644-31658 — both copies are in the same file, so extract the 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 (15 lines × 2) validate_hrv.py:860 — validate_hrv.py:860-874 | validate_hrv.py:1056-1070 — both copies are in the same file, so extract the 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 `validate_hrv.py:860` 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 (15 lines × 2) tools/verify_hist1_acceptance.py:320 — tools/verify_hist1_acceptance.py:320-334 | tools/verify_hist1_resumable_recovery.py:230-244 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×11
  • Duplicated block (5 lines × 3) Atria/Atria/AtriaHealthScreen.swift:1847 — Atria/Atria/AtriaHealthScreen.swift:1847-1851 | Atria/Atria/AtriaHealthScreen.swift:1858-1862 | Atria/Atria/AtriaVitalsCollectionSections.swift:1411-1415 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 3) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389-393 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:563-567 | Atria/Atria/AtriaStrapCalibrationArchive.swift:700-704 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:389` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 3) Atria/Atria/AtriaHistorySection.swift:954 — Atria/Atria/AtriaHistorySection.swift:954-958 | Atria/Atria/AtriaHomeView.swift:4100-4106 | Atria/Atria/AtriaHomeView.swift:4139-4145 — 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 lines × 3) Atria/Atria/AtriaOverviewSections.swift:217 — Atria/Atria/AtriaOverviewSections.swift:217-221 | Atria/Atria/AtriaOverviewSections.swift:9856-9860 | Atria/Atria/Sessions.swift:59117-59121 — 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 `Atria/Atria/AtriaOverviewSections.swift:217` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
  • Duplicated block (5 lines × 3) Atria/Atria/AtriaR10Motion.swift:100 — Atria/Atria/AtriaR10Motion.swift:100-104 | Atria/Atria/AtriaStrapCalibrationArchive.swift:177-181 | Atria/Atria/AtriaStrapCalibrationArchive.swift:195-199 — 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 lines × 3) Atria/Atria/HRV.swift:555 — Atria/Atria/HRV.swift:555-559 | Atria/Atria/Sessions.swift:32436-32440 | Atria/Atria/Sessions.swift:54844-54848 — 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 (5 lines × 3) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:103 — Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:103-109 | Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:19-23 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:66-72 — before extracting anything, compare `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift` and `Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (5 lines × 3) Atria/Atria/AtriaDiagnosisReport.swift:132 — Atria/Atria/AtriaDiagnosisReport.swift:132-136 | Atria/Atria/AtriaOverviewSections.swift:3947-3951 | Atria/Atria/AtriaOverviewSections.swift:3983-3987 — 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 (5 lines × 3) Atria/Atria/AtriaHomeView.swift:2101 — Atria/Atria/AtriaHomeView.swift:2101-2105 | Atria/Atria/AtriaHomeView.swift:2108-2112 | Atria/Atria/AtriaHomeView.swift:2115-2119 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 3) Atria/Atria/Insights.swift:432 — Atria/Atria/Insights.swift:432-436 | Atria/Atria/Sessions.swift:22711-22715 | Atria/Atria/Sessions.swift:60835-60839 — 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 `Atria/Atria/Insights.swift:432` 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 (5 lines × 3) tools/app_build_provenance.py:34 — tools/app_build_provenance.py:34-38 | tools/v4_morning_acceptance.py:183-187 | tools/verify_physical_qualification.py:223-227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
D17 · Explicit Debt · TodoComment · ×10
  • TodoComment test_handoff_static_checks.py:435 — # TODO(unbuilt spec): docs/23 "Sleep review morning wording checkpoint" (July 1, — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:484 — # TODO(unbuilt spec): reviewProgressRail/reviewProgressStep (the compact — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:517 — # TODO(unbuilt spec): reviewProgressRail (the compact review path meant to sit — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:518 — # before sleepReviewNightArc) was never landed -- see TODO above. No ordering — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:1590 — # TODO(removed feature): the hapticAlerts glance card was deliberately — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:1608 — # TODO(removed feature): the Backfill glance card was dropped along with the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:1626 — # TODO(superseded by consolidation, ac1a820f): pre-merge there were separate — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:1644 — # TODO(removed feature): the Workout glance card was dropped along with the — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:9620 — # TODO(unbuilt spec / superseded): "Health" and "Strap" Today glance cards — source code is not a task system: move the work to your tracker and leave a reference instead (e.g. `# REF: #123`), so the task is planned where tasks live and the ticket links back to the code.
  • TodoComment test_handoff_static_checks.py:10051 — # TODO(unbuilt spec): the original IA-6.1 handoff also named "Health", "Strap",
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×10
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaR10Motion.swift:116 — Atria/Atria/AtriaR10Motion.swift:116-131 | Atria/Atria/AtriaWhoop4CompactIMU.swift:71-90 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/Sessions.swift:53518 — Atria/Atria/Sessions.swift:53518-53533 | Atria/Atria/Sessions.swift:53764-53780 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaAboutMetricSheet.swift:544 — Atria/Atria/AtriaAboutMetricSheet.swift:544-559 | Atria/Atria/AtriaAboutMetricSheet.swift:561-578 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaHistoricalGapLedger.swift:1377 — Atria/Atria/AtriaHistoricalGapLedger.swift:1377-1394 | Atria/Atria/AtriaHistoricalGapLedger.swift:1396-1411 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:37 — Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:37-52 | Atria/Atria/AtriaWhoop4HistoryResearchProtocol.swift:165-182 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:17 — Atria/Atria/AtriaHeroConnectionSections.swift:17-32 | Atria/Atria/AtriaHeroConnectionSections.swift:253-268 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaTodayScreen.swift:215 — Atria/Atria/AtriaTodayScreen.swift:215-233 | Atria/Atria/AtriaVitalsCollectionSections.swift:155-170 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageCoordinator.swift:72 — Atria/Atria/AtriaHistoricalFullDrainCoverageCoordinator.swift:72-89 | Atria/Atria/AtriaHistoricalFullDrainCoverageCoordinator.swift:106-121 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) REDACTED:35780 — REDACTED:35780-35796 | Atria/Atria/Sessions.swift:38175-38190 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (16 corresponding lines) tools/replay_whoop4_day_steps.swift:149 — tools/replay_whoop4_day_steps.swift:149-165 | tools/verify_whoop4_autonomous_step_corpus.swift:459-474 — These two members are one piece of code written twice and then edited apart: 16 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×10
  • Duplicated block (21 lines × 2) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:145 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:145-165 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:96-116 — before extracting anything, compare `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift` and `Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:145` 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 (21 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:409 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:409-429 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:809-829 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) Atria/Atria/AtriaStrapStepLedger.swift:242 — Atria/Atria/AtriaStrapStepLedger.swift:242-262 | Atria/Atria/AtriaStrapStepLedger.swift:299-319 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaStrapStepLedger.swift:242` 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 (21 lines × 2) Atria/Atria/AtriaStressDetailView.swift:1481 — Atria/Atria/AtriaStressDetailView.swift:1481-1501 | Atria/Atria/AtriaVitalsCollectionSections.swift:3275-3295 — 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 `Atria/Atria/AtriaStressDetailView.swift:1481` 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 (21 lines × 2) Atria/Atria/AtriaWidgetDayFence.swift:37 — Atria/Atria/AtriaWidgetDayFence.swift:37-57 | Atria/AtriaWidget/AtriaWidget.swift:149-169 — 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 (21 lines × 2) Atria/Atria/Sessions.swift:21654 — Atria/Atria/Sessions.swift:21654-21674 | Atria/Atria/Sessions.swift:21695-21715 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:21654` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/Sessions.swift:21694` calls `shouldContinue` and `Atria/Atria/Sessions.swift:21653` 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 (21 lines × 2) Atria/Atria/Sessions.swift:22028 — Atria/Atria/Sessions.swift:22028-22048 | Atria/Atria/Sessions.swift:26955-26975 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) Atria/Atria/Sessions.swift:27090 — Atria/Atria/Sessions.swift:27090-27110 | Atria/Atria/Sessions.swift:27139-27159 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:27090` 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 (21 lines × 2) Atria/Atria/Sessions.swift:47770 — Atria/Atria/Sessions.swift:47770-47790 | Atria/Atria/Sessions.swift:47826-47846 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (21 lines × 2) Atria/Atria/Sessions.swift:52092 — Atria/Atria/Sessions.swift:52092-52112 | Atria/Atria/Sessions.swift:52172-52192 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:52092` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D10 · Test Quality · Skipped test · ×9
  • Skipped test: testPacerDutyCyclesOnceTheLeaseIsHeld Atria/AtriaTests/AtriaBackgroundProjectionTests.swift:4145 — Skipped — throws XCTSkip
  • Skipped test: testTheRealTwentySeventhDetects Atria/AtriaTests/AtriaDaytimeQuiescentSleepDetectorTests.swift:235 — Skipped — throws XCTSkip
  • Skipped test: testPreservedJuly27PhysicalWalkProducesBoundedReadyReview Atria/AtriaTests/AtriaDetectedActivityReviewTests.swift:1031 — Skipped — throws XCTSkip
  • Skipped test: testGoldenNightSummaryIsPlausible Atria/AtriaTests/AtriaNightBaselineTests.swift:95 — Skipped — throws XCTSkip
  • Skipped test: testGoldenNightRoundTripsThroughTheBuilder Atria/AtriaTests/AtriaNightMinuteBuilderTests.swift:169 — Skipped — throws XCTSkip
  • Skipped test: testReportedJuly26SleepIsNotHiddenByShortPreludeAcrossLongAwakeGap Atria/AtriaTests/AtriaSleepAuditRegressionTests.swift:1755 — Skipped — throws XCTSkip
  • Skipped test: testTheRealNoWalkEveningIsDetectedAndTheWalkIsNot Atria/AtriaTests/AtriaUnattributedMotionRunsTests.swift:152 — Skipped — throws XCTSkip
  • Skipped test: testMatureRestingBandGuidesWhileHRVIsStillCalibrating Atria/AtriaTests/AtriaWhiteboardCoachSentenceTests.swift:50 — Skipped — throws XCTSkip
  • Skipped test: testRestingOnlyLaneStillCallsAnElevatedRestingHeartRate Atria/AtriaTests/AtriaWhiteboardCoachSentenceTests.swift:75 — Skipped — throws XCTSkip
D4 · Code Duplication · Edited copy of a member (24 corresponding lines) · ×9
  • Edited copy of a member (24 corresponding lines) REDACTED:24292 — REDACTED:24292-24320 | REDACTED:24324-24352 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/AtriaGraphGrammar.swift:754 — Atria/Atria/AtriaGraphGrammar.swift:754-777 | Atria/Atria/AtriaOverviewSections.swift:9050-9079 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/AtriaShareCard.swift:926 — Atria/Atria/AtriaShareCard.swift:926-958 | Atria/Atria/AtriaShareCard.swift:1559-1582 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/Sessions.swift:24795 — Atria/Atria/Sessions.swift:24795-24818 | Atria/Atria/Sessions.swift:56242-56266 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/AtriaBLEConnectedPeripheralRetainer.swift:140 — Atria/Atria/AtriaBLEConnectedPeripheralRetainer.swift:140-163 | Atria/Atria/AtriaBLEConnectedPeripheralRetainer.swift:174-204 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/AtriaOnboardingFlow.swift:854 — Atria/Atria/AtriaOnboardingFlow.swift:854-877 | Atria/Atria/AtriaSettingsView.swift:1425-1452 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) REDACTED:45845 — REDACTED:45845-45868 | REDACTED:45873-45896 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/AtriaOnboardingFlow.swift:1215 — Atria/Atria/AtriaOnboardingFlow.swift:1215-1240 | Atria/Atria/AtriaSmartWakeView.swift:136-159 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (24 corresponding lines) Atria/Atria/Sessions.swift:3125 — Atria/Atria/Sessions.swift:3125-3148 | Atria/Atria/Sessions.swift:6624-6647 — These two members are one piece of code written twice and then edited apart: 24 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (17 corresponding lines) · ×9
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:10244 — Atria/Atria/AtriaOverviewSections.swift:10244-10260 | Atria/Atria/AtriaTrendChart.swift:1488-1509 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:485 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:485-501 | Atria/Atria/AtriaRecoveredMotionAnalytics.swift:503-527 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaShareCard.swift:971 — Atria/Atria/AtriaShareCard.swift:971-987 | Atria/Atria/AtriaShareCard.swift:1080-1096 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/Sessions.swift:2994 — Atria/Atria/Sessions.swift:2994-3010 | Atria/Atria/Sessions.swift:6505-6521 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:187 — Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:187-203 | Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:459-481 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:949 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:949-965 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:999-1017 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:355 — Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:355-371 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:382-399 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) Atria/Atria/AtriaBLEHistoryTransportPhaseFence.swift:131 — Atria/Atria/AtriaBLEHistoryTransportPhaseFence.swift:131-147 | Atria/Atria/AtriaBLEHistoryTransportPhaseFence.swift:149-170 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (17 corresponding lines) tools/strap-mac/ff_sweep.py:133 — tools/strap-mac/ff_sweep.py:133-151 | tools/strap-mac/r10r11_probe.py:80-96 — These two members are one piece of code written twice and then edited apart: 17 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (3 corresponding lines) · ×9
  • Edited copy of a member (3 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:4550 — Atria/Atria/AtriaActivityMonitor.swift:4550-4552 | Atria/Atria/AtriaHomeView.swift:4583-4585 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) Atria/Atria/AtriaWorkoutReviewSheet.swift:417 — Atria/Atria/AtriaWorkoutReviewSheet.swift:417-419 | Atria/Atria/Sessions.swift:4292-4294 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) Atria/Atria/AtriaSyncHealth.swift:86 — Atria/Atria/AtriaSyncHealth.swift:86-88 | Atria/Atria/Insights.swift:239-242 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) REDACTED:31908 — REDACTED:31908-31910 | Atria/Atria/Sessions.swift:56785-56787 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) Atria/Atria/AtriaWeeklyPlan.swift:400 — Atria/Atria/AtriaWeeklyPlan.swift:400-402 | Atria/Atria/AtriaWeeklyReport.swift:231-233 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) Atria/Atria/AtriaNightTimelineLoader.swift:13 — Atria/Atria/AtriaNightTimelineLoader.swift:13-15 | Atria/Atria/AtriaSleepHypnogram.swift:155-157 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) Atria/Atria/AtriaBehaviorImpact.swift:167 — Atria/Atria/AtriaBehaviorImpact.swift:167-169 | Atria/Atria/AtriaOverviewSections.swift:8980-8982 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) tools/analyze_sleep_store.py:62 — tools/analyze_sleep_store.py:62-64 | tools/analyze_workout_store.py:133-135 — These two members are one piece of code written twice and then edited apart: 3 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 (3 corresponding lines) tools/strap-mac/r10_capture.py:204 — tools/strap-mac/r10_capture.py:204-206 | tools/strap-mac/r10r11_probe.py:197-199 — These two members are one piece of code written twice and then edited apart: 3 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Duplicated block (17 lines × 2) · ×9
  • Duplicated block (17 lines × 2) REDACTED:39338 — REDACTED:39338-39354 | REDACTED:39385-39401 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) Atria/Atria/AtriaColdSessionMigration.swift:521 — Atria/Atria/AtriaColdSessionMigration.swift:521-537 | Atria/Atria/AtriaColdSessionMigration.swift:574-590 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaColdSessionMigration.swift:521` 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 (17 lines × 2) Atria/Atria/HistoricalArchive.swift:4806 — Atria/Atria/HistoricalArchive.swift:4806-4822 | Atria/Atria/HistoricalArchive.swift:5060-5076 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17 lines × 2) Atria/Atria/Sessions.swift:18530 — Atria/Atria/Sessions.swift:18530-18546 | Atria/Atria/Sessions.swift:18841-18857 — both copies are in the same file, so extract the 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 (17 lines × 2) Atria/Atria/Sessions.swift:29039 — Atria/Atria/Sessions.swift:29039-29055 | Atria/Atria/Sessions.swift:29195-29211 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:29039` 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 (17 lines × 2) Atria/Atria/AtriaOverviewSections.swift:222 — Atria/Atria/AtriaOverviewSections.swift:222-238 | Atria/Atria/AtriaOverviewSections.swift:9861-9877 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:222` 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 lines × 2) Atria/Atria/AtriaShareCard.swift:1857 — Atria/Atria/AtriaShareCard.swift:1857-1873 | Atria/Atria/AtriaShareCard.swift:1875-1891 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:1857` 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) Atria/Atria/AtriaStressDetailView.swift:1442 — Atria/Atria/AtriaStressDetailView.swift:1442-1458 | Atria/Atria/AtriaStressDetailView.swift:1764-1780 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaStressDetailView.swift:1442` 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) tools/evaluate_recovery_model.py:108 — tools/evaluate_recovery_model.py:108-124 | tools/evaluate_sensor_decoder.py:109-125 — before extracting anything, compare `tools/evaluate_recovery_model.py` and `tools/evaluate_sensor_decoder.py` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–10 lines × 2) · ×9
  • Duplicated block (9–10 lines × 2) Atria/Atria/AtriaHomeView.swift:13878 — Atria/Atria/AtriaHomeView.swift:13878-13887 | Atria/Atria/WidgetSnapshot.swift:2798-2806 — 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 `Atria/Atria/AtriaHomeView.swift:13878` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) Atria/Atria/AtriaStrengthSetLogging.swift:292 — Atria/Atria/AtriaStrengthSetLogging.swift:292-301 | Atria/Atria/AtriaStrengthSetLogging.swift:312-320 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaStrengthSetLogging.swift:292` 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–10 lines × 2) Atria/Atria/AtriaStressMonitor.swift:3807 — Atria/Atria/AtriaStressMonitor.swift:3807-3816 | Atria/Atria/AtriaStressMonitor.swift:4122-4130 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–10 lines × 2) Atria/Atria/Sessions.swift:22416 — Atria/Atria/Sessions.swift:22416-22424 | Atria/Atria/Sessions.swift:22545-22554 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) Atria/Atria/Sessions.swift:27491 — Atria/Atria/Sessions.swift:27491-27500 | Atria/Atria/Sessions.swift:27587-27595 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:27491` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. 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–10 lines × 2) Atria/Atria/Sessions.swift:46406 — Atria/Atria/Sessions.swift:46406-46415 | Atria/Atria/Sessions.swift:46788-46796 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:46406` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–10 lines × 2) Atria/Atria/Sessions.swift:47354 — Atria/Atria/Sessions.swift:47354-47362 | Atria/Atria/Sessions.swift:47511-47520 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (9–10 lines × 2) Atria/Atria/Sessions.swift:48372 — Atria/Atria/Sessions.swift:48372-48380 | Atria/Atria/Sessions.swift:48464-48473 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:48372` 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 (9–10 lines × 2) tools/run_hist1_resumable_recovery.py:249 — tools/run_hist1_resumable_recovery.py:249-258 | tools/run_hist1_resumable_recovery.py:285-293 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×9
  • Duplicated block (7 lines × 3) Atria/Atria/AtriaNotificationCategories.swift:314 — Atria/Atria/AtriaNotificationCategories.swift:314-320 | Atria/Atria/LocalNotificationScheduler.swift:381-387 | Atria/Atria/LocalNotificationScheduler.swift:499-505 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `now` to `Date` in one and `Date = Date()` 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 × 3) Atria/Atria/AtriaOverviewSections.swift:1866 — Atria/Atria/AtriaOverviewSections.swift:1866-1872 | Atria/Atria/AtriaOverviewSections.swift:2509-2515 | Atria/Atria/AtriaStressDetailView.swift:1091-1097 — 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 `Atria/Atria/AtriaOverviewSections.swift:1866` 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, `Atria/Atria/AtriaOverviewSections.swift:1876` calls `Spacer` and `Atria/Atria/AtriaStressDetailView.swift:1101` 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 (7 lines × 3) Atria/Atria/AtriaStrengthProgress.swift:352 — Atria/Atria/AtriaStrengthProgress.swift:352-358 | Atria/Atria/AtriaStrengthSetLogging.swift:51-57 | Atria/Atria/AtriaStrengthSetLogging.swift:60-66 — 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. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (7 lines × 3) Atria/Atria/Sessions.swift:44914 — Atria/Atria/Sessions.swift:44914-44920 | Atria/Atria/Sessions.swift:44988-44994 | Atria/Atria/Sessions.swift:45051-45057 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 3) Atria/Atria/AtriaNightTimelineView.swift:326 — Atria/Atria/AtriaNightTimelineView.swift:326-332 | Atria/Atria/AtriaStressDetailView.swift:1707-1713 | Atria/Atria/HRV.swift:608-614 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaNightTimelineView.swift:326` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaNightTimelineView.swift:323` calls `chartXScale`, `chartYScale`, `chartXAxis` and `Atria/Atria/HRV.swift:607` 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 (7 lines × 3) Atria/Atria/ActiveSessionJournal.swift:66 — Atria/Atria/ActiveSessionJournal.swift:66-72 | Atria/Atria/AtriaBreathworkSession.swift:97-103 | Atria/Atria/Sessions.swift:1565-1571 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Note first that the copies are not typed on the same thing: the declarations holding them bind `t` to `Date` in one and `Double` 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 × 3) tools/dump_imu_samples.swift:19 — tools/dump_imu_samples.swift:19-25 | tools/fit_step_calibration.swift:464-470 | tools/replay_step_calibration.swift:31-37 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) tools/analyze_historical_archive.py:39 — tools/analyze_historical_archive.py:39-45 | tools/analyze_historical_usability.py:38-44 | tools/analyze_sleep_store.py:36-42 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once.
  • Duplicated block (7 lines × 3) tools/evaluate_activity_classifier.py:57 — tools/evaluate_activity_classifier.py:57-63 | tools/evaluate_overnight_load_model.py:71-77 | tools/evaluate_recovery_model.py:68-74 — before extracting anything, compare `tools/evaluate_activity_classifier.py` and `tools/evaluate_overnight_load_model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (6–7 lines × 2) · ×9
  • Duplicated block (6–7 lines × 2) Atria/Atria/AtriaAboutMetricSheet.swift:319 — Atria/Atria/AtriaAboutMetricSheet.swift:319-324 | Atria/Atria/AtriaOverviewSections.swift:6932-6938 — 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 `Atria/Atria/AtriaAboutMetricSheet.swift:319` 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 (6–7 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:5360 — Atria/Atria/AtriaActivityMonitor.swift:5360-5365 | Atria/Atria/AtriaStressDetailView.swift:1456-1462 — 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 `Atria/Atria/AtriaActivityMonitor.swift:5360` 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 (6–7 lines × 2) REDACTED:30498 — REDACTED:30498-30504 | REDACTED:30561-30566 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:30498` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–7 lines × 2) Atria/Atria/AtriaHistoricalActivityProjection.swift:509 — Atria/Atria/AtriaHistoricalActivityProjection.swift:509-515 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:269-274 — 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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:509` 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 (6–7 lines × 2) Atria/Atria/AtriaTodayScreen.swift:57 — Atria/Atria/AtriaTodayScreen.swift:57-62 | Atria/Atria/Sessions.swift:10341-10347 — 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 `Atria/Atria/AtriaTodayScreen.swift:57` 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 (6–7 lines × 2) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2000 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2000-2006 | Atria/Atria/HistoricalArchive.swift:3638-3643 — 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 `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2000` 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–7 lines × 2) Atria/Atria/Sessions.swift:23993 — Atria/Atria/Sessions.swift:23993-23998 | Atria/Atria/Sessions.swift:24074-24080 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) Atria/Atria/Sessions.swift:52784 — Atria/Atria/Sessions.swift:52784-52790 | Atria/Atria/Sessions.swift:52819-52824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (6–7 lines × 2) tools/app_build_provenance.py:229 — tools/app_build_provenance.py:229-234 | tools/app_build_provenance.py:269-275 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Edited copy of a member (32 corresponding lines) · ×8
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:469 — Atria/Atria/AtriaHeroConnectionSections.swift:469-500 | Atria/Atria/AtriaHomeView.swift:8405-8436 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/Sessions.swift:16562 — Atria/Atria/Sessions.swift:16562-16593 | Atria/Atria/Sessions.swift:16595-16629 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaAnalytics.swift:484 — Atria/Atria/AtriaAnalytics.swift:484-518 | Atria/Atria/AtriaAnalytics.swift:520-551 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:359 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:359-390 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:411-442 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaSleepWakeResearch.swift:1101 — Atria/Atria/AtriaSleepWakeResearch.swift:1101-1132 | Atria/Atria/AtriaSleepWakeResearch.swift:1176-1207 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaVitalsCollectionSections.swift:1820 — Atria/Atria/AtriaVitalsCollectionSections.swift:1820-1856 | Atria/Atria/AtriaVitalsCollectionSections.swift:1945-1976 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/AtriaVitalsCollectionSections.swift:4387 — Atria/Atria/AtriaVitalsCollectionSections.swift:4387-4421 | Atria/Atria/AtriaVitalsCollectionSections.swift:4429-4460 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (32 corresponding lines) Atria/Atria/Sessions.swift:16133 — Atria/Atria/Sessions.swift:16133-16164 | Atria/Atria/Sessions.swift:16166-16201 — These two members are one piece of code written twice and then edited apart: 32 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 7+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:462 — Atria/Atria/AtriaRecoveredHeartRateProjection.swift:462-473 | Atria/Atria/AtriaStressMonitor.swift:1888-1894 | Atria/Atria/Sessions.swift:21471-21480 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/Insights.swift:430 — Atria/Atria/Insights.swift:430-436 | Atria/Atria/Sessions.swift:22709-22715 | Atria/Atria/Sessions.swift:60828-60839 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/AtriaHistoricalActivityProjection.swift:790 — Atria/Atria/AtriaHistoricalActivityProjection.swift:790-798 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:952-958 | Atria/Atria/AtriaStrapCalibrationArchive.swift:666-674 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/AtriaAppIntents.swift:139 — Atria/Atria/AtriaAppIntents.swift:139-150 | Atria/Atria/AtriaVitalsCollectionSections.swift:3038-3048 | Atria/Atria/Sessions.swift:62416-62422 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:147 — Atria/Atria/AtriaFullFidelityColdSessionStore.swift:147-153 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:65-72 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:75-86 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:173 — Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:173-180 | REDACTED:32782-32788 | Atria/Atria/AtriaStrapPowerPolicy.swift:530-537 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) prepare_reference_rr.py:51 — prepare_reference_rr.py:51-60 | tools/replay_sensor_reference.py:191-197 | validate_hrv.py:68-74 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 7+ corresponding lines) tools/strap-mac/ff_sweep.py:159 — tools/strap-mac/ff_sweep.py:159-165 | tools/strap-mac/r10r11_probe.py:105-112 | tools/strap-mac/session.py:153-160 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 6+ corresponding lines) · ×8
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/Sessions.swift:2382 — Atria/Atria/Sessions.swift:2382-2388 | Atria/Atria/Sessions.swift:8225-8230 | Atria/Atria/Sessions.swift:56691-56696 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/AtriaHomeView.swift:8645 — Atria/Atria/AtriaHomeView.swift:8645-8650 | Atria/Atria/AtriaLiveWorkoutView.swift:3501-3511 | Atria/AtriaWidget/AtriaWidget.swift:2881-2889 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) REDACTED:52803 — REDACTED:52803-52808 | Atria/Atria/Sessions.swift:24787-24793 | Atria/Atria/Sessions.swift:56750-56755 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/AtriaHealthScreen.swift:1846 — Atria/Atria/AtriaHealthScreen.swift:1846-1851 | Atria/Atria/AtriaHealthScreen.swift:1857-1862 | Atria/Atria/AtriaVitalsCollectionSections.swift:1410-1415 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/AtriaColdSessionStore.swift:374 — Atria/Atria/AtriaColdSessionStore.swift:374-381 | Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:455-462 | Atria/Atria/AtriaWhoop4HistoricalOrphanVault.swift:284-289 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/AtriaCycleTracking.swift:129 — Atria/Atria/AtriaCycleTracking.swift:129-135 | Atria/Atria/AtriaJournalStore.swift:110-115 | Atria/Atria/AtriaMorningCheckIn.swift:214-220 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:538 — Atria/Atria/AtriaHeroConnectionSections.swift:538-543 | Atria/Atria/AtriaSharedUIComponents.swift:206-211 | Atria/Atria/AtriaStrapScreen.swift:447-453 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 6+ corresponding lines) tools/strap-mac/flush_probe.py:88 — tools/strap-mac/flush_probe.py:88-93 | tools/strap-mac/night_capture.py:109-114 | tools/strap-mac/r10_capture.py:147-153 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (25 corresponding lines) · ×7
  • Edited copy of a member (25 corresponding lines) Atria/Atria/AtriaAboutMetricSheet.swift:312 — Atria/Atria/AtriaAboutMetricSheet.swift:312-336 | Atria/Atria/AtriaOverviewSections.swift:6925-6949 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:10847 — Atria/Atria/AtriaOverviewSections.swift:10847-10877 | Atria/Atria/AtriaTrendChart.swift:921-945 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Atria/Atria/AtriaNightTimelineView.swift:339 — Atria/Atria/AtriaNightTimelineView.swift:339-373 | Atria/Atria/AtriaNightTimelineView.swift:376-400 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) REDACTED:31687 — REDACTED:31687-31711 | REDACTED:31713-31737 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Atria/Atria/Sessions.swift:42064 — Atria/Atria/Sessions.swift:42064-42091 | Atria/Atria/Sessions.swift:42093-42117 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Atria/Atria/AtriaAnalytics.swift:2229 — Atria/Atria/AtriaAnalytics.swift:2229-2258 | Atria/Atria/Sessions.swift:22171-22195 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (25 corresponding lines) Atria/Atria/AtriaWhoop4HistoryACKGate.swift:85 — Atria/Atria/AtriaWhoop4HistoryACKGate.swift:85-121 | Atria/Atria/AtriaWhoop4HistoryReadPreflightGate.swift:69-93 — These two members are one piece of code written twice and then edited apart: 25 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 4+ corresponding lines) · ×7
  • Edited copies of one member (3 members, 4+ corresponding lines) Atria/Atria/ActiveSessionJournal.swift:1550 — Atria/Atria/ActiveSessionJournal.swift:1550-1553 | Atria/Atria/AtriaBLEEvidence.swift:232-235 | Atria/Atria/AtriaStrapCalibrationArchive.swift:676-680 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Atria/Atria/AtriaHistoricalAggregateReader.swift:860 — Atria/Atria/AtriaHistoricalAggregateReader.swift:860-863 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:694-697 | Atria/Atria/AtriaWhoop4HistoricalOrphanVault.swift:247-250 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:370 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:370-373 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:419-424 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:445-448 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) Atria/Atria/AtriaLiveActivityLockPreview.swift:107 — Atria/Atria/AtriaLiveActivityLockPreview.swift:107-110 | Atria/Atria/AtriaLiveWorkoutView.swift:3368-3371 | Atria/Atria/AtriaStrengthSetLogging.swift:69-72 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) tools/analyze_sleep_store.py:116 — tools/analyze_sleep_store.py:116-121 | tools/analyze_sleep_store.py:125-128 | tools/analyze_sleep_store.py:132-135 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) tools/verify_gate2_release_artifacts.py:60 — tools/verify_gate2_release_artifacts.py:60-63 | tools/verify_hist1_acceptance.py:89-92 | tools/verify_hist1_resumable_recovery.py:58-61 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 4+ corresponding lines) tools/app_build_provenance.py:144 — tools/app_build_provenance.py:144-147 | tools/run_hist1_resumable_recovery.py:44-47 | tools/v4_morning_acceptance.py:202-205 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (22 lines × 2) · ×7
  • Duplicated block (22 lines × 2) Atria/Atria/AtriaIMUDiagnosticTransport.swift:446 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:446-467 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:1412-1433 — both copies are in the same file, so extract the 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, `Atria/Atria/AtriaIMUDiagnosticTransport.swift:445` calls `isSoftwareResetRequested` and `Atria/Atria/AtriaIMUDiagnosticTransport.swift:1411` 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 (22 lines × 2) Atria/Atria/AtriaWorkoutOnset.swift:28 — Atria/Atria/AtriaWorkoutOnset.swift:28-49 | Atria/Atria/AtriaWorkoutOnset.swift:88-109 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWorkoutOnset.swift:28` 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 (22 lines × 2) Atria/Atria/Sessions.swift:27654 — Atria/Atria/Sessions.swift:27654-27675 | Atria/Atria/Sessions.swift:27798-27819 — both copies are in the same file, so extract the 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 (22 lines × 2) Atria/Atria/Sessions.swift:37245 — Atria/Atria/Sessions.swift:37245-37266 | Atria/Atria/Sessions.swift:37547-37568 — both copies are in the same file, so extract the 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 (22 lines × 2) Atria/Atria/Sessions.swift:31879 — Atria/Atria/Sessions.swift:31879-31900 | Atria/Atria/Sessions.swift:49400-49421 — both copies are in the same file, so extract the 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 (22 lines × 2) validate_hrv.py:810 — validate_hrv.py:810-831 | validate_hrv.py:1025-1046 — both copies are in the same file, so extract the 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 `validate_hrv.py:810` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (22 lines × 2) tools/fit_step_calibration.swift:664 — tools/fit_step_calibration.swift:664-685 | tools/replay_step_calibration.swift:522-543 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×7
  • Duplicated block (20 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:4900 — Atria/Atria/AtriaActivityMonitor.swift:4900-4919 | Atria/Atria/AtriaActivityMonitor.swift:4924-4943 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaActivityMonitor.swift:4900` 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 (20 lines × 2) REDACTED:57694 — REDACTED:57694-57713 | REDACTED:57773-57792 — both copies are in the same file, so extract the 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) Atria/Atria/AtriaHistoricalActivityProjection.swift:455 — Atria/Atria/AtriaHistoricalActivityProjection.swift:455-474 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:709-728 — 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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:455` 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 (20 lines × 2) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:612 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:612-631 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:724-743 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:612` 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 (20 lines × 2) Atria/Atria/AtriaHistoricalRetentionTransaction.swift:355 — Atria/Atria/AtriaHistoricalRetentionTransaction.swift:355-374 | Atria/Atria/AtriaHistoricalRetentionTransaction.swift:392-411 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalRetentionTransaction.swift:355` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaHistoricalRetentionTransaction.swift:391` calls `decodeManifest` and `Atria/Atria/AtriaHistoricalRetentionTransaction.swift:353` 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 (20 lines × 2) Atria/Atria/Sessions.swift:18609 — Atria/Atria/Sessions.swift:18609-18628 | Atria/Atria/Sessions.swift:18642-18661 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:18609` 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 (20 lines × 2) Atria/Atria/Sessions.swift:53426 — Atria/Atria/Sessions.swift:53426-53445 | Atria/Atria/Sessions.swift:53621-53640 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10–12 lines × 2) · ×7
  • Duplicated block (10–12 lines × 2) Atria/Atria/AtriaColdSessionMigration.swift:135 — Atria/Atria/AtriaColdSessionMigration.swift:135-144 | Atria/Atria/AtriaColdSessionMigration.swift:426-437 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaColdSessionMigration.swift:135` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:395 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:395-406 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:434-443 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (10–12 lines × 2) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:466 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:466-477 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:638-647 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:466` 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. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10–12 lines × 2) Atria/Atria/AtriaShareCard.swift:1622 — Atria/Atria/AtriaShareCard.swift:1622-1633 | Atria/Atria/AtriaShareCard.swift:2044-2053 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:1622` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaShareCard.swift:1634` calls `UUID` and `Atria/Atria/AtriaShareCard.swift:2054` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–12 lines × 2) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1747 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1747-1758 | Atria/Atria/HistoricalArchive.swift:4174-4183 — 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 `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1747` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–12 lines × 2) Atria/Atria/Sessions.swift:15059 — Atria/Atria/Sessions.swift:15059-15070 | Atria/Atria/Sessions.swift:16543-16552 — both copies are in the same file, so extract the 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–12 lines × 2) tools/replay_whoop4_day_steps.swift:64 — tools/replay_whoop4_day_steps.swift:64-73 | tools/verify_whoop4_autonomous_step_corpus.swift:346-357 — before extracting anything, compare `tools/replay_whoop4_day_steps.swift` and `tools/verify_whoop4_autonomous_step_corpus.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/replay_whoop4_day_steps.swift:64` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/verify_whoop4_autonomous_step_corpus.swift:344` calls `min`, `max` and `tools/replay_whoop4_day_steps.swift:63` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×6
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Atria/Atria/AtriaAboutMetricSheet.swift:57 — Atria/Atria/AtriaAboutMetricSheet.swift:57-70 | Atria/Atria/AtriaAboutMetricSheet.swift:88-101 | Atria/Atria/AtriaAboutMetricSheet.swift:122-145 | Atria/Atria/AtriaAboutMetricSheet.swift:164-209 | Atria/Atria/AtriaAboutMetricSheet.swift:211-240 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Atria/Atria/AtriaActivityMonitor.swift:5335 — Atria/Atria/AtriaActivityMonitor.swift:5335-5446 | Atria/Atria/AtriaHealthScreen.swift:3284-3475 | Atria/Atria/AtriaStressDetailView.swift:1442-1616 | Atria/Atria/AtriaStressDetailView.swift:1764-1840 | Atria/Atria/AtriaVitalsCollectionSections.swift:3249-3381 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Atria/Atria/AtriaSleepWakeResearch.swift:8 — Atria/Atria/AtriaSleepWakeResearch.swift:8-55 | Atria/Atria/AtriaSleepWakeResearch.swift:57-99 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1057-1280 | Atria/Atria/Sessions.swift:2055-2104 | Atria/Atria/Sessions.swift:56701-56748 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/evaluate_activity_classifier.py:226 — tools/evaluate_activity_classifier.py:226-244 | tools/evaluate_overnight_load_model.py:197-212 | tools/evaluate_recovery_model.py:214-230 | tools/evaluate_sensor_decoder.py:237-253 | tools/validate_research_corpus.py:288-302 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/strap-mac/ff_sweep.py:60 — tools/strap-mac/ff_sweep.py:60-64 | tools/strap-mac/pairing_6a.py:29-33 | tools/strap-mac/pairing_window.py:28-32 | tools/strap-mac/r10_capture.py:67-71 | tools/strap-mac/r10r11_probe.py:47-51 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
  • Members sharing a duplicated core (5 members, 50+ identical tokens) tools/strap-mac/ff_sweep.py:229 — tools/strap-mac/ff_sweep.py:229-243 | tools/strap-mac/flush_probe.py:241-255 | tools/strap-mac/night_capture.py:301-315 | tools/strap-mac/r10_capture.py:218-232 | tools/strap-mac/r10r11_probe.py:216-231 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Edited copy of a member (31 corresponding lines) · ×6
  • Edited copy of a member (31 corresponding lines) Atria/Atria/AtriaColdSessionStore.swift:185 — Atria/Atria/AtriaColdSessionStore.swift:185-218 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:753-783 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Atria/Atria/AtriaSleepWakeResearch.swift:1069 — Atria/Atria/AtriaSleepWakeResearch.swift:1069-1099 | Atria/Atria/AtriaSleepWakeResearch.swift:1297-1327 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:532 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:532-564 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:566-596 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:482 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:482-512 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:880-910 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) Atria/Atria/AtriaHomeView.swift:2263 — Atria/Atria/AtriaHomeView.swift:2263-2293 | Atria/Atria/AtriaWorkoutRuntime.swift:612-644 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (31 corresponding lines) REDACTED:37678 — REDACTED:37678-37708 | REDACTED:37756-37787 — These two members are one piece of code written twice and then edited apart: 31 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (28 corresponding lines) · ×6
  • Edited copy of a member (28 corresponding lines) Atria/Atria/HealthKitExporter.swift:1497 — Atria/Atria/HealthKitExporter.swift:1497-1525 | Atria/Atria/HealthKitExporter.swift:1536-1563 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Atria/Atria/Sessions.swift:54050 — Atria/Atria/Sessions.swift:54050-54077 | Atria/Atria/Sessions.swift:54109-54136 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Atria/Atria/AtriaCivilDayStepAuthority.swift:204 — Atria/Atria/AtriaCivilDayStepAuthority.swift:204-234 | Atria/Atria/AtriaCivilDayStepAuthority.swift:261-288 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Atria/Atria/AtriaHistorySection.swift:1342 — Atria/Atria/AtriaHistorySection.swift:1342-1372 | Atria/Atria/AtriaOverviewSections.swift:2569-2596 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Atria/Atria/AtriaStressMonitor.swift:2462 — Atria/Atria/AtriaStressMonitor.swift:2462-2493 | Atria/Atria/AtriaStressMonitor.swift:2495-2522 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (28 corresponding lines) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:835 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:835-863 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:865-892 — These two members are one piece of code written twice and then edited apart: 28 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (23 corresponding lines) · ×6
  • Edited copy of a member (23 corresponding lines) Atria/Atria/Sessions.swift:34907 — Atria/Atria/Sessions.swift:34907-34929 | Atria/Atria/Sessions.swift:34956-34981 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Atria/Atria/AtriaLiveWorkoutView.swift:3723 — Atria/Atria/AtriaLiveWorkoutView.swift:3723-3745 | Atria/Atria/AtriaLiveWorkoutView.swift:4078-4100 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Atria/Atria/AtriaSettingsView.swift:2562 — Atria/Atria/AtriaSettingsView.swift:2562-2590 | Atria/Atria/AtriaVitalsCollectionSections.swift:2396-2418 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:4897 — Atria/Atria/AtriaActivityMonitor.swift:4897-4919 | Atria/Atria/AtriaActivityMonitor.swift:4921-4943 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) Atria/Atria/AtriaGapWearClassification.swift:47 — Atria/Atria/AtriaGapWearClassification.swift:47-69 | Atria/Atria/AtriaSleepHypnogram.swift:369-396 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (23 corresponding lines) REDACTED:51048 — REDACTED:51048-51070 | REDACTED:51187-51209 — These two members are one piece of code written twice and then edited apart: 23 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 5+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 5+ corresponding lines) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:100 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:100-104 | Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:264-270 | Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:472-476 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Atria/Atria/Sessions.swift:33401 — Atria/Atria/Sessions.swift:33401-33407 | Atria/Atria/Sessions.swift:35393-35397 | Atria/Atria/Sessions.swift:47596-47600 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Atria/Atria/AtriaNightTimelineLoader.swift:166 — Atria/Atria/AtriaNightTimelineLoader.swift:166-170 | Atria/Atria/Sessions.swift:4089-4095 | Atria/Atria/Sessions.swift:4127-4133 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3113 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3113-3118 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3120-3125 | tools/replay_whoop4_compact_steps.swift:107-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) Atria/Atria/AtriaMainThreadWatchdog.swift:35 — Atria/Atria/AtriaMainThreadWatchdog.swift:35-39 | Atria/Atria/AtriaReconnectLeaseTrail.swift:25-30 | Atria/Atria/AtriaWorkoutRoute.swift:928-932 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 5+ corresponding lines) tools/strap-mac/flush_probe.py:145 — tools/strap-mac/flush_probe.py:145-150 | tools/strap-mac/pairing_6a.py:122-128 | tools/strap-mac/r10_capture.py:209-213 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 5 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 3+ corresponding lines) · ×6
  • Edited copies of one member (3 members, 3+ corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:4546 — Atria/Atria/AtriaActivityMonitor.swift:4546-4548 | Atria/Atria/AtriaHomeView.swift:4579-4581 | Atria/Atria/AtriaLiveWorkoutView.swift:2485-2487 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) REDACTED:31919 — REDACTED:31919-31922 | Atria/Atria/AtriaWhoop4CompactIMU.swift:96-98 | Atria/Atria/AtriaWhoop4R10Record.swift:92-94 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Atria/Atria/AtriaR10Motion.swift:133 — Atria/Atria/AtriaR10Motion.swift:133-135 | Atria/Atria/AtriaResearchProbe.swift:323-325 | Atria/Atria/AtriaWhoop4CompactIMU.swift:92-94 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) Atria/Atria/AtriaColdSessionMigration.swift:272 — Atria/Atria/AtriaColdSessionMigration.swift:272-275 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:711-716 | Atria/Atria/AtriaMorningCheckIn.swift:112-114 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) tools/analyze_historical_archive.py:51 — tools/analyze_historical_archive.py:51-53 | tools/analyze_historical_usability.py:50-52 | tools/analyze_sleep_store.py:56-58 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 3+ corresponding lines) tools/strap-mac/overnight_watch.py:86 — tools/strap-mac/overnight_watch.py:86-89 | tools/strap-mac/pairing_6a.py:74-76 | tools/strap-mac/r10r11_probe.py:100-102 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (28 lines × 2) · ×6
  • Duplicated block (28 lines × 2) REDACTED:26878 — REDACTED:26878-26905 | REDACTED:26944-26971 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:26878` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:26876` calls `set` and `REDACTED:26942` 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 (28 lines × 2) REDACTED:28829 — REDACTED:28829-28856 | REDACTED:28877-28904 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:28829` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `peripheral` to `CBPeripheral` in one and `systemConnected` 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 (28 lines × 2) REDACTED:38898 — REDACTED:38898-38925 | REDACTED:38955-38982 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:38898` 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 (28 lines × 2) REDACTED:46782 — REDACTED:46782-46809 | REDACTED:46825-46852 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:46782` 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 (28 lines × 2) Atria/Atria/AtriaHomeView.swift:14872 — Atria/Atria/AtriaHomeView.swift:14872-14899 | Atria/Atria/AtriaHomeView.swift:14903-14930 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHomeView.swift:14872` 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 (28 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainPolicy.swift:111 — Atria/Atria/AtriaWhoop4SacrificialFastDrainPolicy.swift:111-138 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimPolicy.swift:56-83 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (10–11 lines × 2) · ×6
  • Duplicated block (10–11 lines × 2) Atria/Atria/AtriaAnalytics.swift:12 — Atria/Atria/AtriaAnalytics.swift:12-22 | Atria/Atria/AtriaAnalytics.swift:85-94 — both copies are in the same file, so extract the 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–11 lines × 2) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:565 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:565-575 | Atria/Atria/AtriaHistoricalArchiveCatalog.swift:622-631 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalArchiveCatalog.swift:565` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–11 lines × 2) Atria/Atria/Sessions.swift:14001 — Atria/Atria/Sessions.swift:14001-14010 | Atria/Atria/Sessions.swift:14106-14116 — both copies are in the same file, so extract the 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–11 lines × 2) Atria/Atria/Sessions.swift:40526 — Atria/Atria/Sessions.swift:40526-40536 | Atria/Atria/Sessions.swift:40580-40589 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:40526` 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 (10–11 lines × 2) tools/replay_whoop4_compact_steps.swift:16 — tools/replay_whoop4_compact_steps.swift:16-26 | tools/replay_whoop4_day_steps.swift:17-26 — 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 `tools/replay_whoop4_compact_steps.swift:16` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–11 lines × 2) tools/app_build_provenance.py:220 — tools/app_build_provenance.py:220-229 | tools/app_build_provenance.py:254-264 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×6
  • Duplicated block (9 lines × 3) Atria/Atria/AtriaHistorySection.swift:685 — Atria/Atria/AtriaHistorySection.swift:685-693 | Atria/Atria/AtriaHistorySection.swift:1342-1350 | Atria/Atria/AtriaOverviewSections.swift:2569-2577 — 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 `Atria/Atria/AtriaHistorySection.swift:685` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) Atria/Atria/AtriaSleepWakeResearch.swift:70 — Atria/Atria/AtriaSleepWakeResearch.swift:70-78 | Atria/Atria/Sessions.swift:2075-2083 | Atria/Atria/Sessions.swift:56719-56727 — 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 `Atria/Atria/AtriaSleepWakeResearch.swift:70` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 3) Atria/Atria/AtriaVitalsCollectionSections.swift:4300 — Atria/Atria/AtriaVitalsCollectionSections.swift:4300-4308 | Atria/Atria/Sessions.swift:22827-22839 | Atria/Atria/Sessions.swift:23090-23102 — 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 `Atria/Atria/AtriaVitalsCollectionSections.swift:4300` 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 (9 lines × 3) Atria/Atria/HistoricalArchive.swift:10485 — Atria/Atria/HistoricalArchive.swift:10485-10493 | Atria/Atria/HistoricalArchive.swift:10516-10524 | Atria/Atria/HistoricalArchive.swift:10529-10537 — 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 `Atria/Atria/HistoricalArchive.swift:10485` 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 × 3) Atria/Atria/Sessions.swift:33428 — Atria/Atria/Sessions.swift:33428-33436 | Atria/Atria/Sessions.swift:33472-33480 | Atria/Atria/Sessions.swift:34276-34284 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (9 lines × 3) validate_hrv.py:122 — validate_hrv.py:122-130 | validate_hrv.py:149-157 | validate_hrv.py:161-169 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×6
  • Duplicated block (8 lines × 3) REDACTED:28839 — REDACTED:28839-28846 | REDACTED:28887-28894 | REDACTED:29946-29953 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:28839` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8 lines × 3) Atria/Atria/AtriaHistoricalAggregateReader.swift:107 — Atria/Atria/AtriaHistoricalAggregateReader.swift:107-114 | Atria/Atria/AtriaHistoricalAggregateReader.swift:270-277 | Atria/Atria/AtriaHistoricalAggregateReader.swift:540-547 — 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 `Atria/Atria/AtriaHistoricalAggregateReader.swift:107` 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) Atria/Atria/AtriaOverviewSections.swift:1866 — Atria/Atria/AtriaOverviewSections.swift:1866-1873 | Atria/Atria/AtriaSleepPlannerCharts.swift:529-536 | Atria/Atria/AtriaStressDetailView.swift:1091-1098 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaOverviewSections.swift:1866` 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, `Atria/Atria/AtriaOverviewSections.swift:1876` calls `Spacer` and `Atria/Atria/AtriaStressDetailView.swift:1101` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) Atria/Atria/AtriaOverviewSections.swift:1889 — Atria/Atria/AtriaOverviewSections.swift:1889-1896 | Atria/Atria/AtriaSleepPlannerCharts.swift:547-554 | Atria/Atria/AtriaStressDetailView.swift:1110-1117 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaOverviewSections.swift:1889` 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, `Atria/Atria/AtriaSleepPlannerCharts.swift:555` calls `foregroundStyle` and `Atria/Atria/AtriaOverviewSections.swift:1897` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (8 lines × 3) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:729 — Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:729-737 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:819-826 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1314-1323 — 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 `Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:729` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (8 lines × 3) Atria/Atria/AtriaAnalytics.swift:231 — Atria/Atria/AtriaAnalytics.swift:231-238 | Atria/Atria/AtriaAnalytics.swift:563-570 | Atria/Atria/AtriaAnalytics.swift:591-598 — 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 `Atria/Atria/AtriaAnalytics.swift:231` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `greenDelta` to `Double = 1.5` in one and `Double = 0.5` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×6
  • Duplicated block (7–8 lines × 2) Atria/Atria/AtriaAnalytics.swift:44 — Atria/Atria/AtriaAnalytics.swift:44-50 | Atria/Atria/AtriaAnalytics.swift:121-128 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaAnalytics.swift:44` 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–8 lines × 2) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:676 — Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:676-682 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:704-711 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (7–8 lines × 2) Atria/Atria/AtriaManualSleepSheet.swift:87 — Atria/Atria/AtriaManualSleepSheet.swift:87-93 | Atria/Atria/AtriaVitalsCollectionSections.swift:5212-5219 — 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 `Atria/Atria/AtriaManualSleepSheet.swift:87` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:6407 — Atria/Atria/AtriaOverviewSections.swift:6407-6414 | Atria/Atria/AtriaOverviewSections.swift:6456-6462 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:6407` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (7–8 lines × 2) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:671 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:671-678 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1327-1333 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:671` 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 (7–8 lines × 2) tools/fit_step_calibration.swift:187 — tools/fit_step_calibration.swift:187-194 | tools/fit_step_calibration.swift:232-238 — both copies are in the same file, so extract the 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 `tools/fit_step_calibration.swift:187` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×5
  • Edited copy of a member (27 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:212 — Atria/Atria/AtriaOverviewSections.swift:212-238 | Atria/Atria/AtriaOverviewSections.swift:9850-9877 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Atria/Atria/Sessions.swift:54692 — Atria/Atria/Sessions.swift:54692-54718 | Atria/Atria/Sessions.swift:54720-54747 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Atria/Atria/AtriaStressMonitor.swift:3445 — Atria/Atria/AtriaStressMonitor.swift:3445-3475 | Atria/Atria/AtriaStressMonitor.swift:4225-4251 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) Atria/AtriaWidget/AtriaWidget.swift:704 — Atria/AtriaWidget/AtriaWidget.swift:704-739 | Atria/AtriaWidget/AtriaWidget.swift:743-769 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (27 corresponding lines) tools/validate_hr_reference.py:60 — tools/validate_hr_reference.py:60-86 | tools/validate_hrv_reference.py:86-123 — These two members are one piece of code written twice and then edited apart: 27 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (33 corresponding lines) · ×5
  • Edited copy of a member (33 corresponding lines) Atria/Atria/Sessions.swift:9063 — Atria/Atria/Sessions.swift:9063-9095 | Atria/Atria/Sessions.swift:9102-9134 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Atria/AtriaWidget/AtriaWidget.swift:1216 — Atria/AtriaWidget/AtriaWidget.swift:1216-1248 | Atria/AtriaWidget/AtriaWidget.swift:1250-1285 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Atria/Atria/HistoricalArchive.swift:8296 — Atria/Atria/HistoricalArchive.swift:8296-8338 | Atria/Atria/HistoricalArchive.swift:8421-8453 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) REDACTED:44014 — REDACTED:44014-44046 | REDACTED:44053-44099 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (33 corresponding lines) Atria/Atria/AtriaWorkoutRuntime.swift:64 — Atria/Atria/AtriaWorkoutRuntime.swift:64-107 | Atria/Atria/AtriaWorkoutRuntime.swift:112-144 — These two members are one piece of code written twice and then edited apart: 33 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (35 corresponding lines) · ×5
  • Edited copy of a member (35 corresponding lines) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:257 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:257-295 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:295-329 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:449 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:449-483 | Atria/Atria/Sessions.swift:43692-43731 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Atria/AtriaWidget/AtriaWidget.swift:858 — Atria/AtriaWidget/AtriaWidget.swift:858-892 | Atria/AtriaWidget/AtriaWidget.swift:940-974 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Atria/Atria/AtriaHistorySection.swift:432 — Atria/Atria/AtriaHistorySection.swift:432-466 | Atria/Atria/AtriaHistorySection.swift:468-508 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (35 corresponding lines) Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:458 — Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:458-498 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:500-534 — These two members are one piece of code written twice and then edited apart: 35 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 10+ corresponding lines) · ×5
  • Edited copies of one member (3 members, 10+ corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:436 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:436-448 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:625-634 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1359-1372 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Atria/Atria/AtriaHealthScreen.swift:1961 — Atria/Atria/AtriaHealthScreen.swift:1961-1971 | Atria/Atria/AtriaOverviewSections.swift:5294-5303 | Atria/Atria/AtriaTodayScreen.swift:2289-2299 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Atria/Atria/AtriaMetricProvenanceCard.swift:93 — Atria/Atria/AtriaMetricProvenanceCard.swift:93-103 | Atria/Atria/AtriaOverviewSections.swift:8799-8811 | Atria/Atria/AtriaSleepHypnogram.swift:807-816 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) Atria/Atria/AtriaWhoop4CompactIMUCoverageGate.swift:162 — Atria/Atria/AtriaWhoop4CompactIMUCoverageGate.swift:162-171 | Atria/Atria/FrameParser.swift:93-102 | tools/StrapProtocol/Sources/StrapProtocol/FrameCodec.swift:4-13 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 10+ corresponding lines) tools/analyze_gate_e_workout_log.py:22 — tools/analyze_gate_e_workout_log.py:22-33 | tools/analyze_historical_usability.py:150-160 | tools/verify_whoop4_exact_history_transaction.py:54-63 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (14–15 lines × 2) · ×5
  • Duplicated block (14–15 lines × 2) Atria/Atria/AtriaHomeView.swift:13029 — Atria/Atria/AtriaHomeView.swift:13029-13042 | Atria/Atria/WidgetSnapshot.swift:1740-1754 — 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 `Atria/Atria/AtriaHomeView.swift:13029` 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 (14–15 lines × 2) Atria/Atria/Sessions.swift:14089 — Atria/Atria/Sessions.swift:14089-14102 | Atria/Atria/Sessions.swift:14251-14265 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:14089` 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. 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 (14–15 lines × 2) Atria/Atria/Sessions.swift:20908 — Atria/Atria/Sessions.swift:20908-20921 | Atria/Atria/Sessions.swift:20954-20968 — both copies are in the same file, so extract the 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–15 lines × 2) Atria/Atria/Sessions.swift:33424 — Atria/Atria/Sessions.swift:33424-33437 | Atria/Atria/Sessions.swift:33467-33481 — both copies are in the same file, so extract the 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–15 lines × 2) tools/replay_whoop4_day_steps.swift:75 — tools/replay_whoop4_day_steps.swift:75-88 | tools/verify_whoop4_autonomous_step_corpus.swift:360-374 — before extracting anything, compare `tools/replay_whoop4_day_steps.swift` and `tools/verify_whoop4_autonomous_step_corpus.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–11 lines × 2) · ×5
  • Duplicated block (9–11 lines × 2) Atria/Atria/AtriaAnalytics.swift:866 — Atria/Atria/AtriaAnalytics.swift:866-874 | Atria/Atria/AtriaAnalytics.swift:891-901 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaAnalytics.swift:866` 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 (9–11 lines × 2) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:406 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:406-416 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:579-587 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:406` 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. 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) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:438 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:438-448 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:615-623 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:438` 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 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–11 lines × 2) Atria/Atria/AtriaOverviewSections.swift:5738 — Atria/Atria/AtriaOverviewSections.swift:5738-5748 | Atria/Atria/AtriaOverviewSections.swift:5773-5781 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:5738` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9–11 lines × 2) Atria/Atria/Sessions.swift:23592 — Atria/Atria/Sessions.swift:23592-23600 | Atria/Atria/Sessions.swift:23769-23779 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Edited copy of a member (48 corresponding lines) · ×4
  • Edited copy of a member (48 corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:385 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:385-434 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:557-604 — These two members are one piece of code written twice and then edited apart: 48 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 (48 corresponding lines) Atria/Atria/Sessions.swift:33921 — Atria/Atria/Sessions.swift:33921-33978 | Atria/Atria/Sessions.swift:35020-35067 — These two members are one piece of code written twice and then edited apart: 48 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 (48 corresponding lines) Atria/Atria/Sessions.swift:56559 — Atria/Atria/Sessions.swift:56559-56606 | Atria/Atria/Sessions.swift:56608-56663 — These two members are one piece of code written twice and then edited apart: 48 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 (48 corresponding lines) Atria/Atria/AtriaRecoveredRRProjection.swift:620 — Atria/Atria/AtriaRecoveredRRProjection.swift:620-667 | Atria/Atria/HistoricalArchive.swift:9568-9620 — These two members are one piece of code written twice and then edited apart: 48 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 (46 corresponding lines) · ×4
  • Edited copy of a member (46 corresponding lines) Atria/Atria/AtriaAnalytics.swift:256 — Atria/Atria/AtriaAnalytics.swift:256-304 | Atria/Atria/AtriaAnalytics.swift:306-351 — These two members are one piece of code written twice and then edited apart: 46 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 (46 corresponding lines) Atria/AtriaWidget/AtriaWidget.swift:3891 — Atria/AtriaWidget/AtriaWidget.swift:3891-3936 | Atria/AtriaWidget/AtriaWidget.swift:3938-3987 — These two members are one piece of code written twice and then edited apart: 46 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 (46 corresponding lines) Atria/Atria/AtriaHealthScreen.swift:2714 — Atria/Atria/AtriaHealthScreen.swift:2714-2761 | Atria/Atria/AtriaHealthScreen.swift:2763-2808 — These two members are one piece of code written twice and then edited apart: 46 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 (46 corresponding lines) tools/analyze_workout_store.py:594 — tools/analyze_workout_store.py:594-639 | tools/analyze_workout_store.py:643-698 — These two members are one piece of code written twice and then edited apart: 46 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (42 corresponding lines) · ×4
  • Edited copy of a member (42 corresponding lines) Atria/Atria/Sessions.swift:56105 — Atria/Atria/Sessions.swift:56105-56146 | Atria/Atria/Sessions.swift:56148-56189 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) Atria/Atria/Sessions.swift:32637 — Atria/Atria/Sessions.swift:32637-32678 | Atria/Atria/Sessions.swift:32680-32726 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) Atria/Atria/AtriaColdSessionMigration.swift:513 — Atria/Atria/AtriaColdSessionMigration.swift:513-560 | Atria/Atria/AtriaColdSessionMigration.swift:570-611 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (42 corresponding lines) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1932 — Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1932-1973 | Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3062-3103 — These two members are one piece of code written twice and then edited apart: 42 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (36 corresponding lines) · ×4
  • Edited copy of a member (36 corresponding lines) Atria/Atria/AtriaShareCard.swift:1620 — Atria/Atria/AtriaShareCard.swift:1620-1658 | Atria/Atria/AtriaShareCard.swift:2042-2077 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) Atria/Atria/Sessions.swift:28959 — Atria/Atria/Sessions.swift:28959-28998 | Atria/Atria/Sessions.swift:29000-29035 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) REDACTED:51343 — REDACTED:51343-51379 | REDACTED:51381-51416 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (36 corresponding lines) REDACTED:28821 — REDACTED:28821-28856 | REDACTED:28861-28904 — These two members are one piece of code written twice and then edited apart: 36 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 18+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 18+ corresponding lines) Atria/Atria/AtriaStrapCalibrationArchive.swift:174 — Atria/Atria/AtriaStrapCalibrationArchive.swift:174-192 | Atria/Atria/AtriaStrapCalibrationArchive.swift:194-212 | Atria/Atria/AtriaWhoop4CompactIMUCoverageGate.swift:118-135 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:1336 — Atria/Atria/AtriaActivityMonitor.swift:1336-1353 | Atria/Atria/AtriaActivityMonitor.swift:1355-1373 | Atria/Atria/AtriaVitalsCollectionSections.swift:3690-3707 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) Atria/Atria/AtriaWhoop4CompactIMU.swift:534 — Atria/Atria/AtriaWhoop4CompactIMU.swift:534-555 | Atria/Atria/AtriaWhoop4CompactIMU.swift:576-593 | Atria/Atria/AtriaWhoop4CompactIMU.swift:614-632 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 18+ corresponding lines) Atria/Atria/DailyRollupStore.swift:1188 — Atria/Atria/DailyRollupStore.swift:1188-1205 | Atria/Atria/Sessions.swift:29037-29055 | Atria/Atria/Sessions.swift:29193-29211 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 18 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 12+ corresponding lines) · ×4
  • Edited copies of one member (3 members, 12+ corresponding lines) Atria/Atria/AtriaHealthScreen.swift:859 — Atria/Atria/AtriaHealthScreen.swift:859-873 | Atria/Atria/AtriaWidgetOvernightBoard.swift:103-114 | Atria/AtriaWidget/AtriaWidget.swift:301-312 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Atria/Atria/AtriaHomeView.swift:2885 — Atria/Atria/AtriaHomeView.swift:2885-2898 | Atria/Atria/AtriaHomeView.swift:2900-2912 | Atria/Atria/AtriaHomeView.swift:2943-2954 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) Atria/Atria/Sessions.swift:30088 — Atria/Atria/Sessions.swift:30088-30099 | Atria/Atria/Sessions.swift:30105-30119 | Atria/Atria/Sessions.swift:30121-30133 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 12+ corresponding lines) REDACTED:32979 — REDACTED:32979-32994 | Atria/Atria/HistoricalArchive.swift:8957-8968 | Atria/Atria/HistoricalArchive.swift:8970-8981 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 12 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (20–21 lines × 2) · ×4
  • Duplicated block (20–21 lines × 2) REDACTED:41020 — REDACTED:41020-41040 | REDACTED:41562-41581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41020` 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 (20–21 lines × 2) Atria/Atria/HistoricalArchive.swift:3550 — Atria/Atria/HistoricalArchive.swift:3550-3569 | Atria/Atria/HistoricalArchive.swift:3838-3858 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:3550` 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 (20–21 lines × 2) Atria/Atria/HistoricalArchive.swift:5539 — Atria/Atria/HistoricalArchive.swift:5539-5559 | Atria/Atria/HistoricalArchive.swift:5696-5715 — both copies are in the same file, so extract the 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 (20–21 lines × 2) Atria/Atria/Sessions.swift:46283 — Atria/Atria/Sessions.swift:46283-46303 | Atria/Atria/Sessions.swift:47073-47092 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:46305` calls `confirmedSleepRespiratoryRate` and `Atria/Atria/Sessions.swift:47093` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×4
  • Duplicated block (13–14 lines × 2) REDACTED:54166 — REDACTED:54166-54178 | REDACTED:55086-55099 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:55086` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13–14 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:708 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:708-721 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:300-312 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:708` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (13–14 lines × 2) Atria/Atria/Sessions.swift:13874 — Atria/Atria/Sessions.swift:13874-13886 | Atria/Atria/Sessions.swift:13929-13942 — both copies are in the same file, so extract the 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–14 lines × 2) Atria/AtriaWidget/AtriaWidget.swift:726 — Atria/AtriaWidget/AtriaWidget.swift:726-739 | Atria/AtriaWidget/AtriaWidget.swift:757-769 — both copies are in the same file, so extract the 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 `Atria/AtriaWidget/AtriaWidget.swift:726` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/AtriaWidget/AtriaWidget.swift:724` calls `minimumScaleFactor` and `Atria/AtriaWidget/AtriaWidget.swift:756` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10 lines × 4) · ×4
  • Duplicated block (10 lines × 4) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:839 — Atria/Atria/AtriaHistoricalArchiveCatalog.swift:839-848 | Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2408-2417 | Atria/Atria/AtriaHistoricalRetentionTransaction.swift:592-601 | Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:529-538 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (10 lines × 4) Atria/Atria/Sessions.swift:34760 — Atria/Atria/Sessions.swift:34760-34769 | Atria/Atria/Sessions.swift:34841-34850 | Atria/Atria/Sessions.swift:35585-35594 | Atria/Atria/Sessions.swift:36178-36187 — 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.
  • Duplicated block (10 lines × 4) Atria/Atria/Sessions.swift:36441 — Atria/Atria/Sessions.swift:36441-36450 | Atria/Atria/Sessions.swift:44242-44251 | Atria/Atria/Sessions.swift:45260-45269 | Atria/Atria/Sessions.swift:47086-47095 — 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.
  • Duplicated block (10 lines × 4) validate_hrv.py:803 — validate_hrv.py:803-812 | validate_hrv.py:867-876 | validate_hrv.py:1063-1072 | validate_hrv.py:1134-1143 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×4
  • Duplicated block (5 lines × 4) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:481 — Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:481-485 | Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:345-349 | Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:383-387 | Atria/Atria/AtriaHistoricalReplayPayloadCompaction.swift:162-166 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (5 lines × 4) Atria/Atria/AtriaStrainRecoveryComboChart.swift:182 — Atria/Atria/AtriaStrainRecoveryComboChart.swift:182-186 | Atria/Atria/AtriaStressDetailView.swift:1557-1561 | Atria/Atria/AtriaStressDetailView.swift:1816-1820 | Atria/Atria/AtriaVitalsCollectionSections.swift:3328-3332 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaStrainRecoveryComboChart.swift:182` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaStressDetailView.swift:1556` calls `chartXScale` and `Atria/Atria/AtriaStrainRecoveryComboChart.swift:181` 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 (5 lines × 4) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:347 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:347-351 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:387-391 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:982-986 | Atria/Atria/AtriaHistoricalGapLedger.swift:1453-1457 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once.
  • Duplicated block (5 lines × 4) Atria/Atria/Sessions.swift:50112 — Atria/Atria/Sessions.swift:50112-50116 | Atria/Atria/Sessions.swift:52300-52304 | Atria/Atria/Sessions.swift:52357-52361 | Atria/Atria/Sessions.swift:53661-53665 — 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.
D35 · Change Coupling · Change coupling · ×3
  • Change coupling: AtriaCustomizeSheet.swift ↔ AtriaTodayScreen.swift Atria/Atria/AtriaCustomizeSheet.swift:1 — `Atria/Atria/AtriaCustomizeSheet.swift` and `Atria/Atria/AtriaTodayScreen.swift` change together 72% of the time (13 of the 18 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 the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither 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 `9b5ca707` Colour only for data and state: neutral Liquid Glass everywhere else; `c9ad66b0` UI pass: glass cards, no nested card surfaces, bigger numbers, 44pt taps; `135393be` Stop cloning RHR as a Highlights strip under the glass tab. — run `git show` on any of them.
  • Change coupling: AtriaAssistantScreen.swift ↔ AtriaOverviewSections.swift Atria/Atria/AtriaAssistantScreen.swift:1 — `Atria/Atria/AtriaAssistantScreen.swift` and `Atria/Atria/AtriaOverviewSections.swift` change together 64% of the time (7 of the 11 commits that touched whichever of the two files changed less often, counting a file under its earlier names as well — a repo-wide or module-wide sweep is evidence about the sweep rather than about any pair inside it and is left out of BOTH sides of this ratio, while a dependency bump, a formatter/rename sweep, or a commit whose edit to one of the two files was a tool directive such as //go:generate or whitespace only is left out of the shared count ONLY, so the two sides are not taken over identical commit sets). They sit in the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 7 shared commits counted here, the most recent 3 are `ef4a732f` Add morning insights, sync health, Shortcuts and a CI static gate; `c9ad66b0` UI pass: glass cards, no nested card surfaces, bigger numbers, 44pt taps; `7e048d96` One strain number on the weekly report too — run `git show` on any of them.
  • Change coupling: AtriaHeroConnectionSections.swift ↔ AtriaOverviewSections.swift Atria/Atria/AtriaHeroConnectionSections.swift:1 — `Atria/Atria/AtriaHeroConnectionSections.swift` and `Atria/Atria/AtriaOverviewSections.swift` change together 54% of the time (28 of the 52 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 the same directory, and in this ecosystem sibling files there normally share one namespace/package — so a direct reference between them needs no import and this pass cannot see whether one exists. Read the pair before acting: if one file only DECLARES what the other consumes (a constants/types file beside its user), the co-change is definitional and the question is whether the split earns its keep; if they duplicate structure, extract the common part into a shared function or type they both call; if neither holds, the coupling is hidden and worth breaking. You can check this without leaving the row: of the 28 shared commits counted here, the most recent 3 are `c9ad66b0` UI pass: glass cards, no nested card surfaces, bigger numbers, 44pt taps; `8e6ca405` Remove the strain lower-bound marker; finish the dead-view cascade; `4ecc4578` Remove 51 more unreachable View types (2,932 lines) — run `git show` on any of them.
D4 · Code Duplication · Edited copy of a member (40 corresponding lines) · ×3
  • Edited copy of a member (40 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:4554 — Atria/Atria/AtriaActivityMonitor.swift:4554-4595 | Atria/Atria/AtriaHomeView.swift:4512-4551 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) Atria/Atria/Sessions.swift:972 — Atria/Atria/Sessions.swift:972-1014 | Atria/Atria/Sessions.swift:1043-1082 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (40 corresponding lines) Atria/Atria/AtriaShareCard.swift:1936 — Atria/Atria/AtriaShareCard.swift:1936-1975 | Atria/Atria/AtriaShareCard.swift:2287-2340 — These two members are one piece of code written twice and then edited apart: 40 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (39 corresponding lines) · ×3
  • Edited copy of a member (39 corresponding lines) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:215 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:215-253 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:220-262 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) REDACTED:26741 — REDACTED:26741-26779 | REDACTED:26781-26827 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (39 corresponding lines) tools/analyze_historical_2f.py:644 — tools/analyze_historical_2f.py:644-682 | tools/analyze_historical_usability.py:231-273 — These two members are one piece of code written twice and then edited apart: 39 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (29 corresponding lines) · ×3
  • Edited copy of a member (29 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:959 — Atria/Atria/AtriaActivityMonitor.swift:959-987 | Atria/Atria/AtriaActivityMonitor.swift:989-1026 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Atria/Atria/DailyRollupStore.swift:243 — Atria/Atria/DailyRollupStore.swift:243-273 | Atria/Atria/DailyRollupStore.swift:275-303 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (29 corresponding lines) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:431 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:431-459 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:831-859 — These two members are one piece of code written twice and then edited apart: 29 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 25+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 25+ corresponding lines) Atria/Atria/AtriaOverviewSections.swift:2254 — Atria/Atria/AtriaOverviewSections.swift:2254-2278 | Atria/Atria/AtriaOverviewSections.swift:2284-2308 | Atria/Atria/AtriaOverviewSections.swift:2314-2338 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 25+ corresponding lines) Atria/Atria/AtriaHeroConnectionSections.swift:1025 — Atria/Atria/AtriaHeroConnectionSections.swift:1025-1049 | Atria/Atria/AtriaHeroConnectionSections.swift:1087-1114 | Atria/Atria/AtriaVitalsCollectionSections.swift:5143-5174 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 25+ corresponding lines) Atria/Atria/Sessions.swift:27653 — Atria/Atria/Sessions.swift:27653-27677 | Atria/Atria/Sessions.swift:27797-27821 | Atria/Atria/Sessions.swift:27850-27882 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 25 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 16+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 16+ corresponding lines) Atria/Atria/AtriaHighlights.swift:45 — Atria/Atria/AtriaHighlights.swift:45-60 | Atria/Atria/AtriaHighlights.swift:62-80 | Atria/Atria/AtriaHighlights.swift:82-104 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Atria/Atria/AtriaFaceOff.swift:92 — Atria/Atria/AtriaFaceOff.swift:92-109 | Atria/Atria/AtriaRoutineCard.swift:221-238 | Atria/Atria/AtriaWeeklyReport.swift:125-140 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 16+ corresponding lines) Atria/Atria/AtriaShareCard.swift:2979 — Atria/Atria/AtriaShareCard.swift:2979-2998 | Atria/Atria/AtriaShareCard.swift:3019-3034 | Atria/Atria/AtriaShareCard.swift:3057-3074 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 16 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 14+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 14+ corresponding lines) Atria/Atria/AtriaGraphInspector.swift:146 — Atria/Atria/AtriaGraphInspector.swift:146-159 | Atria/Atria/AtriaVitalsCollectionSections.swift:3634-3654 | Atria/Atria/AtriaVitalsCollectionSections.swift:4867-4882 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) REDACTED:3777 — REDACTED:3777-3791 | REDACTED:3796-3809 | REDACTED:3813-3828 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 14+ corresponding lines) Atria/Atria/AtriaIMUDiagnosticTransport.swift:622 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:622-635 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:637-650 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:666-679 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 14 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 8+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 8+ corresponding lines) Atria/Atria/AtriaStrengthProgress.swift:351 — Atria/Atria/AtriaStrengthProgress.swift:351-358 | Atria/Atria/AtriaStrengthSetLogging.swift:50-57 | Atria/Atria/AtriaStrengthSetLogging.swift:59-66 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Atria/Atria/AtriaHealthScreen.swift:1868 — Atria/Atria/AtriaHealthScreen.swift:1868-1876 | Atria/Atria/AtriaOverviewSections.swift:1816-1823 | Atria/Atria/AtriaOverviewSections.swift:2540-2547 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 8+ corresponding lines) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1994 — Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1994-2002 | Atria/Atria/Sessions.swift:2126-2133 | Atria/Atria/Sessions.swift:61106-61113 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 11+ corresponding lines) · ×3
  • Edited copies of one member (3 members, 11+ corresponding lines) Atria/Atria/AtriaAnalytics.swift:865 — Atria/Atria/AtriaAnalytics.swift:865-876 | Atria/Atria/AtriaAnalytics.swift:878-888 | Atria/Atria/AtriaAnalytics.swift:890-903 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) REDACTED:32599 — REDACTED:32599-32614 | REDACTED:32616-32629 | Atria/Atria/AtriaStressMonitor.swift:3213-3223 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 11+ corresponding lines) Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:320 — Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:320-330 | Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:344-356 | REDACTED:29082-29094 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 11 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (23 lines × 2) · ×3
  • Duplicated block (23 lines × 2) Atria/Atria/AtriaOverviewSections.swift:9731 — Atria/Atria/AtriaOverviewSections.swift:9731-9753 | Atria/Atria/AtriaSmartWakeView.swift:325-347 — 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 `Atria/Atria/AtriaOverviewSections.swift:9731` 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 (23 lines × 2) Atria/AtriaWidget/AtriaWidget.swift:3048 — Atria/AtriaWidget/AtriaWidget.swift:3048-3070 | Atria/AtriaWidget/AtriaWidget.swift:3129-3151 — both copies are in the same file, so extract the 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 `Atria/AtriaWidget/AtriaWidget.swift:3048` 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 (23 lines × 2) tools/analyze_historical_2f.py:319 — tools/analyze_historical_2f.py:319-341 | tools/analyze_historical_2f.py:432-454 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) REDACTED:16282 — REDACTED:16282-16300 | REDACTED:16326-16344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (19 lines × 2) REDACTED:26758 — REDACTED:26758-26776 | REDACTED:26803-26821 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:26758` 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 lines × 2) Atria/Atria/Sessions.swift:38363 — Atria/Atria/Sessions.swift:38363-38381 | Atria/Atria/Sessions.swift:43123-43141 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–19 lines × 2) · ×3
  • Duplicated block (18–19 lines × 2) Atria/Atria/AtriaShareCard.swift:1952 — Atria/Atria/AtriaShareCard.swift:1952-1970 | Atria/Atria/AtriaShareCard.swift:2590-2607 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:1952` 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 (18–19 lines × 2) Atria/Atria/Sessions.swift:23284 — Atria/Atria/Sessions.swift:23284-23302 | Atria/Atria/Sessions.swift:23396-23413 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (18–19 lines × 2) tools/analyze_workout_store.py:622 — tools/analyze_workout_store.py:622-639 | tools/analyze_workout_store.py:680-698 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–18 lines × 2) · ×3
  • Duplicated block (15–18 lines × 2) REDACTED:41814 — REDACTED:41814-41831 | REDACTED:42241-42255 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41814` 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 (15–18 lines × 2) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:332 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:332-349 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:507-521 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:332` 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–18 lines × 2) Atria/Atria/AtriaShareCard.swift:2774 — Atria/Atria/AtriaShareCard.swift:2774-2791 | Atria/Atria/AtriaShareCard.swift:2817-2831 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:2774` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×3
  • Duplicated block (17–18 lines × 2) REDACTED:52198 — REDACTED:52198-52214 | REDACTED:52269-52286 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:52198` 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–18 lines × 2) Atria/Atria/AtriaPendingSleepReviewStore.swift:73 — Atria/Atria/AtriaPendingSleepReviewStore.swift:73-90 | Atria/Atria/AtriaPendingSleepReviewStore.swift:136-152 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaPendingSleepReviewStore.swift:73` 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 (17–18 lines × 2) Atria/Atria/Sessions.swift:33442 — Atria/Atria/Sessions.swift:33442-33458 | Atria/Atria/Sessions.swift:33494-33511 — both copies are in the same file, so extract the 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, `Atria/Atria/Sessions.swift:33466` calls `confirmWorkoutWindowForUIAsync` and `Atria/Atria/Sessions.swift:33512` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (17 lines × 3) · ×3
  • Duplicated block (17 lines × 3) Atria/Atria/AtriaSleepWakeResearch.swift:81 — Atria/Atria/AtriaSleepWakeResearch.swift:81-97 | Atria/Atria/Sessions.swift:2086-2102 | Atria/Atria/Sessions.swift:56730-56746 — 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 `Atria/Atria/AtriaSleepWakeResearch.swift:81` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (17 lines × 3) Atria/Atria/Sessions.swift:18608 — Atria/Atria/Sessions.swift:18608-18624 | Atria/Atria/Sessions.swift:18641-18657 | Atria/Atria/Sessions.swift:18680-18696 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (17 lines × 3) Atria/Atria/Sessions.swift:33806 — Atria/Atria/Sessions.swift:33806-33822 | Atria/Atria/Sessions.swift:34242-34258 | Atria/Atria/Sessions.swift:34553-34569 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (14 lines × 3) · ×3
  • Duplicated block (14 lines × 3) REDACTED:26550 — REDACTED:26550-26563 | REDACTED:26609-26622 | REDACTED:26626-26639 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `REDACTED:26566` calls `beginStalledStreamRepair` and `REDACTED:26626` 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 (14 lines × 3) Atria/Atria/AtriaShareCard.swift:1962 — Atria/Atria/AtriaShareCard.swift:1962-1975 | Atria/Atria/AtriaShareCard.swift:2327-2340 | Atria/Atria/AtriaShareCard.swift:2599-2612 — 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 `Atria/Atria/AtriaShareCard.swift:1962` 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 × 3) Atria/Atria/HistoricalArchive.swift:8656 — Atria/Atria/HistoricalArchive.swift:8656-8669 | Atria/Atria/HistoricalArchive.swift:8750-8763 | Atria/Atria/HistoricalArchive.swift:8806-8820 — 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 `Atria/Atria/HistoricalArchive.swift:8656` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10–13 lines × 2) · ×3
  • Duplicated block (10–13 lines × 2) REDACTED:51348 — REDACTED:51348-51360 | REDACTED:51383-51392 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:51348` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10–13 lines × 2) Atria/Atria/AtriaOverviewSections.swift:9340 — Atria/Atria/AtriaOverviewSections.swift:9340-9349 | Atria/Atria/AtriaOverviewSections.swift:9350-9362 — both copies are in the same file, so extract the 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–13 lines × 2) Atria/Atria/Sessions.swift:21373 — Atria/Atria/Sessions.swift:21373-21382 | Atria/Atria/Sessions.swift:21435-21447 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:21435` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×3
  • Duplicated block (12 lines × 3) REDACTED:14209 — REDACTED:14209-14221 | REDACTED:14311-14322 | REDACTED:14396-14407 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:14209` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (12 lines × 3) Atria/Atria/AtriaShareCard.swift:1699 — Atria/Atria/AtriaShareCard.swift:1699-1710 | Atria/Atria/AtriaShareCard.swift:2106-2117 | Atria/Atria/AtriaShareCard.swift:2482-2493 — 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 `Atria/Atria/AtriaShareCard.swift:1699` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 3) tools/audit_handoff_status.py:90 — tools/audit_handoff_status.py:90-101 | tools/monitor_long_wear.py:322-333 | tools/prepare_accessibility_performance_evidence.py:34-45 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–12 lines × 2) · ×3
  • Duplicated block (9–12 lines × 2) Atria/Atria/AtriaEventNotificationScheduler.swift:294 — Atria/Atria/AtriaEventNotificationScheduler.swift:294-305 | Atria/Atria/LocalNotificationScheduler.swift:2303-2311 — 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 `Atria/Atria/AtriaEventNotificationScheduler.swift:294` 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 (9–12 lines × 2) Atria/Atria/Sessions.swift:21362 — Atria/Atria/Sessions.swift:21362-21370 | Atria/Atria/Sessions.swift:21408-21419 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:21408` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (9–12 lines × 2) Atria/Atria/Sessions.swift:49816 — Atria/Atria/Sessions.swift:49816-49824 | Atria/Atria/Sessions.swift:49837-49848 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:49816` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (11 lines × 3) · ×3
  • Duplicated block (11 lines × 3) Atria/Atria/AtriaVitalsCollectionSections.swift:3330 — Atria/Atria/AtriaVitalsCollectionSections.swift:3330-3340 | Atria/Atria/AtriaVitalsCollectionSections.swift:4813-4823 | Atria/Atria/AtriaVitalsCollectionSections.swift:4832-4842 — 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 `Atria/Atria/AtriaVitalsCollectionSections.swift:3330` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (11 lines × 3) Atria/Atria/HistoricalArchive.swift:10204 — Atria/Atria/HistoricalArchive.swift:10204-10214 | Atria/Atria/HistoricalArchive.swift:10344-10354 | Atria/Atria/HistoricalArchive.swift:10355-10365 — 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 `Atria/Atria/HistoricalArchive.swift:10204` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (11 lines × 3) Atria/Atria/Sessions.swift:34912 — Atria/Atria/Sessions.swift:34912-34922 | Atria/Atria/Sessions.swift:34961-34971 | Atria/Atria/Sessions.swift:35002-35012 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (6–9 lines × 2) · ×3
  • Duplicated block (6–9 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:2808 — Atria/Atria/AtriaActivityMonitor.swift:2808-2813 | Atria/Atria/AtriaWorkoutReviewSheet.swift:301-309 — 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 `Atria/Atria/AtriaActivityMonitor.swift:2808` 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 (6–9 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:2914 — Atria/Atria/AtriaActivityMonitor.swift:2914-2919 | Atria/Atria/AtriaActivityMonitor.swift:5427-5435 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaActivityMonitor.swift:2914` 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 (6–9 lines × 2) Atria/Atria/Sessions.swift:30799 — Atria/Atria/Sessions.swift:30799-30804 | Atria/Atria/Sessions.swift:30825-30833 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note first that the copies are not typed on the same thing: the declarations holding them bind `calendar` to `Calendar` in one and `Calendar = .current` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (8–9 lines × 2) · ×3
  • Duplicated block (8–9 lines × 2) Atria/Atria/AtriaHealthScreen.swift:524 — Atria/Atria/AtriaHealthScreen.swift:524-531 | Atria/Atria/AtriaHealthScreen.swift:1937-1945 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHealthScreen.swift:524` 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 (8–9 lines × 2) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:427 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:427-435 | Atria/Atria/Sessions.swift:33379-33386 — 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 `Atria/Atria/AtriaRecoveredMotionAnalytics.swift:427` 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 (8–9 lines × 2) Atria/Atria/HealthKitExporter.swift:1139 — Atria/Atria/HealthKitExporter.swift:1139-1147 | Atria/Atria/HealthKitExporter.swift:1811-1818 — both copies are in the same file, so extract the 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 `Atria/Atria/HealthKitExporter.swift:1139` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×3
  • Duplicated block (6–8 lines × 2) Atria/Atria/AtriaOverviewSections.swift:9622 — Atria/Atria/AtriaOverviewSections.swift:9622-9627 | Atria/Atria/AtriaOverviewSections.swift:9651-9658 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:9622` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6–8 lines × 2) Atria/Atria/AtriaWhoop4MotionTickSequenceReducer.swift:51 — Atria/Atria/AtriaWhoop4MotionTickSequenceReducer.swift:51-58 | Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:448-453 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (6–8 lines × 2) Atria/Atria/Sessions.swift:43517 — Atria/Atria/Sessions.swift:43517-43524 | Atria/Atria/Sessions.swift:43964-43969 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:43517` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Near-duplicate member pair (48 shared lines) · ×2
  • Near-duplicate member pair (48 shared lines) Atria/Atria/Sessions.swift:23992 — Atria/Atria/Sessions.swift:23992-24071 | Atria/Atria/Sessions.swift:24073-24186 — These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
  • Near-duplicate member pair (48 shared lines) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:141 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:141-213 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:88-163 — These two members are variants of one another: 48 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×2
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:291 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:291-307 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:265-281 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1039-1055 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1044-1066 | Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:55-93 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:569-609 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Atria/Atria/Sessions.swift:13571 — Atria/Atria/Sessions.swift:13571-13604 | Atria/Atria/Sessions.swift:13609-13643 | Atria/Atria/Sessions.swift:14105-14267 | Atria/Atria/Sessions.swift:23465-23541 | Atria/Atria/Sessions.swift:23591-23766 | Atria/Atria/Sessions.swift:23768-23975 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Edited copy of a member (38 corresponding lines) · ×2
  • Edited copy of a member (38 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:6404 — Atria/Atria/AtriaOverviewSections.swift:6404-6441 | Atria/Atria/AtriaOverviewSections.swift:6449-6487 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (38 corresponding lines) Atria/Atria/Sessions.swift:19375 — Atria/Atria/Sessions.swift:19375-19412 | Atria/Atria/Sessions.swift:19414-19451 — These two members are one piece of code written twice and then edited apart: 38 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (44 corresponding lines) · ×2
  • Edited copy of a member (44 corresponding lines) Atria/Atria/AtriaOverviewSections.swift:1611 — Atria/Atria/AtriaOverviewSections.swift:1611-1654 | Atria/Atria/AtriaTodayScreen.swift:4704-4748 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (44 corresponding lines) Atria/Atria/LocalNotificationScheduler.swift:174 — Atria/Atria/LocalNotificationScheduler.swift:174-225 | Atria/Atria/LocalNotificationScheduler.swift:227-270 — These two members are one piece of code written twice and then edited apart: 44 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 28+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 28+ corresponding lines) Atria/Atria/AtriaLearnedInsights.swift:524 — Atria/Atria/AtriaLearnedInsights.swift:524-551 | Atria/Atria/AtriaLearnedInsights.swift:598-636 | Atria/Atria/AtriaLearnedInsights.swift:638-667 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 28+ corresponding lines) Atria/Atria/AtriaHistoricalActivityProjection.swift:252 — Atria/Atria/AtriaHistoricalActivityProjection.swift:252-285 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:279-306 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:308-335 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 28 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (26 corresponding lines) · ×2
  • Edited copy of a member (26 corresponding lines) Atria/Atria/AtriaLearnedInsightsBoard.swift:152 — Atria/Atria/AtriaLearnedInsightsBoard.swift:152-177 | Atria/Atria/AtriaLearnedInsightsBoard.swift:245-273 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
  • Edited copy of a member (26 corresponding lines) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:225 — Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:225-250 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:252-277 — These two members are one piece of code written twice and then edited apart: 26 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (34 corresponding lines) · ×2
  • Edited copy of a member (34 corresponding lines) Atria/Atria/AtriaShareCard.swift:2760 — Atria/Atria/AtriaShareCard.swift:2760-2795 | Atria/Atria/AtriaShareCard.swift:2805-2838 — These two members are one piece of code written twice and then edited apart: 34 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 (34 corresponding lines) Atria/Atria/HistoricalArchive.swift:8083 — Atria/Atria/HistoricalArchive.swift:8083-8116 | Atria/Atria/HistoricalArchive.swift:8501-8537 — These two members are one piece of code written twice and then edited apart: 34 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 21+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 21+ corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:484 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:484-514 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:668-688 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1395-1418 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 21+ corresponding lines) Atria/Atria/HistoricalArchive.swift:4468 — Atria/Atria/HistoricalArchive.swift:4468-4489 | Atria/Atria/HistoricalArchive.swift:4495-4517 | Atria/Atria/HistoricalArchive.swift:5766-5786 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 22+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 22+ corresponding lines) REDACTED:37567 — REDACTED:37567-37593 | REDACTED:37655-37676 | REDACTED:37733-37754 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 22+ corresponding lines) REDACTED:37609 — REDACTED:37609-37630 | REDACTED:37632-37653 | REDACTED:37710-37731 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 22 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 7+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 7+ corresponding lines) Atria/Atria/AtriaHomeView.swift:767 — Atria/Atria/AtriaHomeView.swift:767-773 | Atria/Atria/AtriaHomeView.swift:4839-4847 | Atria/Atria/AtriaStepsWeekChart.swift:394-400 | Atria/Atria/AtriaWorkoutMetricPresentation.swift:170-176 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 7+ corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:3440 — Atria/Atria/AtriaActivityMonitor.swift:3440-3446 | Atria/Atria/AtriaActivityMonitor.swift:4834-4840 | Atria/Atria/AtriaSameDayMainSleepSheet.swift:131-137 | Atria/Atria/AtriaSharedUIComponents.swift:789-796 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 7 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 6+ corresponding lines) · ×2
  • Edited copies of one member (4 members, 6+ corresponding lines) Atria/Atria/AtriaHomeView.swift:2091 — Atria/Atria/AtriaHomeView.swift:2091-2098 | Atria/Atria/AtriaHomeView.swift:2100-2105 | Atria/Atria/AtriaHomeView.swift:2107-2112 | Atria/Atria/AtriaHomeView.swift:2114-2119 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
  • Edited copies of one member (4 members, 6+ corresponding lines) tools/audit_handoff_status.py:692 — tools/audit_handoff_status.py:692-701 | tools/compare_hist1_analytics.py:21-26 | tools/v4_morning_acceptance.py:20-27 | tools/verify_hist1_acceptance.py:33-40 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 6 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 9+ corresponding lines) · ×2
  • Edited copies of one member (3 members, 9+ corresponding lines) Atria/Atria/AtriaOverviewSections.swift:5409 — Atria/Atria/AtriaOverviewSections.swift:5409-5417 | Atria/Atria/AtriaOverviewSections.swift:5427-5436 | Atria/Atria/AtriaOverviewSections.swift:5438-5446 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
  • Edited copies of one member (3 members, 9+ corresponding lines) Atria/Atria/AtriaRecoveredMotionProjection.swift:425 — Atria/Atria/AtriaRecoveredMotionProjection.swift:425-433 | Atria/Atria/AtriaRecoveredMotionProjection.swift:435-443 | Atria/Atria/Sessions.swift:29217-29229 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 9 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 3+ corresponding lines) · ×2
  • Edited copies of one member (5 members, 3+ corresponding lines) Atria/Atria/AtriaBLEReadOnlyHistoryCapture.swift:150 — Atria/Atria/AtriaBLEReadOnlyHistoryCapture.swift:150-155 | Atria/Atria/AtriaR10Motion.swift:137-142 | Atria/Atria/AtriaWhoop4CompactIMU.swift:100-105 | Atria/Atria/AtriaWhoop4HistoricalIngressSpool.swift:403-406 | Atria/Atria/AtriaWhoop4R10Record.swift:96-98 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
  • Edited copies of one member (5 members, 3+ corresponding lines) REDACTED:31832 — REDACTED:31832-31834 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:1898-1900 | Atria/Atria/AtriaWhoop4HistoryArchivePipeline.swift:283-285 | Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:731-733 | Atria/Atria/HistoricalArchive.swift:9540-9542 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×2
  • Duplicated block (31 lines × 2) Atria/Atria/HistoricalArchive.swift:10146 — Atria/Atria/HistoricalArchive.swift:10146-10176 | Atria/Atria/HistoricalArchive.swift:10292-10322 — both copies are in the same file, so extract the 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 (31 lines × 2) tools/replay_whoop4_day_steps.swift:33 — tools/replay_whoop4_day_steps.swift:33-63 | tools/verify_whoop4_autonomous_step_corpus.swift:312-342 — before extracting anything, compare `tools/replay_whoop4_day_steps.swift` and `tools/verify_whoop4_autonomous_step_corpus.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/verify_whoop4_autonomous_step_corpus.swift:344` calls `min`, `max` and `tools/replay_whoop4_day_steps.swift:64` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (30 lines × 2) · ×2
  • Duplicated block (30 lines × 2) Atria/Atria/Sessions.swift:32641 — Atria/Atria/Sessions.swift:32641-32670 | Atria/Atria/Sessions.swift:32689-32718 — both copies are in the same file, so extract the 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 (30 lines × 2) Atria/Atria/HealthKitExporter.swift:1986 — Atria/Atria/HealthKitExporter.swift:1986-2015 | Atria/Atria/Sessions.swift:54871-54900 — 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 `Atria/Atria/HealthKitExporter.swift:1986` 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 first that the copies are not typed on the same thing: the declarations holding them bind `reference` to `[HRReferencePoint]` in one and `[ExternalHRSample]` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (26–27 lines × 2) · ×2
  • Duplicated block (26–27 lines × 2) REDACTED:13332 — REDACTED:13332-13357 | REDACTED:16972-16998 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (26–27 lines × 2) Atria/Atria/Sessions.swift:15267 — Atria/Atria/Sessions.swift:15267-15293 | Atria/Atria/Sessions.swift:15302-15327 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:15267` 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.
D4 · Code Duplication · Duplicated block (27 lines × 2) · ×2
  • Duplicated block (27 lines × 2) REDACTED:26284 — REDACTED:26284-26310 | REDACTED:26347-26373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:26284` 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 (27 lines × 2) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:341 — Atria/Atria/AtriaFullFidelityColdSessionStore.swift:341-367 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:523-549 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaFullFidelityColdSessionStore.swift:341` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaFullFidelityColdSessionStore.swift:339` calls `UInt64`, `max` and `Atria/Atria/AtriaFullFidelityColdSessionStore.swift:522` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (25–27 lines × 2) · ×2
  • Duplicated block (25–27 lines × 2) Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:297 — Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:297-323 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:389-413 — both copies are in the same file, so extract the 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 (25–27 lines × 2) Atria/Atria/AtriaRecoveredMotionProjection.swift:374 — Atria/Atria/AtriaRecoveredMotionProjection.swift:374-398 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1237-1263 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (26 lines × 2) · ×2
  • Duplicated block (26 lines × 2) Atria/Atria/Sessions.swift:22000 — Atria/Atria/Sessions.swift:22000-22025 | Atria/Atria/Sessions.swift:27110-27135 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (26 lines × 2) validate_hrv.py:760 — validate_hrv.py:760-785 | validate_hrv.py:1075-1100 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (21–22 lines × 2) · ×2
  • Duplicated block (21–22 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:967 — Atria/Atria/AtriaActivityMonitor.swift:967-987 | Atria/Atria/AtriaActivityMonitor.swift:1005-1026 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaActivityMonitor.swift:967` 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 (21–22 lines × 2) Atria/Atria/AtriaNightTimelineView.swift:352 — Atria/Atria/AtriaNightTimelineView.swift:352-373 | Atria/Atria/AtriaNightTimelineView.swift:380-400 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaNightTimelineView.swift:352` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–22 lines × 2) · ×2
  • Duplicated block (17–22 lines × 2) Atria/Atria/Sessions.swift:24026 — Atria/Atria/Sessions.swift:24026-24047 | Atria/Atria/Sessions.swift:24136-24152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (17–22 lines × 2) Atria/Atria/Sessions.swift:33066 — Atria/Atria/Sessions.swift:33066-33087 | Atria/Atria/Sessions.swift:33218-33234 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:33066` 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.
D4 · Code Duplication · Duplicated block (16–21 lines × 2) · ×2
  • Duplicated block (16–21 lines × 2) Atria/Atria/AtriaHistoricalActivityProjection.swift:476 — Atria/Atria/AtriaHistoricalActivityProjection.swift:476-496 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:838-853 — 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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:476` 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 (16–21 lines × 2) Atria/Atria/Sessions.swift:4170 — Atria/Atria/Sessions.swift:4170-4185 | Atria/Atria/Sessions.swift:4223-4243 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:4170` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×2
  • Duplicated block (18–20 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:461 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:461-480 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:861-878 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (18–20 lines × 2) Atria/Atria/Sessions.swift:23310 — Atria/Atria/Sessions.swift:23310-23329 | Atria/Atria/Sessions.swift:23423-23440 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:23310` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×2
  • Duplicated block (19–20 lines × 2) Atria/Atria/AtriaHistorySection.swift:447 — Atria/Atria/AtriaHistorySection.swift:447-466 | Atria/Atria/AtriaHistorySection.swift:490-508 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaHistorySection.swift:447` 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 (19–20 lines × 2) Atria/Atria/Sessions.swift:41551 — Atria/Atria/Sessions.swift:41551-41570 | Atria/Atria/Sessions.swift:41638-41656 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×2
  • Duplicated block (19 lines × 3) Atria/Atria/Sessions.swift:18637 — Atria/Atria/Sessions.swift:18637-18655 | Atria/Atria/Sessions.swift:18676-18694 | Atria/Atria/Sessions.swift:18749-18767 — 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 `Atria/Atria/Sessions.swift:18637` 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 lines × 3) Atria/Atria/Sessions.swift:56079 — Atria/Atria/Sessions.swift:56079-56097 | Atria/Atria/Sessions.swift:56122-56140 | Atria/Atria/Sessions.swift:56166-56184 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (15–19 lines × 2) · ×2
  • Duplicated block (15–19 lines × 2) Atria/Atria/AtriaAnalytics.swift:1118 — Atria/Atria/AtriaAnalytics.swift:1118-1136 | Atria/Atria/AtriaAnalytics.swift:1184-1198 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaAnalytics.swift:1118` 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–19 lines × 2) Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:79 — Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:79-93 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:591-609 — before extracting anything, compare `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift` and `Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 54 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:79` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×2
  • Duplicated block (16–18 lines × 2) Atria/Atria/HistoricalArchive.swift:2459 — Atria/Atria/HistoricalArchive.swift:2459-2476 | Atria/Atria/HistoricalArchive.swift:2570-2585 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:2459` 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–18 lines × 2) tools/replay_whoop4_compact_steps.swift:90 — tools/replay_whoop4_compact_steps.swift:90-105 | tools/replay_whoop4_day_steps.swift:130-147 — 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 `tools/replay_whoop4_compact_steps.swift:90` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/replay_whoop4_compact_steps.swift:88` calls `min`, `max` and `tools/replay_whoop4_day_steps.swift:129` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×2
  • Duplicated block (15–17 lines × 2) REDACTED:41600 — REDACTED:41600-41616 | REDACTED:42030-42044 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41600` 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 (15–17 lines × 2) Atria/Atria/Sessions.swift:22397 — Atria/Atria/Sessions.swift:22397-22413 | Atria/Atria/Sessions.swift:22525-22539 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16–17 lines × 2) · ×2
  • Duplicated block (16–17 lines × 2) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:192 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:192-207 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:143-159 — before extracting anything, compare `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift` and `Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 62 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:192` 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) Atria/Atria/Sessions.swift:37161 — Atria/Atria/Sessions.swift:37161-37177 | Atria/Atria/Sessions.swift:37180-37195 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (15–16 lines × 2) · ×2
  • Duplicated block (15–16 lines × 2) REDACTED:39233 — REDACTED:39233-39248 | REDACTED:39272-39286 — both copies are in the same file, so extract the 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 (15–16 lines × 2) Atria/Atria/Sessions.swift:14065 — Atria/Atria/Sessions.swift:14065-14080 | Atria/Atria/Sessions.swift:14226-14240 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:14065` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×2
  • Duplicated block (14–16 lines × 2) Atria/Atria/AtriaLearnedInsights.swift:423 — Atria/Atria/AtriaLearnedInsights.swift:423-438 | Atria/Atria/AtriaLearnedInsights.swift:463-476 — both copies are in the same file, so extract the 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, `Atria/Atria/AtriaLearnedInsights.swift:439` calls `hourText`, `hours` and `Atria/Atria/AtriaLearnedInsights.swift:477` 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 (14–16 lines × 2) Atria/Atria/AtriaOverviewSections.swift:189 — Atria/Atria/AtriaOverviewSections.swift:189-204 | Atria/Atria/AtriaOverviewSections.swift:9830-9843 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:189` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 5) · ×2
  • Duplicated block (13–14 lines × 5) Atria/Atria/AtriaSleepWakeResearch.swift:39 — Atria/Atria/AtriaSleepWakeResearch.swift:39-51 | Atria/Atria/AtriaSleepWakeResearch.swift:84-96 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1216-1229 | Atria/Atria/Sessions.swift:2089-2101 | Atria/Atria/Sessions.swift:56733-56745 — there are 5 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 5 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaSleepWakeResearch.swift:39` 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 (13–14 lines × 5) Atria/Atria/Sessions.swift:13582 — Atria/Atria/Sessions.swift:13582-13594 | Atria/Atria/Sessions.swift:13621-13634 | Atria/Atria/Sessions.swift:14172-14185 | Atria/Atria/Sessions.swift:23725-23737 | Atria/Atria/Sessions.swift:23924-23936 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–14 lines × 3) · ×2
  • Duplicated block (13–14 lines × 3) REDACTED:46781 — REDACTED:46781-46794 | REDACTED:46824-46837 | REDACTED:46858-46870 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:46781` 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 (13–14 lines × 3) Atria/Atria/Sessions.swift:27658 — Atria/Atria/Sessions.swift:27658-27670 | Atria/Atria/Sessions.swift:27802-27814 | Atria/Atria/Sessions.swift:27860-27873 — 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 `Atria/Atria/Sessions.swift:27658` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–13 lines × 3) · ×2
  • Duplicated block (10–13 lines × 3) Atria/Atria/AtriaDeviceUseJournal.swift:167 — Atria/Atria/AtriaDeviceUseJournal.swift:167-176 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:931-940 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3151-3163 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaDeviceUseJournal.swift:167` 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 (10–13 lines × 3) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2968 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2968-2979 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3047-3059 | tools/replay_whoop4_compact_steps.swift:46-55 — 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 `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3047` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2968` calls `Int` and `Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3047` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–13 lines × 2) · ×2
  • Duplicated block (8–13 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:836 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:836-848 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:867-874 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:836` 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. 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–13 lines × 2) Atria/Atria/Sessions.swift:24062 — Atria/Atria/Sessions.swift:24062-24069 | Atria/Atria/Sessions.swift:24170-24182 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:24062` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×2
  • Duplicated block (11–12 lines × 2) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:631 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:631-641 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1240-1251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11–12 lines × 2) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:520 — Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:520-530 | Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:555-566 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:520` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×2
  • Duplicated block (10 lines × 3) Atria/Atria/AtriaStressDetailView.swift:1570 — Atria/Atria/AtriaStressDetailView.swift:1570-1579 | Atria/Atria/AtriaStressDetailView.swift:1714-1723 | Atria/Atria/AtriaStressDetailView.swift:1829-1838 — 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 `Atria/Atria/AtriaStressDetailView.swift:1570` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 3) Atria/Atria/Sessions.swift:22342 — Atria/Atria/Sessions.swift:22342-22351 | Atria/Atria/Sessions.swift:22432-22441 | Atria/Atria/Sessions.swift:22565-22576 — 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 `Atria/Atria/Sessions.swift:22342` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/Sessions.swift:22351` calls `trendDetailSnapshot` and `Atria/Atria/Sessions.swift:22576` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–10 lines × 2) · ×2
  • Duplicated block (8–10 lines × 2) Atria/Atria/AtriaRecoveredMotionProjection.swift:341 — Atria/Atria/AtriaRecoveredMotionProjection.swift:341-348 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1166-1175 — 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 `Atria/Atria/AtriaRecoveredMotionProjection.swift:341` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (8–10 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:691 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:691-700 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:291-298 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7 lines × 4) · ×2
  • Duplicated block (7 lines × 4) Atria/Atria/Sessions.swift:2424 — Atria/Atria/Sessions.swift:2424-2430 | Atria/Atria/Sessions.swift:2456-2462 | Atria/Atria/Sessions.swift:2568-2574 | Atria/Atria/Sessions.swift:2774-2780 — 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.
  • Duplicated block (7 lines × 4) tools/evaluate_activity_classifier.py:47 — tools/evaluate_activity_classifier.py:47-53 | tools/evaluate_overnight_load_model.py:33-39 | tools/evaluate_recovery_model.py:30-36 | tools/evaluate_sensor_decoder.py:31-37 — before extracting anything, compare `tools/evaluate_activity_classifier.py` and `tools/evaluate_overnight_load_model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (6 lines × 4) · ×2
  • Duplicated block (6 lines × 4) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:353 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:353-358 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:393-398 | Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:292-297 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:351-356 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (6 lines × 4) tools/analyze_historical_archive.py:69 — tools/analyze_historical_archive.py:69-74 | tools/analyze_historical_usability.py:68-73 | tools/analyze_sleep_store.py:25-30 | tools/analyze_workout_store.py:27-32 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D6 · Cohesion (LCOM4) · Low cohesion · ×2
  • Low cohesion: AtriaBLEManager (LCOM4 8) REDACTED:558 — AtriaBLEManager's methods fall into 8 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 8 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
  • Low cohesion: SessionStore (LCOM4 7) Atria/Atria/Sessions.swift:8847 — SessionStore'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.
D1 · Cyclomatic Complexity · SessionStore.validateSessionBackupEnvelopeForImport (cyclomatic 293) · ×1
  • SessionStore.validateSessionBackupEnvelopeForImport (cyclomatic 293) Atria/Atria/Sessions.swift:48099 — SessionStore.validateSessionBackupEnvelopeForImport has cyclomatic complexity 293 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · SessionStore.aggregateSleepCandidatesCore (cyclomatic 262) · ×1
  • SessionStore.aggregateSleepCandidatesCore (cyclomatic 262) Atria/Atria/Sessions.swift:50025 — SessionStore.aggregateSleepCandidatesCore has cyclomatic complexity 262 (threshold 15). Of this number, 256 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cyclomatic 177) · ×1
  • AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cyclomatic 177) REDACTED:13289 — AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded has cyclomatic complexity 177 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.logGateStatusFromLaunchIfRequested (cyclomatic 143) · ×1
  • SessionStore.logGateStatusFromLaunchIfRequested (cyclomatic 143) Atria/Atria/Sessions.swift:31247 — SessionStore.logGateStatusFromLaunchIfRequested has cyclomatic complexity 143 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.applyLaunchAutomation (cyclomatic 139) · ×1
  • AtriaBLEManager.applyLaunchAutomation (cyclomatic 139) REDACTED:24590 — AtriaBLEManager.applyLaunchAutomation has cyclomatic complexity 139 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.armHistoryOnlyProbe (cyclomatic 132) · ×1
  • AtriaBLEManager.armHistoryOnlyProbe (cyclomatic 132) REDACTED:40410 — AtriaBLEManager.armHistoryOnlyProbe has cyclomatic complexity 132 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.peripheral (cyclomatic 126) · ×1
  • AtriaBLEManager.peripheral (cyclomatic 126) REDACTED:55594 — AtriaBLEManager.peripheral has cyclomatic complexity 126 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify (cyclomatic 126) · ×1
  • AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify (cyclomatic 126) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:88 — AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify has cyclomatic complexity 126 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.logBoundedLargeStoreGateStatus (cyclomatic 124) · ×1
  • SessionStore.logBoundedLargeStoreGateStatus (cyclomatic 124) Atria/Atria/Sessions.swift:31571 — SessionStore.logBoundedLargeStoreGateStatus has cyclomatic complexity 124 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.peripheral (cyclomatic 123) · ×1
  • AtriaBLEManager.peripheral (cyclomatic 123) REDACTED:56686 — AtriaBLEManager.peripheral has cyclomatic complexity 123 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.validate (cyclomatic 121) · ×1
  • AtriaHistoricalFullDrainCoverageStore.validate (cyclomatic 121) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1159 — AtriaHistoricalFullDrainCoverageStore.validate has cyclomatic complexity 121 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.centralManager (cyclomatic 115) · ×1
  • AtriaBLEManager.centralManager (cyclomatic 115) REDACTED:54164 — AtriaBLEManager.centralManager has cyclomatic complexity 115 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.runRecoveredHeartRateProjection (cyclomatic 108) · ×1
  • SessionStore.runRecoveredHeartRateProjection (cyclomatic 108) Atria/Atria/Sessions.swift:15199 — SessionStore.runRecoveredHeartRateProjection has cyclomatic complexity 108 (threshold 15). Of this number, 97 points are the body's own statements and 11 belong to 5 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.startOfflineHistoricalSync (cyclomatic 105) · ×1
  • AtriaBLEManager.startOfflineHistoricalSync (cyclomatic 105) REDACTED:16963 — AtriaBLEManager.startOfflineHistoricalSync has cyclomatic complexity 105 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleFullDrainConsumerMaterialization (cyclomatic 104) · ×1
  • AtriaBLEManager.scheduleFullDrainConsumerMaterialization (cyclomatic 104) REDACTED:46608 — AtriaBLEManager.scheduleFullDrainConsumerMaterialization has cyclomatic complexity 104 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.finishOfflineHistoricalSync (cyclomatic 103) · ×1
  • AtriaBLEManager.finishOfflineHistoricalSync (cyclomatic 103) REDACTED:19222 — AtriaBLEManager.finishOfflineHistoricalSync has cyclomatic complexity 103 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · validate_hrv.main (cyclomatic 101) · ×1
  • validate_hrv.main (cyclomatic 101) validate_hrv.py:580 — validate_hrv.main has cyclomatic complexity 101 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded (cyclomatic 100) · ×1
  • AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded (cyclomatic 100) REDACTED:38001 — AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded has cyclomatic complexity 100 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HistoricalArchive.compactArchive (cyclomatic 95) · ×1
  • HistoricalArchive.compactArchive (cyclomatic 95) Atria/Atria/HistoricalArchive.swift:9722 — HistoricalArchive.compactArchive has cyclomatic complexity 95 (threshold 15). Of this number, 93 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWorkoutActivityType.resolved (cyclomatic 92) · ×1
  • AtriaWorkoutActivityType.resolved (cyclomatic 92) Atria/Atria/AtriaExerciseCatalog.swift:292 — AtriaWorkoutActivityType.resolved has cyclomatic complexity 92 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.resumedSleepReviewCandidatesCore (cyclomatic 87) · ×1
  • SessionStore.resumedSleepReviewCandidatesCore (cyclomatic 87) Atria/Atria/Sessions.swift:51622 — SessionStore.resumedSleepReviewCandidatesCore has cyclomatic complexity 87 (threshold 15). Of this number, 85 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaDailyStepPresentation.resolve (cyclomatic 83) · ×1
  • AtriaDailyStepPresentation.resolve (cyclomatic 83) Atria/Atria/AtriaDailyStepPresentation.swift:480 — AtriaDailyStepPresentation.resolve has cyclomatic complexity 83 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WidgetSnapshotPublisher.publish (cyclomatic 81) · ×1
  • WidgetSnapshotPublisher.publish (cyclomatic 81) Atria/Atria/WidgetSnapshot.swift:1653 — WidgetSnapshotPublisher.publish has cyclomatic complexity 81 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaDiagnosisReport.discrepancies (cyclomatic 78) · ×1
  • AtriaDiagnosisReport.discrepancies (cyclomatic 78) Atria/Atria/AtriaDiagnosisReport.swift:285 — AtriaDiagnosisReport.discrepancies has cyclomatic complexity 78 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · WidgetSnapshotPublisher.durableStepPatchedSnapshot (cyclomatic 76) · ×1
  • WidgetSnapshotPublisher.durableStepPatchedSnapshot (cyclomatic 76) Atria/Atria/WidgetSnapshot.swift:566 — WidgetSnapshotPublisher.durableStepPatchedSnapshot has cyclomatic complexity 76 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.init (cyclomatic 74) · ×1
  • AtriaBLEManager.init (cyclomatic 74) REDACTED:6959 — AtriaBLEManager.init has cyclomatic complexity 74 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.processHistoricalDrainEffects (cyclomatic 73) · ×1
  • AtriaBLEManager.processHistoricalDrainEffects (cyclomatic 73) REDACTED:45898 — AtriaBLEManager.processHistoricalDrainEffects has cyclomatic complexity 73 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.runForegroundKeepaliveTick (cyclomatic 71) · ×1
  • AtriaBLEManager.runForegroundKeepaliveTick (cyclomatic 71) REDACTED:10681 — AtriaBLEManager.runForegroundKeepaliveTick has cyclomatic complexity 71 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTopStatusProjection.presentation (cyclomatic 70) · ×1
  • AtriaTopStatusProjection.presentation (cyclomatic 70) Atria/Atria/AtriaHomeView.swift:14203 — AtriaTopStatusProjection.presentation has cyclomatic complexity 70 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.latestNightMotionRead (cyclomatic 69) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightMotionRead (cyclomatic 69) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:544 — AtriaWhoop4MotionTickCompactStore.latestNightMotionRead has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority (cyclomatic 69) · ×1
  • WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority (cyclomatic 69) Atria/Atria/WidgetSnapshot.swift:824 — WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority has cyclomatic complexity 69 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.publishAndVerifyHistoricalConsumerCutover (cyclomatic 68) · ×1
  • HistoricalArchive.publishAndVerifyHistoricalConsumerCutover (cyclomatic 68) Atria/Atria/HistoricalArchive.swift:2721 — HistoricalArchive.publishAndVerifyHistoricalConsumerCutover has cyclomatic complexity 68 (threshold 15). Of this number, 67 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.makeRecoveredDataSnapshot (cyclomatic 65) · ×1
  • HistoricalArchive.makeRecoveredDataSnapshot (cyclomatic 65) Atria/Atria/HistoricalArchive.swift:6298 — HistoricalArchive.makeRecoveredDataSnapshot has cyclomatic complexity 65 (threshold 15). Of this number, 49 points are the body's own statements and 16 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SleepHistorySnapshot.init (cyclomatic 64) · ×1
  • SleepHistorySnapshot.init (cyclomatic 64) Atria/Atria/Sessions.swift:60294 — SleepHistorySnapshot.init has cyclomatic complexity 64 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow (cyclomatic 63) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow (cyclomatic 63) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:527 — AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow has cyclomatic complexity 63 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare (cyclomatic 63) · ×1
  • AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare (cyclomatic 63) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1133 — AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaPhysiologicalCycle.canonicalMainSleepsCancellable (cyclomatic 63) · ×1
  • AtriaPhysiologicalCycle.canonicalMainSleepsCancellable (cyclomatic 63) Atria/Atria/Sessions.swift:441 — AtriaPhysiologicalCycle.canonicalMainSleepsCancellable has cyclomatic complexity 63 (threshold 15). Of this number, 48 points are the body's own statements and 15 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.autoConfirmSleepOnForegroundIfUseful (cyclomatic 63) · ×1
  • SessionStore.autoConfirmSleepOnForegroundIfUseful (cyclomatic 63) Atria/Atria/Sessions.swift:39229 — SessionStore.autoConfirmSleepOnForegroundIfUseful has cyclomatic complexity 63 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded (cyclomatic 62) · ×1
  • AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded (cyclomatic 62) REDACTED:41909 — AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.peripheral (cyclomatic 62) · ×1
  • AtriaBLEManager.peripheral (cyclomatic 62) REDACTED:56373 — AtriaBLEManager.peripheral has cyclomatic complexity 62 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.peripheral (cyclomatic 60) · ×1
  • AtriaBLEManager.peripheral (cyclomatic 60) REDACTED:56116 — AtriaBLEManager.peripheral has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaLiveWorkoutTRIMPAccumulator.metrics (cyclomatic 60) · ×1
  • AtriaLiveWorkoutTRIMPAccumulator.metrics (cyclomatic 60) Atria/Atria/AtriaLiveWorkoutView.swift:450 — AtriaLiveWorkoutTRIMPAccumulator.metrics has cyclomatic complexity 60 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.scheduleConfirmedWorkoutArchiveRehydration (cyclomatic 59) · ×1
  • SessionStore.scheduleConfirmedWorkoutArchiveRehydration (cyclomatic 59) Atria/Atria/Sessions.swift:19830 — SessionStore.scheduleConfirmedWorkoutArchiveRehydration has cyclomatic complexity 59 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.awakeSplitSubClusters (cyclomatic 59) · ×1
  • SessionStore.awakeSplitSubClusters (cyclomatic 59) Atria/Atria/Sessions.swift:51200 — SessionStore.awakeSplitSubClusters has cyclomatic complexity 59 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature (cyclomatic 58) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature (cyclomatic 58) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1057 — AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature has cyclomatic complexity 58 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.archiveOnlyHeartRateSegmentsCancellable (cyclomatic 56) · ×1
  • SessionStore.archiveOnlyHeartRateSegmentsCancellable (cyclomatic 56) Atria/Atria/Sessions.swift:27378 — SessionStore.archiveOnlyHeartRateSegmentsCancellable has cyclomatic complexity 56 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.compactLatestNightSessionSlice (cyclomatic 55) · ×1
  • SessionStore.compactLatestNightSessionSlice (cyclomatic 55) Atria/Atria/Sessions.swift:38605 — SessionStore.compactLatestNightSessionSlice has cyclomatic complexity 55 (threshold 15). Of this number, 51 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalAggregateReader.streamedWholeArchiveDigest (cyclomatic 54) · ×1
  • AtriaHistoricalAggregateReader.streamedWholeArchiveDigest (cyclomatic 54) Atria/Atria/AtriaHistoricalAggregateReader.swift:269 — AtriaHistoricalAggregateReader.streamedWholeArchiveDigest has cyclomatic complexity 54 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.centralManager (cyclomatic 53) · ×1
  • AtriaBLEManager.centralManager (cyclomatic 53) REDACTED:53660 — AtriaBLEManager.centralManager has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.validateSessionBackupEnvelopeForImport · ×1
  • SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence (cyclomatic 53) Atria/Atria/Sessions.swift:48152 — SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence has cyclomatic complexity 53 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (SessionStore.validateSessionBackupEnvelopeForImport) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AtriaWidgetMetric.statusText (cyclomatic 53) · ×1
  • AtriaWidgetMetric.statusText (cyclomatic 53) Atria/AtriaWidget/AtriaWidget.swift:3653 — AtriaWidgetMetric.statusText has cyclomatic complexity 53 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEHistoryTerminalPublicationStore.validate (cyclomatic 52) · ×1
  • AtriaBLEHistoryTerminalPublicationStore.validate (cyclomatic 52) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:298 — AtriaBLEHistoryTerminalPublicationStore.validate has cyclomatic complexity 52 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalLongTermRollup.validate (cyclomatic 52) · ×1
  • AtriaHistoricalLongTermRollup.validate (cyclomatic 52) Atria/Atria/AtriaHistoricalLongTermRollup.swift:167 — AtriaHistoricalLongTermRollup.validate has cyclomatic complexity 52 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.makeBehaviorCorrelationSummariesCancellable (cyclomatic 52) · ×1
  • SessionStore.makeBehaviorCorrelationSummariesCancellable (cyclomatic 52) Atria/Atria/Sessions.swift:47378 — SessionStore.makeBehaviorCorrelationSummariesCancellable has cyclomatic complexity 52 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration (cyclomatic 51) · ×1
  • AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration (cyclomatic 51) REDACTED:19797 — AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration has cyclomatic complexity 51 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHistoricalRawRetirementExecutor.retire (cyclomatic 51) · ×1
  • AtriaHistoricalRawRetirementExecutor.retire (cyclomatic 51) Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:72 — AtriaHistoricalRawRetirementExecutor.retire has cyclomatic complexity 51 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaSleepWakeResearch.stage (cyclomatic 51) · ×1
  • AtriaSleepWakeResearch.stage (cyclomatic 51) Atria/Atria/AtriaSleepWakeResearch.swift:693 — AtriaSleepWakeResearch.stage has cyclomatic complexity 51 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.makeMorningFrozenDailyMetric (cyclomatic 51) · ×1
  • SessionStore.makeMorningFrozenDailyMetric (cyclomatic 51) Atria/Atria/Sessions.swift:24454 — SessionStore.makeMorningFrozenDailyMetric has cyclomatic complexity 51 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.confirmWorkoutWindow (cyclomatic 50) · ×1
  • SessionStore.confirmWorkoutWindow (cyclomatic 50) Atria/Atria/Sessions.swift:34270 — SessionStore.confirmWorkoutWindow has cyclomatic complexity 50 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SleepHistorySnapshot.combiningResumedSleepSegments (cyclomatic 50) · ×1
  • SleepHistorySnapshot.combiningResumedSleepSegments (cyclomatic 50) Atria/Atria/Sessions.swift:60565 — SleepHistorySnapshot.combiningResumedSleepSegments has cyclomatic complexity 50 (threshold 15). Of this number, 36 points are the body's own statements and 14 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.motionTickDayEvidenceReadImpl (cyclomatic 49) · ×1
  • HistoricalArchive.motionTickDayEvidenceReadImpl (cyclomatic 49) Atria/Atria/HistoricalArchive.swift:3744 — HistoricalArchive.motionTickDayEvidenceReadImpl has cyclomatic complexity 49 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This shape REPEATS in the file: one other method here (HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · AtriaBLEManager.peripheral (cyclomatic 48) · ×1
  • AtriaBLEManager.peripheral (cyclomatic 48) REDACTED:55342 — AtriaBLEManager.peripheral has cyclomatic complexity 48 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.attachRecoveredSkinTemperatureCancellable (cyclomatic 48) · ×1
  • SessionStore.attachRecoveredSkinTemperatureCancellable (cyclomatic 48) Atria/Atria/Sessions.swift:22768 — SessionStore.attachRecoveredSkinTemperatureCancellable has cyclomatic complexity 48 (threshold 15). Of this number, 45 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.motionQuiescenceRefinedBounds (cyclomatic 48) · ×1
  • SessionStore.motionQuiescenceRefinedBounds (cyclomatic 48) Atria/Atria/Sessions.swift:49726 — SessionStore.motionQuiescenceRefinedBounds has cyclomatic complexity 48 (threshold 15). Of this number, 17 points are the body's own statements and 31 belong to 5 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Recovery.estimate (cyclomatic 47) · ×1
  • Recovery.estimate (cyclomatic 47) Atria/Atria/AtriaAnalytics.swift:1374 — Recovery.estimate has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaApp.scheduleLaunchExportsIfRequested (cyclomatic 47) · ×1
  • AtriaApp.scheduleLaunchExportsIfRequested (cyclomatic 47) Atria/Atria/AtriaApp.swift:1536 — AtriaApp.scheduleLaunchExportsIfRequested has cyclomatic complexity 47 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleLongWearSupervisor (cyclomatic 47) · ×1
  • AtriaBLEManager.scheduleLongWearSupervisor (cyclomatic 47) REDACTED:25154 — AtriaBLEManager.scheduleLongWearSupervisor has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry (cyclomatic 47) · ×1
  • AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry (cyclomatic 47) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1651 — AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry has cyclomatic complexity 47 (threshold 15). Of this number, 26 points are the body's own statements and 21 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.materialize (cyclomatic 47) · ×1
  • AtriaHistoricalStressReplay.materialize (cyclomatic 47) Atria/Atria/AtriaStressMonitor.swift:1665 — AtriaHistoricalStressReplay.materialize has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.backfillConfirmedSleepStagesFromSessions (cyclomatic 47) · ×1
  • SessionStore.backfillConfirmedSleepStagesFromSessions (cyclomatic 47) Atria/Atria/Sessions.swift:46346 — SessionStore.backfillConfirmedSleepStagesFromSessions has cyclomatic complexity 47 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaApp.handleDeferredLaunchWork (cyclomatic 46) · ×1
  • AtriaApp.handleDeferredLaunchWork (cyclomatic 46) Atria/Atria/AtriaApp.swift:1398 — AtriaApp.handleDeferredLaunchWork has cyclomatic complexity 46 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible (cyclomatic 46) · ×1
  • AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible (cyclomatic 46) REDACTED:36012 — AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.evaluate (cyclomatic 46) · ×1
  • AtriaHistoricalStressReplay.evaluate (cyclomatic 46) Atria/Atria/AtriaStressMonitor.swift:2125 — AtriaHistoricalStressReplay.evaluate has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStressMonitorStore.update (cyclomatic 46) · ×1
  • AtriaStressMonitorStore.update (cyclomatic 46) Atria/Atria/AtriaStressMonitor.swift:4275 — AtriaStressMonitorStore.update has cyclomatic complexity 46 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.handleRecoveredDataRecomputeEffects (cyclomatic 46) · ×1
  • SessionStore.handleRecoveredDataRecomputeEffects (cyclomatic 46) Atria/Atria/Sessions.swift:18410 — SessionStore.handleRecoveredDataRecomputeEffects has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.recoveredSkinTemperatureProjectionCancellable (cyclomatic 46) · ×1
  • SessionStore.recoveredSkinTemperatureProjectionCancellable (cyclomatic 46) Atria/Atria/Sessions.swift:23037 — SessionStore.recoveredSkinTemperatureProjectionCancellable has cyclomatic complexity 46 (threshold 15). Of this number, 43 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.makeSleepReviewNightForCacheCore (cyclomatic 46) · ×1
  • SessionStore.makeSleepReviewNightForCacheCore (cyclomatic 46) Atria/Atria/Sessions.swift:37221 — SessionStore.makeSleepReviewNightForCacheCore has cyclomatic complexity 46 (threshold 15). Of this number, 35 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.physiologicalSleepReviewNightDraftCore (cyclomatic 46) · ×1
  • SessionStore.physiologicalSleepReviewNightDraftCore (cyclomatic 46) Atria/Atria/Sessions.swift:37821 — SessionStore.physiologicalSleepReviewNightDraftCore has cyclomatic complexity 46 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.persistActiveSessionJournalIfNeeded (cyclomatic 45) · ×1
  • AtriaBLEManager.persistActiveSessionJournalIfNeeded (cyclomatic 45) REDACTED:23292 — AtriaBLEManager.persistActiveSessionJournalIfNeeded has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.snapshotSession (cyclomatic 45) · ×1
  • AtriaBLEManager.snapshotSession (cyclomatic 45) REDACTED:51508 — AtriaBLEManager.snapshotSession has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaRecoveredMotionProjection.projectCancellable (cyclomatic 45) · ×1
  • AtriaRecoveredMotionProjection.projectCancellable (cyclomatic 45) Atria/Atria/AtriaRecoveredMotionProjection.swift:275 — AtriaRecoveredMotionProjection.projectCancellable has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HealthKitExporter.export (cyclomatic 45) · ×1
  • HealthKitExporter.export (cyclomatic 45) Atria/Atria/HealthKitExporter.swift:371 — HealthKitExporter.export has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.logExecutionPriority (cyclomatic 45) · ×1
  • SessionStore.logExecutionPriority (cyclomatic 45) Atria/Atria/Sessions.swift:31979 — SessionStore.logExecutionPriority has cyclomatic complexity 45 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded (cyclomatic 44) · ×1
  • AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded (cyclomatic 44) Atria/Atria/AtriaHomeView.swift:3067 — AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded has cyclomatic complexity 44 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HeroSnapshot.== (cyclomatic 44) · ×1
  • HeroSnapshot.== (cyclomatic 44) Atria/Atria/AtriaHomeView.swift:9506 — HeroSnapshot.== has cyclomatic complexity 44 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.prepareRecoveredProjectionInstall (cyclomatic 44) · ×1
  • SessionStore.prepareRecoveredProjectionInstall (cyclomatic 44) Atria/Atria/Sessions.swift:14991 — SessionStore.prepareRecoveredProjectionInstall has cyclomatic complexity 44 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration (cyclomatic 43) · ×1
  • AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration (cyclomatic 43) REDACTED:7773 — AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration has cyclomatic complexity 43 (threshold 15). Of this number, 39 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint (cyclomatic 43) · ×1
  • HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint (cyclomatic 43) Atria/Atria/HistoricalArchive.swift:4725 — HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint has cyclomatic complexity 43 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.performAutomaticRecoveredDataBootstrapStep (cyclomatic 43) · ×1
  • HistoricalArchive.performAutomaticRecoveredDataBootstrapStep (cyclomatic 43) Atria/Atria/HistoricalArchive.swift:5478 — HistoricalArchive.performAutomaticRecoveredDataBootstrapStep has cyclomatic complexity 43 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Night.reconciledHROnlyDisplaySegments (cyclomatic 43) · ×1
  • Night.reconciledHROnlyDisplaySegments (cyclomatic 43) Atria/Atria/Sessions.swift:59825 — Night.reconciledHROnlyDisplaySegments has cyclomatic complexity 43 (threshold 15). Of this number, 29 points are the body's own statements and 14 belong to 4 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.centralManager (cyclomatic 42) · ×1
  • AtriaBLEManager.centralManager (cyclomatic 42) REDACTED:53285 — AtriaBLEManager.centralManager has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaMetricDetailSheet.detailTemplate (cyclomatic 42) · ×1
  • AtriaMetricDetailSheet.detailTemplate (cyclomatic 42) Atria/Atria/AtriaOverviewSections.swift:4783 — AtriaMetricDetailSheet.detailTemplate has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.mergeDailyMetricHistoryCancellable (cyclomatic 42) · ×1
  • SessionStore.mergeDailyMetricHistoryCancellable (cyclomatic 42) Atria/Atria/Sessions.swift:23768 — SessionStore.mergeDailyMetricHistoryCancellable has cyclomatic complexity 42 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.evaluateWorkoutMotionLease (cyclomatic 41) · ×1
  • AtriaBLEManager.evaluateWorkoutMotionLease (cyclomatic 41) REDACTED:39514 — AtriaBLEManager.evaluateWorkoutMotionLease has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.centralManagerDidUpdateState (cyclomatic 41) · ×1
  • AtriaBLEManager.centralManagerDidUpdateState (cyclomatic 41) REDACTED:53006 — AtriaBLEManager.centralManagerDidUpdateState has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalAggregateReader.loadPage (cyclomatic 41) · ×1
  • AtriaHistoricalAggregateReader.loadPage (cyclomatic 41) Atria/Atria/AtriaHistoricalAggregateReader.swift:525 — AtriaHistoricalAggregateReader.loadPage has cyclomatic complexity 41 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaScanRecordParser.parseISO8601 (cyclomatic 41) · ×1
  • AtriaScanRecordParser.parseISO8601 (cyclomatic 41) Atria/Atria/HistoricalArchive.swift:11397 — AtriaScanRecordParser.parseISO8601 has cyclomatic complexity 41 (threshold 15). Of this number, 38 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SessionStore.saveConfirmedSleeps (cyclomatic 41) · ×1
  • SessionStore.saveConfirmedSleeps (cyclomatic 41) Atria/Atria/Sessions.swift:45543 — SessionStore.saveConfirmedSleeps has cyclomatic complexity 41 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded (cyclomatic 40) · ×1
  • AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded (cyclomatic 40) REDACTED:11723 — AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.observeProductionHistoryCursorRange (cyclomatic 40) · ×1
  • AtriaBLEManager.observeProductionHistoryCursorRange (cyclomatic 40) REDACTED:42566 — AtriaBLEManager.observeProductionHistoryCursorRange has cyclomatic complexity 40 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalActivityProjection.validatesInternalShape (cyclomatic 40) · ×1
  • AtriaHistoricalActivityProjection.validatesInternalShape (cyclomatic 40) Atria/Atria/AtriaHistoricalActivityProjection.swift:693 — AtriaHistoricalActivityProjection.validatesInternalShape has cyclomatic complexity 40 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHomeModel.bind (cyclomatic 40) · ×1
  • AtriaHomeModel.bind (cyclomatic 40) Atria/Atria/AtriaHomeView.swift:10396 — AtriaHomeModel.bind has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaNightTimelineAnalyzer.analyze (cyclomatic 40) · ×1
  • AtriaNightTimelineAnalyzer.analyze (cyclomatic 40) Atria/Atria/AtriaNightTimelineAnalyzer.swift:66 — AtriaNightTimelineAnalyzer.analyze has cyclomatic complexity 40 (threshold 15). Of this number, 37 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.logGateReadinessFromLaunchIfRequested (cyclomatic 40) · ×1
  • SessionStore.logGateReadinessFromLaunchIfRequested (cyclomatic 40) Atria/Atria/Sessions.swift:31142 — SessionStore.logGateReadinessFromLaunchIfRequested has cyclomatic complexity 40 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.commitPreparedWorkoutWindowConfirmation (cyclomatic 40) · ×1
  • SessionStore.commitPreparedWorkoutWindowConfirmation (cyclomatic 40) Atria/Atria/Sessions.swift:33980 — SessionStore.commitPreparedWorkoutWindowConfirmation 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.runSacrificialFastDrainSlices (cyclomatic 39) · ×1
  • AtriaBLEManager.runSacrificialFastDrainSlices (cyclomatic 39) REDACTED:41105 — AtriaBLEManager.runSacrificialFastDrainSlices has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalAggregateReader.load (cyclomatic 39) · ×1
  • AtriaHistoricalAggregateReader.load (cyclomatic 39) Atria/Atria/AtriaHistoricalAggregateReader.swift:104 — AtriaHistoricalAggregateReader.load has cyclomatic complexity 39 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot (cyclomatic 39) · ×1
  • WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot (cyclomatic 39) Atria/Atria/WidgetSnapshot.swift:1102 — WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot has cyclomatic complexity 39 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded (cyclomatic 38) · ×1
  • AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded (cyclomatic 38) REDACTED:17830 — AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendWorkoutMotionActivationPair (cyclomatic 38) · ×1
  • AtriaBLEManager.sendWorkoutMotionActivationPair (cyclomatic 38) REDACTED:39764 — AtriaBLEManager.sendWorkoutMotionActivationPair has cyclomatic complexity 38 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded (cyclomatic 38) · ×1
  • AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded (cyclomatic 38) REDACTED:48363 — AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalActivityProjection.detectCandidates (cyclomatic 38) · ×1
  • AtriaHistoricalActivityProjection.detectCandidates (cyclomatic 38) Atria/Atria/AtriaHistoricalActivityProjection.swift:521 — AtriaHistoricalActivityProjection.detectCandidates has cyclomatic complexity 38 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · RespRateRsa.estimateCancellable (cyclomatic 37) · ×1
  • RespRateRsa.estimateCancellable (cyclomatic 37) Atria/Atria/AtriaAnalytics.swift:57 — RespRateRsa.estimateCancellable has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded (cyclomatic 37) · ×1
  • AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded (cyclomatic 37) REDACTED:21878 — AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleSacrificialFastDrainPayload (cyclomatic 37) · ×1
  • AtriaBLEManager.handleSacrificialFastDrainPayload (cyclomatic 37) REDACTED:43423 — AtriaBLEManager.handleSacrificialFastDrainPayload has cyclomatic complexity 37 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable (cyclomatic 37) · ×1
  • AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable (cyclomatic 37) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:111 — AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable has cyclomatic complexity 37 (threshold 15). Of this number, 35 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaScanRecordParser.storeValue (cyclomatic 37) · ×1
  • AtriaScanRecordParser.storeValue (cyclomatic 37) Atria/Atria/HistoricalArchive.swift:11002 — AtriaScanRecordParser.storeValue has cyclomatic complexity 37 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch (cyclomatic 36) · ×1
  • AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch (cyclomatic 36) REDACTED:5076 — AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded (cyclomatic 36) · ×1
  • AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded (cyclomatic 36) REDACTED:34442 — AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded has cyclomatic complexity 36 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.drainNextHistoricalTransportEventBurst (cyclomatic 36) · ×1
  • AtriaBLEManager.drainNextHistoricalTransportEventBurst (cyclomatic 36) REDACTED:45253 — AtriaBLEManager.drainNextHistoricalTransportEventBurst has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority (cyclomatic 36) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority (cyclomatic 36) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:70 — AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately (cyclomatic 36) · ×1
  • AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately (cyclomatic 36) Atria/Atria/AtriaLiveActivityCoordinator.swift:905 — AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaStrapSetup.evaluate (cyclomatic 36) · ×1
  • AtriaStrapSetup.evaluate (cyclomatic 36) Atria/Atria/AtriaStrapSetup.swift:360 — AtriaStrapSetup.evaluate has cyclomatic complexity 36 (threshold 15). Of this number, 33 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWorkoutRouteStore.recoverPendingTransaction (cyclomatic 36) · ×1
  • AtriaWorkoutRouteStore.recoverPendingTransaction (cyclomatic 36) Atria/Atria/AtriaWorkoutRoute.swift:1017 — AtriaWorkoutRouteStore.recoverPendingTransaction has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.motionTickWindowRead (cyclomatic 36) · ×1
  • HistoricalArchive.motionTickWindowRead (cyclomatic 36) Atria/Atria/HistoricalArchive.swift:3488 — HistoricalArchive.motionTickWindowRead has cyclomatic complexity 36 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.confirmedSleepRespiratoryRateCore (cyclomatic 36) · ×1
  • SessionStore.confirmedSleepRespiratoryRateCore (cyclomatic 36) Atria/Atria/Sessions.swift:43488 — SessionStore.confirmedSleepRespiratoryRateCore has cyclomatic complexity 36 (threshold 15). Of this number, 20 points are the body's own statements and 16 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.sleepStageResearchSegmentsCore (cyclomatic 36) · ×1
  • SessionStore.sleepStageResearchSegmentsCore (cyclomatic 36) Atria/Atria/Sessions.swift:43794 — SessionStore.sleepStageResearchSegmentsCore has cyclomatic complexity 36 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.logSleepValidation (cyclomatic 36) · ×1
  • SessionStore.logSleepValidation (cyclomatic 36) Atria/Atria/Sessions.swift:53559 — SessionStore.logSleepValidation 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.performHRContinuityWatchdogAction (cyclomatic 35) · ×1
  • AtriaBLEManager.performHRContinuityWatchdogAction (cyclomatic 35) REDACTED:25889 — AtriaBLEManager.performHRContinuityWatchdogAction has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.centralManager (cyclomatic 35) · ×1
  • AtriaBLEManager.centralManager (cyclomatic 35) REDACTED:55084 — AtriaBLEManager.centralManager has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaColdSessionFact.validate (cyclomatic 35) · ×1
  • AtriaColdSessionFact.validate (cyclomatic 35) Atria/Atria/AtriaColdSessionFacts.swift:316 — AtriaColdSessionFact.validate has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaRecoveredRRProjection.verify (cyclomatic 35) · ×1
  • AtriaRecoveredRRProjection.verify (cyclomatic 35) Atria/Atria/AtriaRecoveredRRProjection.swift:436 — AtriaRecoveredRRProjection.verify has cyclomatic complexity 35 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoryDrainState.receiveFrame (cyclomatic 35) · ×1
  • AtriaWhoop4HistoryDrainState.receiveFrame (cyclomatic 35) REDACTED:336 — AtriaWhoop4HistoryDrainState.receiveFrame has cyclomatic complexity 35 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.legacyCompactArchiveDisabled (cyclomatic 35) · ×1
  • HistoricalArchive.legacyCompactArchiveDisabled (cyclomatic 35) Atria/Atria/HistoricalArchive.swift:10644 — HistoricalArchive.legacyCompactArchiveDisabled has cyclomatic complexity 35 (threshold 15). Of this number, 23 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleRangeLossBackfillIfNeeded (cyclomatic 34) · ×1
  • AtriaBLEManager.scheduleRangeLossBackfillIfNeeded (cyclomatic 34) REDACTED:21112 — AtriaBLEManager.scheduleRangeLossBackfillIfNeeded has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaColdSessionMigration.migrate (cyclomatic 34) · ×1
  • AtriaColdSessionMigration.migrate (cyclomatic 34) Atria/Atria/AtriaColdSessionMigration.swift:53 — AtriaColdSessionMigration.migrate has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaColdSessionSourceScanner.scanFrames (cyclomatic 34) · ×1
  • AtriaColdSessionSourceScanner.scanFrames (cyclomatic 34) Atria/Atria/AtriaColdSessionSourceScanner.swift:48 — AtriaColdSessionSourceScanner.scanFrames has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaFullFidelityColdSessionStore.persistLocked (cyclomatic 34) · ×1
  • AtriaFullFidelityColdSessionStore.persistLocked (cyclomatic 34) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:472 — AtriaFullFidelityColdSessionStore.persistLocked has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations (cyclomatic 34) · ×1
  • AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations (cyclomatic 34) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1090 — AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations has cyclomatic complexity 34 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaHistoricalRetentionTransaction.commit (cyclomatic 34) · ×1
  • AtriaHistoricalRetentionTransaction.commit (cyclomatic 34) Atria/Atria/AtriaHistoricalRetentionTransaction.swift:176 — AtriaHistoricalRetentionTransaction.commit has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHomeModel.makeHeroSnapshot (cyclomatic 34) · ×1
  • AtriaHomeModel.makeHeroSnapshot (cyclomatic 34) Atria/Atria/AtriaHomeView.swift:12877 — AtriaHomeModel.makeHeroSnapshot has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible (cyclomatic 34) · ×1
  • AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible (cyclomatic 34) Atria/Atria/AtriaOnboardingHistoryBootstrap.swift:112 — AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaPhysiologicalStressModel.evaluate (cyclomatic 34) · ×1
  • AtriaPhysiologicalStressModel.evaluate (cyclomatic 34) Atria/Atria/AtriaPhysiologicalStressModel.swift:384 — AtriaPhysiologicalStressModel.evaluate has cyclomatic complexity 34 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaSleepWakeResearch.motionContext (cyclomatic 34) · ×1
  • AtriaSleepWakeResearch.motionContext (cyclomatic 34) Atria/Atria/AtriaSleepWakeResearch.swift:947 — AtriaSleepWakeResearch.motionContext has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash (cyclomatic 34) · ×1
  • HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash (cyclomatic 34) Atria/Atria/HistoricalArchive.swift:2306 — HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash has cyclomatic complexity 34 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.autoConfirmStrongSleepCandidates (cyclomatic 34) · ×1
  • SessionStore.autoConfirmStrongSleepCandidates (cyclomatic 34) Atria/Atria/Sessions.swift:40769 — SessionStore.autoConfirmStrongSleepCandidates has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.compactRespiratoryRateEstimate (cyclomatic 34) · ×1
  • SessionStore.compactRespiratoryRateEstimate (cyclomatic 34) Atria/Atria/Sessions.swift:43323 — SessionStore.compactRespiratoryRateEstimate has cyclomatic complexity 34 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.prepareConfirmedSleepSave (cyclomatic 34) · ×1
  • SessionStore.prepareConfirmedSleepSave (cyclomatic 34) Atria/Atria/Sessions.swift:45283 — SessionStore.prepareConfirmedSleepSave 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.leftoverFlushLines (cyclomatic 33) · ×1
  • AtriaBLEManager.leftoverFlushLines (cyclomatic 33) REDACTED:9071 — AtriaBLEManager.leftoverFlushLines has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady (cyclomatic 33) · ×1
  • AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady (cyclomatic 33) REDACTED:15640 — AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.resumeProtectedR10FromRestoredCache (cyclomatic 33) · ×1
  • AtriaBLEManager.resumeProtectedR10FromRestoredCache (cyclomatic 33) REDACTED:16487 — AtriaBLEManager.resumeProtectedR10FromRestoredCache has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleProprietary (cyclomatic 33) · ×1
  • AtriaBLEManager.handleProprietary (cyclomatic 33) REDACTED:43176 — AtriaBLEManager.handleProprietary has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTodayScreen.glanceItem (cyclomatic 33) · ×1
  • AtriaTodayScreen.glanceItem (cyclomatic 33) Atria/Atria/AtriaTodayScreen.swift:2960 — AtriaTodayScreen.glanceItem has cyclomatic complexity 33 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AtriaWhoop4DailyMotionBankRearmPolicy.evaluate (cyclomatic 33) · ×1
  • AtriaWhoop4DailyMotionBankRearmPolicy.evaluate (cyclomatic 33) Atria/Atria/AtriaWhoop4DailyMotionBankRearmPolicy.swift:143 — AtriaWhoop4DailyMotionBankRearmPolicy.evaluate has cyclomatic complexity 33 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickSequenceReducer.reduce (cyclomatic 33) · ×1
  • AtriaWhoop4MotionTickSequenceReducer.reduce (cyclomatic 33) Atria/Atria/AtriaWhoop4MotionTickSequenceReducer.swift:23 — AtriaWhoop4MotionTickSequenceReducer.reduce has cyclomatic complexity 33 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.updateStrapStreamState (cyclomatic 32) · ×1
  • AtriaBLEManager.updateStrapStreamState (cyclomatic 32) REDACTED:3255 — AtriaBLEManager.updateStrapStreamState has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.acceptHeartRate (cyclomatic 32) · ×1
  • AtriaBLEManager.acceptHeartRate (cyclomatic 32) REDACTED:31145 — AtriaBLEManager.acceptHeartRate has cyclomatic complexity 32 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.armRealtime (cyclomatic 32) · ×1
  • AtriaBLEManager.armRealtime (cyclomatic 32) REDACTED:40087 — AtriaBLEManager.armRealtime has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoveragePolicy.validate (cyclomatic 32) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.validate (cyclomatic 32) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:401 — AtriaHistoricalFullDrainCoveragePolicy.validate has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaRecoveredMotionAnalytics.sleepProvenance (cyclomatic 32) · ×1
  • AtriaRecoveredMotionAnalytics.sleepProvenance (cyclomatic 32) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:214 — AtriaRecoveredMotionAnalytics.sleepProvenance has cyclomatic complexity 32 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWorkoutPromptEvaluator.evaluate (cyclomatic 32) · ×1
  • AtriaWorkoutPromptEvaluator.evaluate (cyclomatic 32) Atria/Atria/AtriaWorkoutPromptEvaluator.swift:147 — AtriaWorkoutPromptEvaluator.evaluate has cyclomatic complexity 32 (threshold 15). Of this number, 30 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash (cyclomatic 32) · ×1
  • HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash (cyclomatic 32) Atria/Atria/HistoricalArchive.swift:2437 — HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash has cyclomatic complexity 32 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.settleConfirmedMorningAuthority (cyclomatic 32) · ×1
  • SessionStore.settleConfirmedMorningAuthority (cyclomatic 32) Atria/Atria/Sessions.swift:57826 — SessionStore.settleConfirmedMorningAuthority has cyclomatic complexity 32 (threshold 15). Of this number, 21 points are the body's own statements and 11 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendProtectedR10ActivationNowIfReady (cyclomatic 31) · ×1
  • AtriaBLEManager.sendProtectedR10ActivationNowIfReady (cyclomatic 31) REDACTED:15948 — AtriaBLEManager.sendProtectedR10ActivationNowIfReady has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendCommand (cyclomatic 31) · ×1
  • AtriaBLEManager.sendCommand (cyclomatic 31) REDACTED:33373 — AtriaBLEManager.sendCommand has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid (cyclomatic 31) · ×1
  • AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid (cyclomatic 31) REDACTED:37212 — AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.startOneShotHistoryTrimIfNeeded (cyclomatic 31) · ×1
  • AtriaBLEManager.startOneShotHistoryTrimIfNeeded (cyclomatic 31) REDACTED:41546 — AtriaBLEManager.startOneShotHistoryTrimIfNeeded has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBehaviorImpact.summariesCancellable (cyclomatic 31) · ×1
  • AtriaBehaviorImpact.summariesCancellable (cyclomatic 31) Atria/Atria/AtriaBehaviorImpact.swift:46 — AtriaBehaviorImpact.summariesCancellable has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveCatalogStore.recordCompressedStorage (cyclomatic 31) · ×1
  • AtriaHistoricalArchiveCatalogStore.recordCompressedStorage (cyclomatic 31) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:413 — AtriaHistoricalArchiveCatalogStore.recordCompressedStorage has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaSyncProgressFooterPresentation.footer (cyclomatic 31) · ×1
  • AtriaSyncProgressFooterPresentation.footer (cyclomatic 31) Atria/Atria/AtriaHomeView.swift:7283 — AtriaSyncProgressFooterPresentation.footer has cyclomatic complexity 31 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaSleepWakeResearch.stageSegmentsCore (cyclomatic 31) · ×1
  • AtriaSleepWakeResearch.stageSegmentsCore (cyclomatic 31) Atria/Atria/AtriaSleepWakeResearch.swift:335 — AtriaSleepWakeResearch.stageSegmentsCore has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.quickMetricReadinessProbe (cyclomatic 31) · ×1
  • HistoricalArchive.quickMetricReadinessProbe (cyclomatic 31) Atria/Atria/HistoricalArchive.swift:3248 — HistoricalArchive.quickMetricReadinessProbe has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaScanRecordParser.parseRecord (cyclomatic 31) · ×1
  • AtriaScanRecordParser.parseRecord (cyclomatic 31) Atria/Atria/HistoricalArchive.swift:10937 — AtriaScanRecordParser.parseRecord has cyclomatic complexity 31 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SavedSession.qualifiedLnRMSSDWindowsCore (cyclomatic 31) · ×1
  • SavedSession.qualifiedLnRMSSDWindowsCore (cyclomatic 31) Atria/Atria/Sessions.swift:1797 — SavedSession.qualifiedLnRMSSDWindowsCore has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SavedSession.detectedActivity (cyclomatic 31) · ×1
  • SavedSession.detectedActivity (cyclomatic 31) Atria/Atria/Sessions.swift:7806 — SavedSession.detectedActivity has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.reducedConfidenceUnconfirmedRecoveryInput (cyclomatic 31) · ×1
  • SessionStore.reducedConfidenceUnconfirmedRecoveryInput (cyclomatic 31) Atria/Atria/Sessions.swift:24261 — SessionStore.reducedConfidenceUnconfirmedRecoveryInput has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.observedHeartRateUnionSecondsCancellable (cyclomatic 31) · ×1
  • SessionStore.observedHeartRateUnionSecondsCancellable (cyclomatic 31) Atria/Atria/Sessions.swift:24381 — SessionStore.observedHeartRateUnionSecondsCancellable has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.homeSavedAggregateCancellable (cyclomatic 31) · ×1
  • SessionStore.homeSavedAggregateCancellable (cyclomatic 31) Atria/Atria/Sessions.swift:27053 — SessionStore.homeSavedAggregateCancellable has cyclomatic complexity 31 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded (cyclomatic 30) · ×1
  • AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded (cyclomatic 30) REDACTED:11876 — AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.recordHeartRateMeasurement (cyclomatic 30) · ×1
  • AtriaBLEManager.recordHeartRateMeasurement (cyclomatic 30) REDACTED:31545 — AtriaBLEManager.recordHeartRateMeasurement has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalVerifiedConsumerReader.readSource (cyclomatic 30) · ×1
  • AtriaHistoricalVerifiedConsumerReader.readSource (cyclomatic 30) Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:136 — AtriaHistoricalVerifiedConsumerReader.readSource has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHomeModel.makeDeferredDetails (cyclomatic 30) · ×1
  • AtriaHomeModel.makeDeferredDetails (cyclomatic 30) Atria/Atria/AtriaHomeView.swift:13627 — AtriaHomeModel.makeDeferredDetails has cyclomatic complexity 30 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaR10MotionPipeline.accept (cyclomatic 30) · ×1
  • AtriaR10MotionPipeline.accept (cyclomatic 30) Atria/Atria/AtriaR10Motion.swift:1829 — AtriaR10MotionPipeline.accept has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures (cyclomatic 30) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures (cyclomatic 30) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:923 — AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify (cyclomatic 30) · ×1
  • AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify (cyclomatic 30) Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:41 — AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.automaticRecoveredDataBootstrapSourceImage (cyclomatic 30) · ×1
  • HistoricalArchive.automaticRecoveredDataBootstrapSourceImage (cyclomatic 30) Atria/Atria/HistoricalArchive.swift:4594 — HistoricalArchive.automaticRecoveredDataBootstrapSourceImage has cyclomatic complexity 30 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SavedSession.loadPointsCancellable (cyclomatic 30) · ×1
  • SavedSession.loadPointsCancellable (cyclomatic 30) Atria/Atria/Sessions.swift:2628 — SavedSession.loadPointsCancellable has cyclomatic complexity 30 (threshold 15). Of this number, 20 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeOverviewTrendPointsCancellable (cyclomatic 30) · ×1
  • SessionStore.makeOverviewTrendPointsCancellable (cyclomatic 30) Atria/Atria/Sessions.swift:20568 — SessionStore.makeOverviewTrendPointsCancellable has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.editConfirmedWorkout (cyclomatic 30) · ×1
  • SessionStore.editConfirmedWorkout (cyclomatic 30) Atria/Atria/Sessions.swift:35971 — SessionStore.editConfirmedWorkout has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.freezingAdaptiveSleepNeed (cyclomatic 30) · ×1
  • SessionStore.freezingAdaptiveSleepNeed (cyclomatic 30) Atria/Atria/Sessions.swift:44447 — SessionStore.freezingAdaptiveSleepNeed has cyclomatic complexity 30 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload (cyclomatic 29) · ×1
  • AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload (cyclomatic 29) REDACTED:38805 — AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.completeHistoricalACKAcceptance (cyclomatic 29) · ×1
  • AtriaBLEManager.completeHistoricalACKAcceptance (cyclomatic 29) REDACTED:49388 — AtriaBLEManager.completeHistoricalACKAcceptance has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoveragePolicy.evaluate (cyclomatic 29) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.evaluate (cyclomatic 29) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:299 — AtriaHistoricalFullDrainCoveragePolicy.evaluate has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalLongTermRollup.validate (cyclomatic 29) · ×1
  • AtriaHistoricalLongTermRollup.validate (cyclomatic 29) Atria/Atria/AtriaHistoricalLongTermRollup.swift:277 — AtriaHistoricalLongTermRollup.validate has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaStressMonitorStore.mergeHistoricalMinuteFacts (cyclomatic 29) · ×1
  • AtriaStressMonitorStore.mergeHistoricalMinuteFacts (cyclomatic 29) Atria/Atria/AtriaStressMonitor.swift:4030 — AtriaStressMonitorStore.mergeHistoricalMinuteFacts has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4ExactRangeTrialHarness.validateStored (cyclomatic 29) · ×1
  • AtriaWhoop4ExactRangeTrialHarness.validateStored (cyclomatic 29) Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1068 — AtriaWhoop4ExactRangeTrialHarness.validateStored has cyclomatic complexity 29 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoryArchivePipeline.prepare (cyclomatic 29) · ×1
  • AtriaWhoop4HistoryArchivePipeline.prepare (cyclomatic 29) Atria/Atria/AtriaWhoop4HistoryArchivePipeline.swift:43 — AtriaWhoop4HistoryArchivePipeline.prepare has cyclomatic complexity 29 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWorkoutRouteStore.reconcile (cyclomatic 29) · ×1
  • AtriaWorkoutRouteStore.reconcile (cyclomatic 29) Atria/Atria/AtriaWorkoutRoute.swift:1346 — AtriaWorkoutRouteStore.reconcile has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HRVAnalyzer.analyze (cyclomatic 29) · ×1
  • HRVAnalyzer.analyze (cyclomatic 29) Atria/Atria/HRV.swift:400 — HRVAnalyzer.analyze has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.commitPreparedWakeBoundarySleepIfUseful (cyclomatic 29) · ×1
  • SessionStore.commitPreparedWakeBoundarySleepIfUseful (cyclomatic 29) Atria/Atria/Sessions.swift:41734 — SessionStore.commitPreparedWakeBoundarySleepIfUseful has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.rebasedRecoveredConfirmedSleepsCancellable (cyclomatic 29) · ×1
  • SessionStore.rebasedRecoveredConfirmedSleepsCancellable (cyclomatic 29) Atria/Atria/Sessions.swift:44982 — SessionStore.rebasedRecoveredConfirmedSleepsCancellable has cyclomatic complexity 29 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaActivityWorkoutDetailSheet.body (cyclomatic 28) · ×1
  • AtriaActivityWorkoutDetailSheet.body (cyclomatic 28) Atria/Atria/AtriaActivityMonitor.swift:4025 — AtriaActivityWorkoutDetailSheet.body has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority (cyclomatic 28) · ×1
  • AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority (cyclomatic 28) REDACTED:12023 — AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery (cyclomatic 28) · ×1
  • AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery (cyclomatic 28) REDACTED:12782 — AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation (cyclomatic 28) · ×1
  • AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation (cyclomatic 28) REDACTED:20076 — AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked (cyclomatic 28) · ×1
  • AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked (cyclomatic 28) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:281 — AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked has cyclomatic complexity 28 (threshold 15). Of this number, 15 points are the body's own statements and 13 belong to 3 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHomeView.updateWorkoutDetectionPrompt (cyclomatic 28) · ×1
  • AtriaHomeView.updateWorkoutDetectionPrompt (cyclomatic 28) Atria/Atria/AtriaHomeView.swift:3949 — AtriaHomeView.updateWorkoutDetectionPrompt has cyclomatic complexity 28 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaIMUDiagnosticTransport.notifyDecision (cyclomatic 28) · ×1
  • AtriaIMUDiagnosticTransport.notifyDecision (cyclomatic 28) Atria/Atria/AtriaIMUDiagnosticTransport.swift:971 — AtriaIMUDiagnosticTransport.notifyDecision has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaPreparedMetricHistory.init (cyclomatic 28) · ×1
  • AtriaPreparedMetricHistory.init (cyclomatic 28) Atria/Atria/AtriaOverviewSections.swift:9109 — AtriaPreparedMetricHistory.init has cyclomatic complexity 28 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaRecoveredHeartRateProjection.projectCancellable (cyclomatic 28) · ×1
  • AtriaRecoveredHeartRateProjection.projectCancellable (cyclomatic 28) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:264 — AtriaRecoveredHeartRateProjection.projectCancellable has cyclomatic complexity 28 (threshold 15). Of this number, 21 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStrapStepLedger.isValid (cyclomatic 28) · ×1
  • AtriaStrapStepLedger.isValid (cyclomatic 28) Atria/Atria/AtriaStrapStepLedger.swift:351 — AtriaStrapStepLedger.isValid has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts (cyclomatic 28) · ×1
  • AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts (cyclomatic 28) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1436 — AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts has cyclomatic complexity 28 (threshold 15). Of this number, 20 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SavedSession.detectedSleepOrRestActivityCancellable (cyclomatic 28) · ×1
  • SavedSession.detectedSleepOrRestActivityCancellable (cyclomatic 28) Atria/Atria/Sessions.swift:7894 — SavedSession.detectedSleepOrRestActivityCancellable has cyclomatic complexity 28 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.physiologicalCycleStrainByDisplayDayCancellable (cyclomatic 28) · ×1
  • SessionStore.physiologicalCycleStrainByDisplayDayCancellable (cyclomatic 28) Atria/Atria/Sessions.swift:13686 — SessionStore.physiologicalCycleStrainByDisplayDayCancellable has cyclomatic complexity 28 (threshold 15). Of this number, 23 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeTodayHRZoneMinutesCancellable (cyclomatic 28) · ×1
  • SessionStore.makeTodayHRZoneMinutesCancellable (cyclomatic 28) Atria/Atria/Sessions.swift:20805 — SessionStore.makeTodayHRZoneMinutesCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeIncrementalRecoveredHistorySnapshots (cyclomatic 28) · ×1
  • SessionStore.makeIncrementalRecoveredHistorySnapshots (cyclomatic 28) Atria/Atria/Sessions.swift:21143 — SessionStore.makeIncrementalRecoveredHistorySnapshots 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.scheduleSleepReviewCacheRefresh (cyclomatic 28) · ×1
  • SessionStore.scheduleSleepReviewCacheRefresh (cyclomatic 28) Atria/Atria/Sessions.swift:36749 — SessionStore.scheduleSleepReviewCacheRefresh 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ActiveSessionJournal.saveIncremental (cyclomatic 27) · ×1
  • ActiveSessionJournal.saveIncremental (cyclomatic 27) Atria/Atria/ActiveSessionJournal.swift:441 — ActiveSessionJournal.saveIncremental has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaApp.body (cyclomatic 27) · ×1
  • AtriaApp.body (cyclomatic 27) Atria/Atria/AtriaApp.swift:465 — AtriaApp.body has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaApp.handleBackgroundTask (cyclomatic 27) · ×1
  • AtriaApp.handleBackgroundTask (cyclomatic 27) Atria/Atria/AtriaApp.swift:798 — AtriaApp.handleBackgroundTask has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.recoverAcceptedHRWatchdog (cyclomatic 27) · ×1
  • AtriaBLEManager.recoverAcceptedHRWatchdog (cyclomatic 27) REDACTED:26490 — AtriaBLEManager.recoverAcceptedHRWatchdog has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget (cyclomatic 27) · ×1
  • AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget (cyclomatic 27) REDACTED:37410 — AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized (cyclomatic 27) · ×1
  • AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized (cyclomatic 27) REDACTED:49004 — AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.resilientHistoryDrainSeekUnix (cyclomatic 27) · ×1
  • AtriaBLEManager.resilientHistoryDrainSeekUnix (cyclomatic 27) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2820 — AtriaBLEManager.resilientHistoryDrainSeekUnix has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalCanonicalConsumerDestinationStore.verify (cyclomatic 27) · ×1
  • AtriaHistoricalCanonicalConsumerDestinationStore.verify (cyclomatic 27) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:214 — AtriaHistoricalCanonicalConsumerDestinationStore.verify has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalJSONLRecentScanner.scan (cyclomatic 27) · ×1
  • AtriaHistoricalJSONLRecentScanner.scan (cyclomatic 27) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:129 — AtriaHistoricalJSONLRecentScanner.scan has cyclomatic complexity 27 (threshold 15). Of this number, 20 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt (cyclomatic 27) · ×1
  • AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt (cyclomatic 27) Atria/Atria/AtriaHistoricalReplayIdentityShard.swift:175 — AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalWorkoutProjection.detectCandidates (cyclomatic 27) · ×1
  • AtriaHistoricalWorkoutProjection.detectCandidates (cyclomatic 27) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:952 — AtriaHistoricalWorkoutProjection.detectCandidates has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaHomeView.updateLiveActivity (cyclomatic 27) · ×1
  • AtriaHomeView.updateLiveActivity (cyclomatic 27) Atria/Atria/AtriaHomeView.swift:3533 — AtriaHomeView.updateLiveActivity has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaLiveWorkoutView.workoutActionsCard (cyclomatic 27) · ×1
  • AtriaLiveWorkoutView.workoutActionsCard (cyclomatic 27) Atria/Atria/AtriaLiveWorkoutView.swift:2845 — AtriaLiveWorkoutView.workoutActionsCard has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence (cyclomatic 27) · ×1
  • HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence (cyclomatic 27) Atria/Atria/HistoricalArchive.swift:5198 — HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence has cyclomatic complexity 27 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.gravitySample (cyclomatic 27) · ×1
  • HistoricalArchive.gravitySample (cyclomatic 27) Atria/Atria/HistoricalArchive.swift:9273 — HistoricalArchive.gravitySample has cyclomatic complexity 27 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SavedSession.sleepRespiratoryRateCancellable (cyclomatic 27) · ×1
  • SavedSession.sleepRespiratoryRateCancellable (cyclomatic 27) Atria/Atria/Sessions.swift:2145 — SavedSession.sleepRespiratoryRateCancellable has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.scheduleConfirmedWorkoutStepEvidencePublication (cyclomatic 27) · ×1
  • SessionStore.scheduleConfirmedWorkoutStepEvidencePublication (cyclomatic 27) Atria/Atria/Sessions.swift:20190 — SessionStore.scheduleConfirmedWorkoutStepEvidencePublication 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeHistorySnapshotsCancellable (cyclomatic 27) · ×1
  • SessionStore.makeHistorySnapshotsCancellable (cyclomatic 27) Atria/Atria/Sessions.swift:20953 — SessionStore.makeHistorySnapshotsCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeSavedDailyMetricsCancellable (cyclomatic 27) · ×1
  • SessionStore.makeSavedDailyMetricsCancellable (cyclomatic 27) Atria/Atria/Sessions.swift:23333 — SessionStore.makeSavedDailyMetricsCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.compactHistoricalArchiveIfUseful (cyclomatic 27) · ×1
  • SessionStore.compactHistoricalArchiveIfUseful (cyclomatic 27) Atria/Atria/Sessions.swift:28569 — SessionStore.compactHistoricalArchiveIfUseful has cyclomatic complexity 27 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.rebasedConfirmedSleepsCancellable (cyclomatic 27) · ×1
  • SessionStore.rebasedConfirmedSleepsCancellable (cyclomatic 27) Atria/Atria/Sessions.swift:44908 — SessionStore.rebasedConfirmedSleepsCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.deferredLaunchCardSettlementMatches (cyclomatic 27) · ×1
  • SessionStore.deferredLaunchCardSettlementMatches (cyclomatic 27) Atria/Atria/Sessions.swift:57511 — SessionStore.deferredLaunchCardSettlementMatches has cyclomatic complexity 27 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.noteLeftoverFlushNotifyState (cyclomatic 26) · ×1
  • AtriaBLEManager.noteLeftoverFlushNotifyState (cyclomatic 26) REDACTED:8952 — AtriaBLEManager.noteLeftoverFlushNotifyState has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded (cyclomatic 26) · ×1
  • AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded (cyclomatic 26) REDACTED:14783 — AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp (cyclomatic 26) · ×1
  • AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp (cyclomatic 26) REDACTED:24356 — AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.retryProtectedR10ShortBurstIfEligible (cyclomatic 26) · ×1
  • AtriaBLEManager.retryProtectedR10ShortBurstIfEligible (cyclomatic 26) REDACTED:34777 — AtriaBLEManager.retryProtectedR10ShortBurstIfEligible has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.gate4DailyBankRearmPolicyInput (cyclomatic 26) · ×1
  • AtriaBLEManager.gate4DailyBankRearmPolicyInput (cyclomatic 26) REDACTED:36640 — AtriaBLEManager.gate4DailyBankRearmPolicyInput has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleUnknownProtocolPayload (cyclomatic 26) · ×1
  • AtriaBLEManager.handleUnknownProtocolPayload (cyclomatic 26) REDACTED:43712 — AtriaBLEManager.handleUnknownProtocolPayload has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalLongTermStore.verifiedRetirementCandidates (cyclomatic 26) · ×1
  • AtriaHistoricalLongTermStore.verifiedRetirementCandidates (cyclomatic 26) Atria/Atria/AtriaHistoricalLongTermRollup.swift:864 — AtriaHistoricalLongTermStore.verifiedRetirementCandidates has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaIrregularRhythmAssessment.evaluate (cyclomatic 26) · ×1
  • AtriaIrregularRhythmAssessment.evaluate (cyclomatic 26) Atria/Atria/AtriaIrregularRhythm.swift:121 — AtriaIrregularRhythmAssessment.evaluate has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.qualifiedActivityContexts (cyclomatic 26) · ×1
  • AtriaHistoricalStressReplay.qualifiedActivityContexts (cyclomatic 26) Atria/Atria/AtriaStressMonitor.swift:2382 — AtriaHistoricalStressReplay.qualifiedActivityContexts has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.appendRecoveredRecord (cyclomatic 26) · ×1
  • HistoricalArchive.appendRecoveredRecord (cyclomatic 26) Atria/Atria/HistoricalArchive.swift:6765 — HistoricalArchive.appendRecoveredRecord has cyclomatic complexity 26 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.exactMetricHeartRatePoints (cyclomatic 26) · ×1
  • HistoricalArchive.exactMetricHeartRatePoints (cyclomatic 26) Atria/Atria/HistoricalArchive.swift:7564 — HistoricalArchive.exactMetricHeartRatePoints has cyclomatic complexity 26 (threshold 15). Of this number, 19 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.stressReplaySessionInputShrank (cyclomatic 26) · ×1
  • SessionStore.stressReplaySessionInputShrank (cyclomatic 26) Atria/Atria/Sessions.swift:9063 — SessionStore.stressReplaySessionInputShrank has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.stressReplaySessionInputGrew (cyclomatic 26) · ×1
  • SessionStore.stressReplaySessionInputGrew (cyclomatic 26) Atria/Atria/Sessions.swift:9102 — SessionStore.stressReplaySessionInputGrew has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.refreshHistorySnapshotCache (cyclomatic 26) · ×1
  • SessionStore.refreshHistorySnapshotCache (cyclomatic 26) Atria/Atria/Sessions.swift:11739 — SessionStore.refreshHistorySnapshotCache 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe (cyclomatic 26) · ×1
  • SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe (cyclomatic 26) Atria/Atria/Sessions.swift:12099 — SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe has cyclomatic complexity 26 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.mergeCanonicalHistoricalDetectionsCancellable (cyclomatic 26) · ×1
  • SessionStore.mergeCanonicalHistoricalDetectionsCancellable (cyclomatic 26) Atria/Atria/Sessions.swift:21391 — SessionStore.mergeCanonicalHistoricalDetectionsCancellable has cyclomatic complexity 26 (threshold 15). Of this number, 24 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.mergeDailyMetricHistory (cyclomatic 26) · ×1
  • SessionStore.mergeDailyMetricHistory (cyclomatic 26) Atria/Atria/Sessions.swift:23591 — SessionStore.mergeDailyMetricHistory 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.deriveInsightsCancellable (cyclomatic 26) · ×1
  • SessionStore.deriveInsightsCancellable (cyclomatic 26) Atria/Atria/Sessions.swift:25028 — SessionStore.deriveInsightsCancellable has cyclomatic complexity 26 (threshold 15). Of this number, 23 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.pendingSleepRecoveryEstimate (cyclomatic 26) · ×1
  • SessionStore.pendingSleepRecoveryEstimate (cyclomatic 26) Atria/Atria/Sessions.swift:26094 — SessionStore.pendingSleepRecoveryEstimate has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.biologicalAgeSummary (cyclomatic 26) · ×1
  • SessionStore.biologicalAgeSummary (cyclomatic 26) Atria/Atria/Sessions.swift:52456 — SessionStore.biologicalAgeSummary has cyclomatic complexity 26 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.requestStrapStatusRead (cyclomatic 25) · ×1
  • AtriaBLEManager.requestStrapStatusRead (cyclomatic 25) REDACTED:10451 — AtriaBLEManager.requestStrapStatusRead has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.logClockCommandResponse (cyclomatic 25) · ×1
  • AtriaBLEManager.logClockCommandResponse (cyclomatic 25) REDACTED:32138 — AtriaBLEManager.logClockCommandResponse has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaDailyStepPresentation.detailText (cyclomatic 25) · ×1
  • AtriaDailyStepPresentation.detailText (cyclomatic 25) Atria/Atria/AtriaDailyStepPresentation.swift:342 — AtriaDailyStepPresentation.detailText has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaDaytimeQuiescentSleepDetector.detect (cyclomatic 25) · ×1
  • AtriaDaytimeQuiescentSleepDetector.detect (cyclomatic 25) Atria/Atria/AtriaDaytimeQuiescentSleepDetector.swift:135 — AtriaDaytimeQuiescentSleepDetector.detect has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex (cyclomatic 25) · ×1
  • AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex (cyclomatic 25) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1355 — AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers (cyclomatic 25) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers (cyclomatic 25) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:598 — AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalLongTermRollup.validate (cyclomatic 25) · ×1
  • AtriaHistoricalLongTermRollup.validate (cyclomatic 25) Atria/Atria/AtriaHistoricalLongTermRollup.swift:314 — AtriaHistoricalLongTermRollup.validate has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaIMUDiagnosticTransport.writeDecision (cyclomatic 25) · ×1
  • AtriaIMUDiagnosticTransport.writeDecision (cyclomatic 25) Atria/Atria/AtriaIMUDiagnosticTransport.swift:716 — AtriaIMUDiagnosticTransport.writeDecision has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStrapStepLedger.reconciledCheckpoint (cyclomatic 25) · ×1
  • AtriaStrapStepLedger.reconciledCheckpoint (cyclomatic 25) Atria/Atria/AtriaStrapStepLedger.swift:411 — AtriaStrapStepLedger.reconciledCheckpoint has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HealthKitExporter.plannedCounts (cyclomatic 25) · ×1
  • HealthKitExporter.plannedCounts (cyclomatic 25) Atria/Atria/HealthKitExporter.swift:896 — HealthKitExporter.plannedCounts has cyclomatic complexity 25 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.motionTickDayEvidenceReadImpl · ×1
  • HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine (cyclomatic 25) Atria/Atria/HistoricalArchive.swift:3813 — HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine 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. This shape REPEATS in the file: one other method here (HistoricalArchive.motionTickDayEvidenceReadImpl) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D1 · Cyclomatic Complexity · HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan (cyclomatic 25) · ×1
  • HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan (cyclomatic 25) Atria/Atria/HistoricalArchive.swift:4394 — HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan has cyclomatic complexity 25 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.makeHistoryTrendSummariesCancellable (cyclomatic 25) · ×1
  • SessionStore.makeHistoryTrendSummariesCancellable (cyclomatic 25) Atria/Atria/Sessions.swift:22456 — SessionStore.makeHistoryTrendSummariesCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmSleepHistoryNight (cyclomatic 25) · ×1
  • SessionStore.confirmSleepHistoryNight (cyclomatic 25) Atria/Atria/Sessions.swift:38198 — SessionStore.confirmSleepHistoryNight 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.beginFreshHistoryOwnerCutover (cyclomatic 24) · ×1
  • AtriaBLEManager.beginFreshHistoryOwnerCutover (cyclomatic 24) REDACTED:14590 — AtriaBLEManager.beginFreshHistoryOwnerCutover has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.startScan (cyclomatic 24) · ×1
  • AtriaBLEManager.startScan (cyclomatic 24) REDACTED:27296 — AtriaBLEManager.startScan has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart (cyclomatic 24) · ×1
  • AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart (cyclomatic 24) REDACTED:44911 — AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaManifestedColdSessionCompaction.compactAndRetire (cyclomatic 24) · ×1
  • AtriaManifestedColdSessionCompaction.compactAndRetire (cyclomatic 24) Atria/Atria/AtriaColdSessionMigration.swift:311 — AtriaManifestedColdSessionCompaction.compactAndRetire has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalActivityProjection.validatedInspectionEvidence (cyclomatic 24) · ×1
  • AtriaHistoricalActivityProjection.validatedInspectionEvidence (cyclomatic 24) Atria/Atria/AtriaHistoricalActivityProjection.swift:417 — AtriaHistoricalActivityProjection.validatedInspectionEvidence has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet (cyclomatic 24) · ×1
  • AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet (cyclomatic 24) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:313 — AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet has cyclomatic complexity 24 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory (cyclomatic 24) · ×1
  • AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory (cyclomatic 24) Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:145 — AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalSealedJSONLCompression.commit (cyclomatic 24) · ×1
  • AtriaHistoricalSealedJSONLCompression.commit (cyclomatic 24) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:90 — AtriaHistoricalSealedJSONLCompression.commit has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHistoricalSleepProjection.detectCandidates (cyclomatic 24) · ×1
  • AtriaHistoricalSleepProjection.detectCandidates (cyclomatic 24) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:548 — AtriaHistoricalSleepProjection.detectCandidates has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHomeView.scheduleLiveSensorWidgetPatch (cyclomatic 24) · ×1
  • AtriaHomeView.scheduleLiveSensorWidgetPatch (cyclomatic 24) Atria/Atria/AtriaHomeView.swift:3860 — AtriaHomeView.scheduleLiveSensorWidgetPatch has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaConnectionDiagnosis.derive (cyclomatic 24) · ×1
  • AtriaConnectionDiagnosis.derive (cyclomatic 24) Atria/Atria/AtriaHomeView.swift:14794 — AtriaConnectionDiagnosis.derive has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaNightMinuteBuilder.build (cyclomatic 24) · ×1
  • AtriaNightMinuteBuilder.build (cyclomatic 24) Atria/Atria/AtriaNightMinuteBuilder.swift:83 — AtriaNightMinuteBuilder.build has cyclomatic complexity 24 (threshold 15). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.fillingHeartRateHoles (cyclomatic 24) · ×1
  • AtriaHistoricalStressReplay.fillingHeartRateHoles (cyclomatic 24) Atria/Atria/AtriaStressMonitor.swift:1813 — AtriaHistoricalStressReplay.fillingHeartRateHoles has cyclomatic complexity 24 (threshold 15). Of this number, 13 points are the body's own statements and 11 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaShortWindowRMSSD.value (cyclomatic 24) · ×1
  • AtriaShortWindowRMSSD.value (cyclomatic 24) Atria/Atria/HRV.swift:325 — AtriaShortWindowRMSSD.value has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.motionWindowReadableFileURLs (cyclomatic 24) · ×1
  • HistoricalArchive.motionWindowReadableFileURLs (cyclomatic 24) Atria/Atria/HistoricalArchive.swift:8014 — HistoricalArchive.motionWindowReadableFileURLs has cyclomatic complexity 24 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AutomaticRecoveredDataBootstrapCheckpoint.init (cyclomatic 24) · ×1
  • AutomaticRecoveredDataBootstrapCheckpoint.init (cyclomatic 24) Atria/Atria/HistoricalArchive.swift:670 — AutomaticRecoveredDataBootstrapCheckpoint.init has cyclomatic complexity 24 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalNotificationScheduler.schedule (cyclomatic 24) · ×1
  • LocalNotificationScheduler.schedule (cyclomatic 24) Atria/Atria/LocalNotificationScheduler.swift:1167 — LocalNotificationScheduler.schedule has cyclomatic complexity 24 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SavedSession.qualifiedLnRMSSDCore (cyclomatic 24) · ×1
  • SavedSession.qualifiedLnRMSSDCore (cyclomatic 24) Atria/Atria/Sessions.swift:1978 — SavedSession.qualifiedLnRMSSDCore 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SavedSession.dailyLoadTRIMPCancellable (cyclomatic 24) · ×1
  • SavedSession.dailyLoadTRIMPCancellable (cyclomatic 24) Atria/Atria/Sessions.swift:2481 — SavedSession.dailyLoadTRIMPCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaSleepStageIntegrity.validatesCancellable (cyclomatic 24) · ×1
  • AtriaSleepStageIntegrity.validatesCancellable (cyclomatic 24) Atria/Atria/Sessions.swift:4203 — AtriaSleepStageIntegrity.validatesCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.protectedR10RecoveryDecision (cyclomatic 23) · ×1
  • AtriaBLEManager.protectedR10RecoveryDecision (cyclomatic 23) REDACTED:4063 — AtriaBLEManager.protectedR10RecoveryDecision has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt (cyclomatic 23) · ×1
  • AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt (cyclomatic 23) REDACTED:4747 — AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.updateDutyCycleState (cyclomatic 23) · ×1
  • AtriaBLEManager.updateDutyCycleState (cyclomatic 23) REDACTED:10326 — AtriaBLEManager.updateDutyCycleState has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.median (cyclomatic 23) · ×1
  • AtriaBLEManager.median (cyclomatic 23) REDACTED:31761 — AtriaBLEManager.median has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.recordResearchProbeCandidate (cyclomatic 23) · ×1
  • AtriaBLEManager.recordResearchProbeCandidate (cyclomatic 23) REDACTED:44592 — AtriaBLEManager.recordResearchProbeCandidate has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleHistorySequenceConfirmationRetry (cyclomatic 23) · ×1
  • AtriaBLEManager.scheduleHistorySequenceConfirmationRetry (cyclomatic 23) REDACTED:46370 — AtriaBLEManager.scheduleHistorySequenceConfirmationRetry has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated (cyclomatic 23) · ×1
  • AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated (cyclomatic 23) Atria/Atria/AtriaStrapPowerPolicy.swift:388 — AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBehaviorImpactPresentation.model (cyclomatic 23) · ×1
  • AtriaBehaviorImpactPresentation.model (cyclomatic 23) Atria/Atria/AtriaBehaviorImpactPresentation.swift:282 — AtriaBehaviorImpactPresentation.model has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveCatalog.validate (cyclomatic 23) · ×1
  • AtriaHistoricalArchiveCatalog.validate (cyclomatic 23) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:58 — AtriaHistoricalArchiveCatalog.validate has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.decoratedIdentity (cyclomatic 23) · ×1
  • AtriaHistoricalArchiveDurableStore.decoratedIdentity (cyclomatic 23) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2362 — AtriaHistoricalArchiveDurableStore.decoratedIdentity has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalDailyConsumerProjection.stepDays (cyclomatic 23) · ×1
  • AtriaHistoricalDailyConsumerProjection.stepDays (cyclomatic 23) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:613 — AtriaHistoricalDailyConsumerProjection.stepDays has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalSessionInspectionProof.validatedEvidence (cyclomatic 23) · ×1
  • AtriaHistoricalSessionInspectionProof.validatedEvidence (cyclomatic 23) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:60 — AtriaHistoricalSessionInspectionProof.validatedEvidence has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaJournalInsights.insightsCancellable (cyclomatic 23) · ×1
  • AtriaJournalInsights.insightsCancellable (cyclomatic 23) Atria/Atria/AtriaJournalInsights.swift:164 — AtriaJournalInsights.insightsCancellable has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaLearnedInsight.emphasisLabel (cyclomatic 23) · ×1
  • AtriaLearnedInsight.emphasisLabel (cyclomatic 23) Atria/Atria/AtriaLearnedInsights.swift:85 — AtriaLearnedInsight.emphasisLabel has cyclomatic complexity 23 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · MinuteFact.isStructurallyValid (cyclomatic 23) · ×1
  • MinuteFact.isStructurallyValid (cyclomatic 23) Atria/Atria/AtriaPhysiologicalStressModel.swift:284 — MinuteFact.isStructurallyValid has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · Tracker.observe (cyclomatic 23) · ×1
  • Tracker.observe (cyclomatic 23) Atria/Atria/AtriaStrapSetup.swift:152 — Tracker.observe has cyclomatic complexity 23 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked (cyclomatic 23) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked (cyclomatic 23) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1294 — AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked has cyclomatic complexity 23 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HealthKitExporter.queryHeartRateExportReadback (cyclomatic 23) · ×1
  • HealthKitExporter.queryHeartRateExportReadback (cyclomatic 23) Atria/Atria/HealthKitExporter.swift:1565 — HealthKitExporter.queryHeartRateExportReadback has cyclomatic complexity 23 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HistoricalArchive.readVerifiedCanonicalConsumerSourcePage (cyclomatic 23) · ×1
  • HistoricalArchive.readVerifiedCanonicalConsumerSourcePage (cyclomatic 23) Atria/Atria/HistoricalArchive.swift:6122 — HistoricalArchive.readVerifiedCanonicalConsumerSourcePage has cyclomatic complexity 23 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · SessionStore.runRecoveredVerifiedActivityShadowStep (cyclomatic 23) · ×1
  • SessionStore.runRecoveredVerifiedActivityShadowStep (cyclomatic 23) Atria/Atria/Sessions.swift:19241 — SessionStore.runRecoveredVerifiedActivityShadowStep 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeDailyRollupStoreEntriesCancellable (cyclomatic 23) · ×1
  • SessionStore.makeDailyRollupStoreEntriesCancellable (cyclomatic 23) Atria/Atria/Sessions.swift:24073 — SessionStore.makeDailyRollupStoreEntriesCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.archiveOnlyHeartRateSegments (cyclomatic 23) · ×1
  • SessionStore.archiveOnlyHeartRateSegments (cyclomatic 23) Atria/Atria/Sessions.swift:27526 — SessionStore.archiveOnlyHeartRateSegments 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmBestWorkoutCandidate (cyclomatic 23) · ×1
  • SessionStore.confirmBestWorkoutCandidate (cyclomatic 23) Atria/Atria/Sessions.swift:33666 — SessionStore.confirmBestWorkoutCandidate 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.boundedSleepReviewAuthorities (cyclomatic 23) · ×1
  • SessionStore.boundedSleepReviewAuthorities (cyclomatic 23) Atria/Atria/Sessions.swift:37118 — SessionStore.boundedSleepReviewAuthorities has cyclomatic complexity 23 (threshold 15). Of this number, 22 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.sustainedWakeOnsetCore (cyclomatic 23) · ×1
  • SessionStore.sustainedWakeOnsetCore (cyclomatic 23) Atria/Atria/Sessions.swift:41289 — SessionStore.sustainedWakeOnsetCore has cyclomatic complexity 23 (threshold 15). Of this number, 18 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmedSleepWindowMetricsCore (cyclomatic 23) · ×1
  • SessionStore.confirmedSleepWindowMetricsCore (cyclomatic 23) Atria/Atria/Sessions.swift:43185 — SessionStore.confirmedSleepWindowMetricsCore 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.windowedWorkoutCandidates (cyclomatic 23) · ×1
  • SessionStore.windowedWorkoutCandidates (cyclomatic 23) Atria/Atria/Sessions.swift:49467 — SessionStore.windowedWorkoutCandidates 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.cooperativeRecoveredMotionSleepProvenance (cyclomatic 23) · ×1
  • SessionStore.cooperativeRecoveredMotionSleepProvenance (cyclomatic 23) Atria/Atria/Sessions.swift:51405 — SessionStore.cooperativeRecoveredMotionSleepProvenance 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Strain.contiguousSegments (cyclomatic 22) · ×1
  • Strain.contiguousSegments (cyclomatic 22) Atria/Atria/AtriaAnalytics.swift:1139 — Strain.contiguousSegments has cyclomatic complexity 22 (threshold 15). Of this number, 21 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.allDayCompactIMURecoveryStep (cyclomatic 22) · ×1
  • AtriaBLEManager.allDayCompactIMURecoveryStep (cyclomatic 22) REDACTED:33023 — AtriaBLEManager.allDayCompactIMURecoveryStep has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldAllowProtectedTransportCommand (cyclomatic 22) · ×1
  • AtriaBLEManager.shouldAllowProtectedTransportCommand (cyclomatic 22) REDACTED:33336 — AtriaBLEManager.shouldAllowProtectedTransportCommand has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation (cyclomatic 22) · ×1
  • AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation (cyclomatic 22) REDACTED:33671 — AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps (cyclomatic 22) · ×1
  • AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps (cyclomatic 22) REDACTED:47774 — AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.parseProprietaryUpdate (cyclomatic 22) · ×1
  • AtriaBLEManager.parseProprietaryUpdate (cyclomatic 22) REDACTED:57667 — AtriaBLEManager.parseProprietaryUpdate has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalActivityInspectionProofFactory.prepareVerified (cyclomatic 22) · ×1
  • AtriaHistoricalActivityInspectionProofFactory.prepareVerified (cyclomatic 22) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:583 — AtriaHistoricalActivityInspectionProofFactory.prepareVerified has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalAggregateChunk.validateForCommit (cyclomatic 22) · ×1
  • AtriaHistoricalAggregateChunk.validateForCommit (cyclomatic 22) Atria/Atria/AtriaHistoricalAggregateChunk.swift:178 — AtriaHistoricalAggregateChunk.validateForCommit has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.flush (cyclomatic 22) · ×1
  • AtriaHistoricalArchiveDurableStore.flush (cyclomatic 22) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:783 — AtriaHistoricalArchiveDurableStore.flush has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked (cyclomatic 22) · ×1
  • AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked (cyclomatic 22) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:257 — AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence (cyclomatic 22) · ×1
  • AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence (cyclomatic 22) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:682 — AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · TransportAuthority.isValid (cyclomatic 22) · ×1
  • TransportAuthority.isValid (cyclomatic 22) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:32 — TransportAuthority.isValid has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced (cyclomatic 22) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced (cyclomatic 22) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:304 — AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHomeView.overviewContent (cyclomatic 22) · ×1
  • AtriaHomeView.overviewContent (cyclomatic 22) Atria/Atria/AtriaHomeView.swift:6066 — AtriaHomeView.overviewContent has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaShareSheet.canvasButtonLabel (cyclomatic 22) · ×1
  • AtriaShareSheet.canvasButtonLabel (cyclomatic 22) Atria/Atria/AtriaShareCard.swift:1847 — AtriaShareSheet.canvasButtonLabel has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTodayScreen.body (cyclomatic 22) · ×1
  • AtriaTodayScreen.body (cyclomatic 22) Atria/Atria/AtriaTodayScreen.swift:357 — AtriaTodayScreen.body has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection (cyclomatic 22) · ×1
  • AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection (cyclomatic 22) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2252 — AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection has cyclomatic complexity 22 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaWorkoutRuntime.applyPendingActions (cyclomatic 22) · ×1
  • AtriaWorkoutRuntime.applyPendingActions (cyclomatic 22) Atria/Atria/AtriaWorkoutRuntime.swift:490 — AtriaWorkoutRuntime.applyPendingActions has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint (cyclomatic 22) · ×1
  • HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint (cyclomatic 22) Atria/Atria/HistoricalArchive.swift:5027 — HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.loadHeartRateSamples (cyclomatic 22) · ×1
  • HistoricalArchive.loadHeartRateSamples (cyclomatic 22) Atria/Atria/HistoricalArchive.swift:9346 — HistoricalArchive.loadHeartRateSamples has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalNotificationScheduler.makeActionableConnectionDecisions (cyclomatic 22) · ×1
  • LocalNotificationScheduler.makeActionableConnectionDecisions (cyclomatic 22) Atria/Atria/LocalNotificationScheduler.swift:1466 — LocalNotificationScheduler.makeActionableConnectionDecisions has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SavedSession.workoutReadinessCore (cyclomatic 22) · ×1
  • SavedSession.workoutReadinessCore (cyclomatic 22) Atria/Atria/Sessions.swift:7665 — SavedSession.workoutReadinessCore has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeHistoryDailyRollups (cyclomatic 22) · ×1
  • SessionStore.makeHistoryDailyRollups (cyclomatic 22) Atria/Atria/Sessions.swift:21843 — SessionStore.makeHistoryDailyRollups has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.loadCachedResidentJournalSessionForSleepReview (cyclomatic 22) · ×1
  • SessionStore.loadCachedResidentJournalSessionForSleepReview (cyclomatic 22) Atria/Atria/Sessions.swift:29813 — SessionStore.loadCachedResidentJournalSessionForSleepReview has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance (cyclomatic 22) · ×1
  • SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance (cyclomatic 22) Atria/Atria/Sessions.swift:46965 — SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.aggregateWorkoutCandidatesUnshared (cyclomatic 22) · ×1
  • SessionStore.aggregateWorkoutCandidatesUnshared (cyclomatic 22) Atria/Atria/Sessions.swift:49141 — SessionStore.aggregateWorkoutCandidatesUnshared has cyclomatic complexity 22 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.rebuildBaselineCancellable (cyclomatic 22) · ×1
  • SessionStore.rebuildBaselineCancellable (cyclomatic 22) Atria/Atria/Sessions.swift:58511 — SessionStore.rebuildBaselineCancellable has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · Night.init (cyclomatic 22) · ×1
  • Night.init (cyclomatic 22) Atria/Atria/Sessions.swift:59556 — Night.init has cyclomatic complexity 22 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaBLEManager.kickZombieProprietaryStreamIfNeeded (cyclomatic 21) · ×1
  • AtriaBLEManager.kickZombieProprietaryStreamIfNeeded (cyclomatic 21) REDACTED:9973 — AtriaBLEManager.kickZombieProprietaryStreamIfNeeded has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendProtectedR10ActivationIfReady (cyclomatic 21) · ×1
  • AtriaBLEManager.sendProtectedR10ActivationIfReady (cyclomatic 21) REDACTED:15889 — AtriaBLEManager.sendProtectedR10ActivationIfReady has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.evaluateR10Liveness (cyclomatic 21) · ×1
  • AtriaBLEManager.evaluateR10Liveness (cyclomatic 21) REDACTED:34931 — AtriaBLEManager.evaluateR10Liveness has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible (cyclomatic 21) · ×1
  • AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible (cyclomatic 21) REDACTED:36884 — AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible has cyclomatic complexity 21 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.publishRRContinuityQuality (cyclomatic 21) · ×1
  • AtriaBLEManager.publishRRContinuityQuality (cyclomatic 21) REDACTED:43010 — AtriaBLEManager.publishRRContinuityQuality has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.applyHistoricalArchivePersistenceResult (cyclomatic 21) · ×1
  • AtriaBLEManager.applyHistoricalArchivePersistenceResult (cyclomatic 21) REDACTED:45661 — AtriaBLEManager.applyHistoricalArchivePersistenceResult has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHomeView.presentConnectionGuideIfNeeded (cyclomatic 21) · ×1
  • AtriaHomeView.presentConnectionGuideIfNeeded (cyclomatic 21) Atria/Atria/AtriaHomeView.swift:6635 — AtriaHomeView.presentConnectionGuideIfNeeded has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaGyroCadenceResearchPedometer.windowVerdict (cyclomatic 21) · ×1
  • AtriaGyroCadenceResearchPedometer.windowVerdict (cyclomatic 21) Atria/Atria/AtriaR10Motion.swift:474 — AtriaGyroCadenceResearchPedometer.windowVerdict has cyclomatic complexity 21 (threshold 15). Of this number, 20 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaResearchBundleBuilder.makePayload (cyclomatic 21) · ×1
  • AtriaResearchBundleBuilder.makePayload (cyclomatic 21) Atria/Atria/AtriaResearchBundle.swift:310 — AtriaResearchBundleBuilder.makePayload has cyclomatic complexity 21 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaSleepMotionQuiescence.quiescentWindows (cyclomatic 21) · ×1
  • AtriaSleepMotionQuiescence.quiescentWindows (cyclomatic 21) Atria/Atria/AtriaSleepMotionQuiescence.swift:132 — AtriaSleepMotionQuiescence.quiescentWindows has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.classifyGapMinutes (cyclomatic 21) · ×1
  • AtriaHistoricalStressReplay.classifyGapMinutes (cyclomatic 21) Atria/Atria/AtriaStressMonitor.swift:1957 — AtriaHistoricalStressReplay.classifyGapMinutes has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStressMonitorStore.replayMayReplace (cyclomatic 21) · ×1
  • AtriaStressMonitorStore.replayMayReplace (cyclomatic 21) Atria/Atria/AtriaStressMonitor.swift:3484 — AtriaStressMonitorStore.replayMayReplace has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow (cyclomatic 21) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow (cyclomatic 21) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:421 — AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity (cyclomatic 21) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity (cyclomatic 21) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1655 — AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity has cyclomatic complexity 21 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HealthKitExporter.healthSamples (cyclomatic 21) · ×1
  • HealthKitExporter.healthSamples (cyclomatic 21) Atria/Atria/HealthKitExporter.swift:2055 — HealthKitExporter.healthSamples has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.verifiedMetricTimestamps (cyclomatic 21) · ×1
  • HistoricalArchive.verifiedMetricTimestamps (cyclomatic 21) Atria/Atria/HistoricalArchive.swift:1679 — HistoricalArchive.verifiedMetricTimestamps has cyclomatic complexity 21 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SavedSession.workoutPrimaryBlocker (cyclomatic 21) · ×1
  • SavedSession.workoutPrimaryBlocker (cyclomatic 21) Atria/Atria/Sessions.swift:8238 — SavedSession.workoutPrimaryBlocker 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.refreshHistoricalArchiveStatus (cyclomatic 21) · ×1
  • SessionStore.refreshHistoricalArchiveStatus (cyclomatic 21) Atria/Atria/Sessions.swift:14711 — SessionStore.refreshHistoricalArchiveStatus 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.persistRecoveredCurrentCheckpoint (cyclomatic 21) · ×1
  • SessionStore.persistRecoveredCurrentCheckpoint (cyclomatic 21) Atria/Atria/Sessions.swift:16682 — SessionStore.persistRecoveredCurrentCheckpoint 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.completeRecoveredDataComponent (cyclomatic 21) · ×1
  • SessionStore.completeRecoveredDataComponent (cyclomatic 21) Atria/Atria/Sessions.swift:19685 — SessionStore.completeRecoveredDataComponent 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.logCollectionHealthFromLaunchIfRequested (cyclomatic 21) · ×1
  • SessionStore.logCollectionHealthFromLaunchIfRequested (cyclomatic 21) Atria/Atria/Sessions.swift:31079 — SessionStore.logCollectionHealthFromLaunchIfRequested 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.recoveredWorkoutEvidenceIsStronger (cyclomatic 21) · ×1
  • SessionStore.recoveredWorkoutEvidenceIsStronger (cyclomatic 21) Atria/Atria/Sessions.swift:35939 — SessionStore.recoveredWorkoutEvidenceIsStronger 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.sleepReviewAdmissionDiagnosis (cyclomatic 21) · ×1
  • SessionStore.sleepReviewAdmissionDiagnosis (cyclomatic 21) Atria/Atria/Sessions.swift:40103 — SessionStore.sleepReviewAdmissionDiagnosis 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaCoachPayload.serializedNumbers (cyclomatic 20) · ×1
  • AtriaCoachPayload.serializedNumbers (cyclomatic 20) Atria/Atria/AtriaAICoach.swift:229 — AtriaCoachPayload.serializedNumbers has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaActivitySelectedDaySleeps.overlapping (cyclomatic 20) · ×1
  • AtriaActivitySelectedDaySleeps.overlapping (cyclomatic 20) Atria/Atria/AtriaActivityMonitor.swift:770 — AtriaActivitySelectedDaySleeps.overlapping has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · RespRateRsa.estimate (cyclomatic 20) · ×1
  • RespRateRsa.estimate (cyclomatic 20) Atria/Atria/AtriaAnalytics.swift:5 — RespRateRsa.estimate has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Strain.maxHeartRateZoneSeconds (cyclomatic 20) · ×1
  • Strain.maxHeartRateZoneSeconds (cyclomatic 20) Atria/Atria/AtriaAnalytics.swift:975 — Strain.maxHeartRateZoneSeconds has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded (cyclomatic 20) · ×1
  • AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded (cyclomatic 20) REDACTED:11463 — AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded (cyclomatic 20) · ×1
  • AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded (cyclomatic 20) REDACTED:13144 — AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady (cyclomatic 20) · ×1
  • AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady (cyclomatic 20) REDACTED:15393 — AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed (cyclomatic 20) · ×1
  • AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed (cyclomatic 20) REDACTED:16350 — AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.liveR10EligibilityBlockers (cyclomatic 20) · ×1
  • AtriaBLEManager.liveR10EligibilityBlockers (cyclomatic 20) REDACTED:32739 — AtriaBLEManager.liveR10EligibilityBlockers has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.startSacrificialFastDrainIfNeeded (cyclomatic 20) · ×1
  • AtriaBLEManager.startSacrificialFastDrainIfNeeded (cyclomatic 20) REDACTED:40992 — AtriaBLEManager.startSacrificialFastDrainIfNeeded has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.performProductionHistoryReadPreflight (cyclomatic 20) · ×1
  • AtriaBLEManager.performProductionHistoryReadPreflight (cyclomatic 20) REDACTED:42781 — AtriaBLEManager.performProductionHistoryReadPreflight has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldRequestProprietaryBatteryRefresh (cyclomatic 20) · ×1
  • AtriaBLEManager.shouldRequestProprietaryBatteryRefresh (cyclomatic 20) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:55 — AtriaBLEManager.shouldRequestProprietaryBatteryRefresh has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBackupCompression.transform (cyclomatic 20) · ×1
  • AtriaBackupCompression.transform (cyclomatic 20) Atria/Atria/AtriaBackupCompression.swift:63 — AtriaBackupCompression.transform has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalConsumerReceiptLedger.validatedReceipt (cyclomatic 20) · ×1
  • AtriaHistoricalConsumerReceiptLedger.validatedReceipt (cyclomatic 20) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:525 — AtriaHistoricalConsumerReceiptLedger.validatedReceipt has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullScanCompletionStore.validate (cyclomatic 20) · ×1
  • AtriaHistoricalFullScanCompletionStore.validate (cyclomatic 20) Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:302 — AtriaHistoricalFullScanCompletionStore.validate has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalGapLedger.commitResolvedWindow (cyclomatic 20) · ×1
  • AtriaHistoricalGapLedger.commitResolvedWindow (cyclomatic 20) Atria/Atria/AtriaHistoricalGapLedger.swift:756 — AtriaHistoricalGapLedger.commitResolvedWindow has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHomeView.endWorkoutSession (cyclomatic 20) · ×1
  • AtriaHomeView.endWorkoutSession (cyclomatic 20) Atria/Atria/AtriaHomeView.swift:4210 — AtriaHomeView.endWorkoutSession has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded (cyclomatic 20) · ×1
  • AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded (cyclomatic 20) Atria/Atria/AtriaHomeView.swift:12648 — AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaPendingWorkoutIntentStore.persistTerminalLocked (cyclomatic 20) · ×1
  • AtriaPendingWorkoutIntentStore.persistTerminalLocked (cyclomatic 20) Atria/Atria/AtriaLiveWorkoutView.swift:1354 — AtriaPendingWorkoutIntentStore.persistTerminalLocked has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWorkoutZoneHapticTransition.accept (cyclomatic 20) · ×1
  • AtriaWorkoutZoneHapticTransition.accept (cyclomatic 20) Atria/Atria/AtriaLiveWorkoutView.swift:1566 — AtriaWorkoutZoneHapticTransition.accept has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaNightBaseline.sentence (cyclomatic 20) · ×1
  • AtriaNightBaseline.sentence (cyclomatic 20) Atria/Atria/AtriaNightBaseline.swift:167 — AtriaNightBaseline.sentence has cyclomatic complexity 20 (threshold 15). Of this number, 19 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaSleepWakeResearch.epochFeatures (cyclomatic 20) · ×1
  • AtriaSleepWakeResearch.epochFeatures (cyclomatic 20) Atria/Atria/AtriaSleepWakeResearch.swift:510 — AtriaSleepWakeResearch.epochFeatures has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Point.isValid (cyclomatic 20) · ×1
  • Point.isValid (cyclomatic 20) Atria/Atria/AtriaStressMonitor.swift:661 — Point.isValid has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaStressMonitorStore.checkpointHistory (cyclomatic 20) · ×1
  • AtriaStressMonitorStore.checkpointHistory (cyclomatic 20) Atria/Atria/AtriaStressMonitor.swift:3738 — AtriaStressMonitorStore.checkpointHistory has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames (cyclomatic 20) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames (cyclomatic 20) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:673 — AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.append (cyclomatic 20) · ×1
  • AtriaWhoop4MotionTickCompactStore.append (cyclomatic 20) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:264 — AtriaWhoop4MotionTickCompactStore.append has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.read (cyclomatic 20) · ×1
  • AtriaWhoop4MotionTickCompactStore.read (cyclomatic 20) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2516 — AtriaWhoop4MotionTickCompactStore.read has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow (cyclomatic 20) · ×1
  • AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow (cyclomatic 20) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1917 — AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaDailyStrainTargetStore.resolve (cyclomatic 20) · ×1
  • AtriaDailyStrainTargetStore.resolve (cyclomatic 20) Atria/Atria/Dashboard.swift:129 — AtriaDailyStrainTargetStore.resolve has cyclomatic complexity 20 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhiteboardCoachSentence.rewrite (cyclomatic 20) · ×1
  • AtriaWhiteboardCoachSentence.rewrite (cyclomatic 20) Atria/Atria/Dashboard.swift:690 — AtriaWhiteboardCoachSentence.rewrite has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · HistoricalArchive.motionBankTransportCoverage (cyclomatic 20) · ×1
  • HistoricalArchive.motionBankTransportCoverage (cyclomatic 20) Atria/Atria/HistoricalArchive.swift:4166 — HistoricalArchive.motionBankTransportCoverage has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.sealedCatalogBoundIsDurablyTrusted (cyclomatic 20) · ×1
  • HistoricalArchive.sealedCatalogBoundIsDurablyTrusted (cyclomatic 20) Atria/Atria/HistoricalArchive.swift:8572 — HistoricalArchive.sealedCatalogBoundIsDurablyTrusted has cyclomatic complexity 20 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · SessionStore.makeDailyMetricRollupPreparationCancellable (cyclomatic 20) · ×1
  • SessionStore.makeDailyMetricRollupPreparationCancellable (cyclomatic 20) Atria/Atria/Sessions.swift:14105 — SessionStore.makeDailyMetricRollupPreparationCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.recoveredDailyPreparationSessions (cyclomatic 20) · ×1
  • SessionStore.recoveredDailyPreparationSessions (cyclomatic 20) Atria/Atria/Sessions.swift:21261 — SessionStore.recoveredDailyPreparationSessions 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable (cyclomatic 20) · ×1
  • SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable (cyclomatic 20) Atria/Atria/Sessions.swift:22956 — SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.bestSavedRRReferenceWindow (cyclomatic 20) · ×1
  • SessionStore.bestSavedRRReferenceWindow (cyclomatic 20) Atria/Atria/Sessions.swift:32250 — SessionStore.bestSavedRRReferenceWindow 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.motionEvidenceMonotonicConfirmedSleeps (cyclomatic 20) · ×1
  • SessionStore.motionEvidenceMonotonicConfirmedSleeps (cyclomatic 20) Atria/Atria/Sessions.swift:45209 — SessionStore.motionEvidenceMonotonicConfirmedSleeps 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.scoreExternalRR (cyclomatic 20) · ×1
  • SessionStore.scoreExternalRR (cyclomatic 20) Atria/Atria/Sessions.swift:54781 — SessionStore.scoreExternalRR has cyclomatic complexity 20 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.restoreSessionBackup (cyclomatic 20) · ×1
  • SessionStore.restoreSessionBackup (cyclomatic 20) Atria/Atria/Sessions.swift:55587 — SessionStore.restoreSessionBackup 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.requestDeferredLaunchCardSettlement (cyclomatic 20) · ×1
  • SessionStore.requestDeferredLaunchCardSettlement (cyclomatic 20) Atria/Atria/Sessions.swift:57572 — SessionStore.requestDeferredLaunchCardSettlement 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaAboutMetricTrend.make (cyclomatic 19) · ×1
  • AtriaAboutMetricTrend.make (cyclomatic 19) Atria/Atria/AtriaAboutMetricSheet.swift:267 — AtriaAboutMetricTrend.make has cyclomatic complexity 19 (threshold 15). Most of this is not in the body itself: 9 of the 19 points are its own statements and the rest belongs to one function item inside it that branches (value). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D1 · Cyclomatic Complexity · AtriaActivityMonitorMemo.timelineSpans (cyclomatic 19) · ×1
  • AtriaActivityMonitorMemo.timelineSpans (cyclomatic 19) Atria/Atria/AtriaActivityMonitor.swift:3469 — AtriaActivityMonitorMemo.timelineSpans has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · TargetZones.restingHeartRate (cyclomatic 19) · ×1
  • TargetZones.restingHeartRate (cyclomatic 19) Atria/Atria/AtriaAnalytics.swift:306 — TargetZones.restingHeartRate has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · Recovery.sleepMissingEstimate (cyclomatic 19) · ×1
  • Recovery.sleepMissingEstimate (cyclomatic 19) Atria/Atria/AtriaAnalytics.swift:1756 — Recovery.sleepMissingEstimate has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.flushLeftoverMotion (cyclomatic 19) · ×1
  • AtriaBLEManager.flushLeftoverMotion (cyclomatic 19) REDACTED:8693 — AtriaBLEManager.flushLeftoverMotion has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.reconnectToSavedPeripheralIfPossible (cyclomatic 19) · ×1
  • AtriaBLEManager.reconnectToSavedPeripheralIfPossible (cyclomatic 19) REDACTED:27965 — AtriaBLEManager.reconnectToSavedPeripheralIfPossible has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded (cyclomatic 19) · ×1
  • AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded (cyclomatic 19) REDACTED:29136 — AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.reconcileCentralUnavailableRecovery (cyclomatic 19) · ×1
  • AtriaBLEManager.reconcileCentralUnavailableRecovery (cyclomatic 19) REDACTED:29982 — AtriaBLEManager.reconcileCentralUnavailableRecovery has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.recordAcceptedHRSample (cyclomatic 19) · ×1
  • AtriaBLEManager.recordAcceptedHRSample (cyclomatic 19) REDACTED:30927 — AtriaBLEManager.recordAcceptedHRSample has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested (cyclomatic 19) · ×1
  • AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested (cyclomatic 19) REDACTED:39304 — AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation (cyclomatic 19) · ×1
  • AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation (cyclomatic 19) REDACTED:42190 — AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleReadOnlyHistoricalPayload (cyclomatic 19) · ×1
  • AtriaBLEManager.handleReadOnlyHistoricalPayload (cyclomatic 19) REDACTED:43310 — AtriaBLEManager.handleReadOnlyHistoricalPayload has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleParsedRealtimePacket (cyclomatic 19) · ×1
  • AtriaBLEManager.handleParsedRealtimePacket (cyclomatic 19) REDACTED:51284 — AtriaBLEManager.handleParsedRealtimePacket has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.restoreStrapStepLedgerAtLaunch (cyclomatic 19) · ×1
  • AtriaBLEManager.restoreStrapStepLedgerAtLaunch (cyclomatic 19) REDACTED:51728 — AtriaBLEManager.restoreStrapStepLedgerAtLaunch has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition (cyclomatic 19) · ×1
  • AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition (cyclomatic 19) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2590 — AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBreathworkSession.finishArtifacts (cyclomatic 19) · ×1
  • AtriaBreathworkSession.finishArtifacts (cyclomatic 19) Atria/Atria/AtriaBreathworkSession.swift:649 — AtriaBreathworkSession.finishArtifacts has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage (cyclomatic 19) · ×1
  • AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage (cyclomatic 19) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:751 — AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalGapLedger.recordMetricUsableRows (cyclomatic 19) · ×1
  • AtriaHistoricalGapLedger.recordMetricUsableRows (cyclomatic 19) Atria/Atria/AtriaHistoricalGapLedger.swift:579 — AtriaHistoricalGapLedger.recordMetricUsableRows has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalLiveIdentityLookup.lookup (cyclomatic 19) · ×1
  • AtriaHistoricalLiveIdentityLookup.lookup (cyclomatic 19) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:153 — AtriaHistoricalLiveIdentityLookup.lookup has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalJSONLInput.decodeRawDeflate (cyclomatic 19) · ×1
  • AtriaHistoricalJSONLInput.decodeRawDeflate (cyclomatic 19) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:561 — AtriaHistoricalJSONLInput.decodeRawDeflate has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHomeView.handleDeepLink (cyclomatic 19) · ×1
  • AtriaHomeView.handleDeepLink (cyclomatic 19) Atria/Atria/AtriaHomeView.swift:1877 — AtriaHomeView.handleDeepLink has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHomeView.consumePendingIntentCommandIfNeeded (cyclomatic 19) · ×1
  • AtriaHomeView.consumePendingIntentCommandIfNeeded (cyclomatic 19) Atria/Atria/AtriaHomeView.swift:3013 — AtriaHomeView.consumePendingIntentCommandIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded (cyclomatic 19) · ×1
  • AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded (cyclomatic 19) Atria/Atria/AtriaHomeView.swift:12584 — AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaJournalInsights.thresholdSplitInsightCancellable (cyclomatic 19) · ×1
  • AtriaJournalInsights.thresholdSplitInsightCancellable (cyclomatic 19) Atria/Atria/AtriaJournalInsights.swift:309 — AtriaJournalInsights.thresholdSplitInsightCancellable has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaLearnedInsights.insights (cyclomatic 19) · ×1
  • AtriaLearnedInsights.insights (cyclomatic 19) Atria/Atria/AtriaLearnedInsights.swift:236 — AtriaLearnedInsights.insights has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaLiveActivityCoordinator.update (cyclomatic 19) · ×1
  • AtriaLiveActivityCoordinator.update (cyclomatic 19) Atria/Atria/AtriaLiveActivityCoordinator.swift:295 — AtriaLiveActivityCoordinator.update has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTodayMorningWhiteboardModel.make (cyclomatic 19) · ×1
  • AtriaTodayMorningWhiteboardModel.make (cyclomatic 19) Atria/Atria/AtriaMorningWhiteboardModel.swift:31 — AtriaTodayMorningWhiteboardModel.make has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaTodaySleepReviewProjectionState.preferredReview (cyclomatic 19) · ×1
  • AtriaTodaySleepReviewProjectionState.preferredReview (cyclomatic 19) Atria/Atria/AtriaOverviewSections.swift:695 — AtriaTodaySleepReviewProjectionState.preferredReview has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: AtriaTodayMetric.label (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit (cyclomatic 19) · ×1
  • AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit (cyclomatic 19) Atria/Atria/AtriaPersistedWorkoutStrainRescorer.swift:46 — AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaSettingsView.dataSection (cyclomatic 19) · ×1
  • AtriaSettingsView.dataSection (cyclomatic 19) Atria/Atria/AtriaSettingsView.swift:1121 — AtriaSettingsView.dataSection has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStressMonitorStore.timeAlignedRRIntervals (cyclomatic 19) · ×1
  • AtriaStressMonitorStore.timeAlignedRRIntervals (cyclomatic 19) Atria/Atria/AtriaStressMonitor.swift:3230 — AtriaStressMonitorStore.timeAlignedRRIntervals has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTodaySessionState.== (cyclomatic 19) · ×1
  • AtriaTodaySessionState.== (cyclomatic 19) Atria/Atria/AtriaTodayScreen.swift:89 — AtriaTodaySessionState.== has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt (cyclomatic 19) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt (cyclomatic 19) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:427 — AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · DailyRecoveryResolver.summary (cyclomatic 19) · ×1
  • DailyRecoveryResolver.summary (cyclomatic 19) Atria/Atria/DailyRollupStore.swift:427 — DailyRecoveryResolver.summary has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative (cyclomatic 19) · ×1
  • DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative (cyclomatic 19) Atria/Atria/DailyRollupStore.swift:554 — DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.diagnostics (cyclomatic 19) · ×1
  • HistoricalArchive.diagnostics (cyclomatic 19) Atria/Atria/HistoricalArchive.swift:3123 — HistoricalArchive.diagnostics has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow (cyclomatic 19) · ×1
  • HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow (cyclomatic 19) Atria/Atria/HistoricalArchive.swift:8539 — HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaScanRecordParser.unescape (cyclomatic 19) · ×1
  • AtriaScanRecordParser.unescape (cyclomatic 19) Atria/Atria/HistoricalArchive.swift:11169 — AtriaScanRecordParser.unescape has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaScanRecordParser.skipValue (cyclomatic 19) · ×1
  • AtriaScanRecordParser.skipValue (cyclomatic 19) Atria/Atria/HistoricalArchive.swift:11352 — AtriaScanRecordParser.skipValue has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalNotificationScheduler.makeSleepReviewDecision (cyclomatic 19) · ×1
  • LocalNotificationScheduler.makeSleepReviewDecision (cyclomatic 19) Atria/Atria/LocalNotificationScheduler.swift:1556 — LocalNotificationScheduler.makeSleepReviewDecision has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StrainPresentation.resolve (cyclomatic 19) · ×1
  • StrainPresentation.resolve (cyclomatic 19) Atria/Atria/Metrics.swift:258 — StrainPresentation.resolve has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.appendingRecoveredExecutionDiagnosticEvent (cyclomatic 19) · ×1
  • SessionStore.appendingRecoveredExecutionDiagnosticEvent (cyclomatic 19) Atria/Atria/Sessions.swift:11009 — SessionStore.appendingRecoveredExecutionDiagnosticEvent has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.dumpSleepCandidateDiagnostics (cyclomatic 19) · ×1
  • SessionStore.dumpSleepCandidateDiagnostics (cyclomatic 19) Atria/Atria/Sessions.swift:13216 — SessionStore.dumpSleepCandidateDiagnostics has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeWorkoutReviewCandidateForCache (cyclomatic 19) · ×1
  • SessionStore.makeWorkoutReviewCandidateForCache (cyclomatic 19) Atria/Atria/Sessions.swift:33001 — SessionStore.makeWorkoutReviewCandidateForCache has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.activityCalibrationEvidence (cyclomatic 19) · ×1
  • SessionStore.activityCalibrationEvidence (cyclomatic 19) Atria/Atria/Sessions.swift:33282 — SessionStore.activityCalibrationEvidence has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.scheduleCurrentCycleSleepReviewAdmission (cyclomatic 19) · ×1
  • SessionStore.scheduleCurrentCycleSleepReviewAdmission (cyclomatic 19) Atria/Atria/Sessions.swift:40167 — SessionStore.scheduleCurrentCycleSleepReviewAdmission has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.sleepStageResearchSampleCount (cyclomatic 19) · ×1
  • SessionStore.sleepStageResearchSampleCount (cyclomatic 19) Atria/Atria/Sessions.swift:44008 — SessionStore.sleepStageResearchSampleCount has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.shouldSplitPostWakeNap (cyclomatic 19) · ×1
  • SessionStore.shouldSplitPostWakeNap (cyclomatic 19) Atria/Atria/Sessions.swift:56608 — SessionStore.shouldSplitPostWakeNap has cyclomatic complexity 19 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.continueDeferredLoadFollowUp (cyclomatic 19) · ×1
  • SessionStore.continueDeferredLoadFollowUp (cyclomatic 19) Atria/Atria/Sessions.swift:57128 — SessionStore.continueDeferredLoadFollowUp has cyclomatic complexity 19 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded (cyclomatic 19) · ×1
  • SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded (cyclomatic 19) Atria/Atria/Sessions.swift:58076 — SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · HistoryView.debugFixtureHistorySnapshot (cyclomatic 19) · ×1
  • HistoryView.debugFixtureHistorySnapshot (cyclomatic 19) Atria/Atria/Sessions.swift:59138 — HistoryView.debugFixtureHistorySnapshot has cyclomatic complexity 19 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · ActiveSessionJournal.applying (cyclomatic 18) · ×1
  • ActiveSessionJournal.applying (cyclomatic 18) Atria/Atria/ActiveSessionJournal.swift:885 — ActiveSessionJournal.applying has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaActivityMonitorTab.debugWorkoutDetailFixture (cyclomatic 18) · ×1
  • AtriaActivityMonitorTab.debugWorkoutDetailFixture (cyclomatic 18) Atria/Atria/AtriaActivityMonitor.swift:1854 — AtriaActivityMonitorTab.debugWorkoutDetailFixture has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaActivityWorkoutDetailSheet.saveAllAsync (cyclomatic 18) · ×1
  • AtriaActivityWorkoutDetailSheet.saveAllAsync (cyclomatic 18) Atria/Atria/AtriaActivityMonitor.swift:4336 — AtriaActivityWorkoutDetailSheet.saveAllAsync has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing.
D1 · Cyclomatic Complexity · TargetZones.hrv (cyclomatic 18) · ×1
  • TargetZones.hrv (cyclomatic 18) Atria/Atria/AtriaAnalytics.swift:256 — TargetZones.hrv has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaBLEManager.discoveryServicesForCurrentMode (cyclomatic 18) · ×1
  • AtriaBLEManager.discoveryServicesForCurrentMode (cyclomatic 18) REDACTED:5565 — AtriaBLEManager.discoveryServicesForCurrentMode has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.recoverNoDataWatchdog (cyclomatic 18) · ×1
  • AtriaBLEManager.recoverNoDataWatchdog (cyclomatic 18) REDACTED:25601 — AtriaBLEManager.recoverNoDataWatchdog has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.pruneRRWindow (cyclomatic 18) · ×1
  • AtriaBLEManager.pruneRRWindow (cyclomatic 18) REDACTED:27129 — AtriaBLEManager.pruneRRWindow has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.checkpointFromLiveEventIfNeeded (cyclomatic 18) · ×1
  • AtriaBLEManager.checkpointFromLiveEventIfNeeded (cyclomatic 18) REDACTED:30679 — AtriaBLEManager.checkpointFromLiveEventIfNeeded has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded (cyclomatic 18) · ×1
  • AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded (cyclomatic 18) REDACTED:33772 — AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.workoutMotionLeaseAction (cyclomatic 18) · ×1
  • AtriaBLEManager.workoutMotionLeaseAction (cyclomatic 18) REDACTED:35149 — AtriaBLEManager.workoutMotionLeaseAction has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendOneShotHistoryTrimCommand (cyclomatic 18) · ×1
  • AtriaBLEManager.sendOneShotHistoryTrimCommand (cyclomatic 18) REDACTED:41754 — AtriaBLEManager.sendOneShotHistoryTrimCommand has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.startReadOnlyClockProbeIfNeeded (cyclomatic 18) · ×1
  • AtriaBLEManager.startReadOnlyClockProbeIfNeeded (cyclomatic 18) REDACTED:42460 — AtriaBLEManager.startReadOnlyClockProbeIfNeeded has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.maybeRequestProprietaryBatteryRefresh (cyclomatic 18) · ×1
  • AtriaBLEManager.maybeRequestProprietaryBatteryRefresh (cyclomatic 18) REDACTED:44191 — AtriaBLEManager.maybeRequestProprietaryBatteryRefresh has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleHistoricalData (cyclomatic 18) · ×1
  • AtriaBLEManager.handleHistoricalData (cyclomatic 18) REDACTED:45084 — AtriaBLEManager.handleHistoricalData has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.processAdmittedHistoricalFrame (cyclomatic 18) · ×1
  • AtriaBLEManager.processAdmittedHistoricalFrame (cyclomatic 18) REDACTED:45443 — AtriaBLEManager.processAdmittedHistoricalFrame has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.armHistoricalPageContinuationAfterACK (cyclomatic 18) · ×1
  • AtriaBLEManager.armHistoricalPageContinuationAfterACK (cyclomatic 18) REDACTED:49660 — AtriaBLEManager.armHistoricalPageContinuationAfterACK has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.heartRateContinuityRecoveryDisposition (cyclomatic 18) · ×1
  • AtriaBLEManager.heartRateContinuityRecoveryDisposition (cyclomatic 18) Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:466 — AtriaBLEManager.heartRateContinuityRecoveryDisposition has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBackgroundProjectionThrottle.checkpointShouldAbort (cyclomatic 18) · ×1
  • AtriaBackgroundProjectionThrottle.checkpointShouldAbort (cyclomatic 18) Atria/Atria/AtriaBackgroundProjectionThrottle.swift:219 — AtriaBackgroundProjectionThrottle.checkpointShouldAbort has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaDeviceUseJournal.sustainedUseIntervals (cyclomatic 18) · ×1
  • AtriaDeviceUseJournal.sustainedUseIntervals (cyclomatic 18) Atria/Atria/AtriaDeviceUseJournal.swift:81 — AtriaDeviceUseJournal.sustainedUseIntervals has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveCatalogStore.recordSealedMetadata (cyclomatic 18) · ×1
  • AtriaHistoricalArchiveCatalogStore.recordSealedMetadata (cyclomatic 18) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:617 — AtriaHistoricalArchiveCatalogStore.recordSealedMetadata has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts (cyclomatic 18) · ×1
  • AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts (cyclomatic 18) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:257 — AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts has cyclomatic complexity 18 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaHistoricalDailyConsumerProjection.validCommon (cyclomatic 18) · ×1
  • AtriaHistoricalDailyConsumerProjection.validCommon (cyclomatic 18) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:767 — AtriaHistoricalDailyConsumerProjection.validCommon has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · DurableStorePair.isValid (cyclomatic 18) · ×1
  • DurableStorePair.isValid (cyclomatic 18) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:225 — DurableStorePair.isValid has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.recordMatchingACK (cyclomatic 18) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordMatchingACK (cyclomatic 18) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:370 — AtriaHistoricalFullDrainCoverageStore.recordMatchingACK has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalJSONLRecentScanner.unsignedInteger (cyclomatic 18) · ×1
  • AtriaHistoricalJSONLRecentScanner.unsignedInteger (cyclomatic 18) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:340 — AtriaHistoricalJSONLRecentScanner.unsignedInteger has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHomeView.updateConnectionDiagnosisVisibility (cyclomatic 18) · ×1
  • AtriaHomeView.updateConnectionDiagnosisVisibility (cyclomatic 18) Atria/Atria/AtriaHomeView.swift:6310 — AtriaHomeView.updateConnectionDiagnosisVisibility has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaMissedDataBannerPresentation.copy (cyclomatic 18) · ×1
  • AtriaMissedDataBannerPresentation.copy (cyclomatic 18) Atria/Atria/AtriaHomeView.swift:7754 — AtriaMissedDataBannerPresentation.copy has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHomeModel.nextLiveSessionDerived (cyclomatic 18) · ×1
  • AtriaHomeModel.nextLiveSessionDerived (cyclomatic 18) Atria/Atria/AtriaHomeView.swift:13816 — AtriaHomeModel.nextLiveSessionDerived has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaNightBaseline.comparison (cyclomatic 18) · ×1
  • AtriaNightBaseline.comparison (cyclomatic 18) Atria/Atria/AtriaNightBaseline.swift:119 — AtriaNightBaseline.comparison has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaGlanceTargetEditorSheet.editorContent (cyclomatic 18) · ×1
  • AtriaGlanceTargetEditorSheet.editorContent (cyclomatic 18) Atria/Atria/AtriaOverviewSections.swift:3229 — AtriaGlanceTargetEditorSheet.editorContent has cyclomatic complexity 18 (threshold 15). To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Where every arm is uniform — the same kind of value, with no behaviour of its own — a table keyed by the case is the shorter form; wherever the arms carry different data or different behaviour, keep them as cases, because collapsing those trades an explicit, reviewable set of cases for nothing. This is NOT this file's highest cyclomatic complexity: AtriaTodayMetric.label (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaRecoveredDataRecomputeCoordinator.request (cyclomatic 18) · ×1
  • AtriaRecoveredDataRecomputeCoordinator.request (cyclomatic 18) Atria/Atria/AtriaRecoveredDataRecomputeCoordinator.swift:164 — AtriaRecoveredDataRecomputeCoordinator.request has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4LiveFlushPlanner.tick (cyclomatic 18) · ×1
  • AtriaWhoop4LiveFlushPlanner.tick (cyclomatic 18) Atria/Atria/AtriaWhoop4LiveFlushPlanner.swift:221 — AtriaWhoop4LiveFlushPlanner.tick has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWorkoutRouteRecorder.locationManager (cyclomatic 18) · ×1
  • AtriaWorkoutRouteRecorder.locationManager (cyclomatic 18) Atria/Atria/AtriaWorkoutRoute.swift:474 — AtriaWorkoutRouteRecorder.locationManager has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWorkoutCommandTransaction.applying (cyclomatic 18) · ×1
  • AtriaWorkoutCommandTransaction.applying (cyclomatic 18) Atria/Atria/AtriaWorkoutRuntime.swift:193 — AtriaWorkoutCommandTransaction.applying has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · LocalNotificationScheduler.add (cyclomatic 18) · ×1
  • LocalNotificationScheduler.add (cyclomatic 18) Atria/Atria/LocalNotificationScheduler.swift:2188 — LocalNotificationScheduler.add has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SessionStore.requestRecoveredDataRecomputation (cyclomatic 18) · ×1
  • SessionStore.requestRecoveredDataRecomputation (cyclomatic 18) Atria/Atria/Sessions.swift:16845 — SessionStore.requestRecoveredDataRecomputation has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.mergeCanonicalHistoricalRollups (cyclomatic 18) · ×1
  • SessionStore.mergeCanonicalHistoricalRollups (cyclomatic 18) Atria/Atria/Sessions.swift:21512 — SessionStore.mergeCanonicalHistoricalRollups has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeSavedDailyMetrics (cyclomatic 18) · ×1
  • SessionStore.makeSavedDailyMetrics (cyclomatic 18) Atria/Atria/Sessions.swift:23194 — SessionStore.makeSavedDailyMetrics has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeCompactLatestNightSettlementPreparation (cyclomatic 18) · ×1
  • SessionStore.makeCompactLatestNightSettlementPreparation (cyclomatic 18) Atria/Atria/Sessions.swift:38919 — SessionStore.makeCompactLatestNightSettlementPreparation has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.isDegradedHROnlyOvernightSleepCandidate (cyclomatic 18) · ×1
  • SessionStore.isDegradedHROnlyOvernightSleepCandidate (cyclomatic 18) Atria/Atria/Sessions.swift:42126 — SessionStore.isDegradedHROnlyOvernightSleepCandidate has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.autoSleepClassification (cyclomatic 18) · ×1
  • SessionStore.autoSleepClassification (cyclomatic 18) Atria/Atria/Sessions.swift:42286 — SessionStore.autoSleepClassification has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmSleepWindow (cyclomatic 18) · ×1
  • SessionStore.confirmSleepWindow (cyclomatic 18) Atria/Atria/Sessions.swift:42634 — SessionStore.confirmSleepWindow has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.makeBehaviorCorrelationSummaries (cyclomatic 18) · ×1
  • SessionStore.makeBehaviorCorrelationSummaries (cyclomatic 18) Atria/Atria/Sessions.swift:47272 — SessionStore.makeBehaviorCorrelationSummaries has cyclomatic complexity 18 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.aggregateSleepDiagnostics (cyclomatic 18) · ×1
  • SessionStore.aggregateSleepDiagnostics (cyclomatic 18) Atria/Atria/Sessions.swift:52339 — SessionStore.aggregateSleepDiagnostics has cyclomatic complexity 18 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.validateRRReferenceFromDocuments (cyclomatic 18) · ×1
  • SessionStore.validateRRReferenceFromDocuments (cyclomatic 18) Atria/Atria/Sessions.swift:54247 — SessionStore.validateRRReferenceFromDocuments has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · probe.on_notify (cyclomatic 18) · ×1
  • probe.on_notify (cyclomatic 18) probe.py:42 — probe.on_notify has cyclomatic complexity 18 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaAddWorkoutSheet.body (cyclomatic 17) · ×1
  • AtriaAddWorkoutSheet.body (cyclomatic 17) Atria/Atria/AtriaActivityMonitor.swift:5063 — AtriaAddWorkoutSheet.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. This is NOT this file's highest cyclomatic complexity: AtriaActivityMonitorTab.activityTint (cyclomatic 18) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaAppDependencies.init (cyclomatic 17) · ×1
  • AtriaAppDependencies.init (cyclomatic 17) Atria/Atria/AtriaApp.swift:114 — AtriaAppDependencies.init has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · SurfaceCoverage.isComplete (cyclomatic 17) · ×1
  • SurfaceCoverage.isComplete (cyclomatic 17) Atria/Atria/AtriaAppReviewDemo.swift:332 — SurfaceCoverage.isComplete has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch (cyclomatic 17) · ×1
  • AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch (cyclomatic 17) REDACTED:6132 — AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.noteLeftoverFlushInbound (cyclomatic 17) · ×1
  • AtriaBLEManager.noteLeftoverFlushInbound (cyclomatic 17) REDACTED:8902 — AtriaBLEManager.noteLeftoverFlushInbound has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded (cyclomatic 17) · ×1
  • AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded (cyclomatic 17) REDACTED:13034 — AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendOnboardingPairingPreflightRange (cyclomatic 17) · ×1
  • AtriaBLEManager.sendOnboardingPairingPreflightRange (cyclomatic 17) REDACTED:14889 — AtriaBLEManager.sendOnboardingPairingPreflightRange has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue (cyclomatic 17) · ×1
  • AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue (cyclomatic 17) REDACTED:21418 — AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.requestFreshScanReconnect (cyclomatic 17) · ×1
  • AtriaBLEManager.requestFreshScanReconnect (cyclomatic 17) REDACTED:23996 — AtriaBLEManager.requestFreshScanReconnect has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.recoverRRPresenceWatchdog (cyclomatic 17) · ×1
  • AtriaBLEManager.recoverRRPresenceWatchdog (cyclomatic 17) REDACTED:26243 — AtriaBLEManager.recoverRRPresenceWatchdog has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.startReconnectWatchdog (cyclomatic 17) · ×1
  • AtriaBLEManager.startReconnectWatchdog (cyclomatic 17) REDACTED:28655 — AtriaBLEManager.startReconnectWatchdog has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.logDataRangeCommandResponse (cyclomatic 17) · ×1
  • AtriaBLEManager.logDataRangeCommandResponse (cyclomatic 17) REDACTED:31946 — AtriaBLEManager.logDataRangeCommandResponse has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded (cyclomatic 17) · ×1
  • AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded (cyclomatic 17) REDACTED:34206 — AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart (cyclomatic 17) · ×1
  • AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart (cyclomatic 17) REDACTED:36548 — AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization (cyclomatic 17) · ×1
  • AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization (cyclomatic 17) REDACTED:47672 — AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.activeCaloriesForSnapshot (cyclomatic 17) · ×1
  • AtriaBLEManager.activeCaloriesForSnapshot (cyclomatic 17) REDACTED:50097 — AtriaBLEManager.activeCaloriesForSnapshot has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff (cyclomatic 17) · ×1
  • AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff (cyclomatic 17) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3062 — AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaGeneratedArtifactRetention.prune (cyclomatic 17) · ×1
  • AtriaGeneratedArtifactRetention.prune (cyclomatic 17) Atria/Atria/AtriaGeneratedArtifactRetention.swift:61 — AtriaGeneratedArtifactRetention.prune has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaSleepStressCard.body (cyclomatic 17) · ×1
  • AtriaSleepStressCard.body (cyclomatic 17) Atria/Atria/AtriaHealthScreen.swift:3284 — AtriaSleepStressCard.body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest (cyclomatic 17) · ×1
  • AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest (cyclomatic 17) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1563 — AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalCanonicalConsumerApplicationStore.valid (cyclomatic 17) · ×1
  • AtriaHistoricalCanonicalConsumerApplicationStore.valid (cyclomatic 17) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:326 — AtriaHistoricalCanonicalConsumerApplicationStore.valid has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload (cyclomatic 17) · ×1
  • AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload (cyclomatic 17) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:309 — AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHistoricalGapLedger.stageMetricUsableRows (cyclomatic 17) · ×1
  • AtriaHistoricalGapLedger.stageMetricUsableRows (cyclomatic 17) Atria/Atria/AtriaHistoricalGapLedger.swift:527 — AtriaHistoricalGapLedger.stageMetricUsableRows has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalGeneratedArtifactGC.prune (cyclomatic 17) · ×1
  • AtriaHistoricalGeneratedArtifactGC.prune (cyclomatic 17) Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:40 — AtriaHistoricalGeneratedArtifactGC.prune has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalRawRetirementExecutor.loadAuthority (cyclomatic 17) · ×1
  • AtriaHistoricalRawRetirementExecutor.loadAuthority (cyclomatic 17) Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:283 — AtriaHistoricalRawRetirementExecutor.loadAuthority has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalRetiredReplayIndex.importAndVerify (cyclomatic 17) · ×1
  • AtriaHistoricalRetiredReplayIndex.importAndVerify (cyclomatic 17) Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:126 — AtriaHistoricalRetiredReplayIndex.importAndVerify has cyclomatic complexity 17 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent (cyclomatic 17) · ×1
  • AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent (cyclomatic 17) Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:295 — AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHomeModel.publishDiagnosisReport (cyclomatic 17) · ×1
  • AtriaHomeModel.publishDiagnosisReport (cyclomatic 17) Atria/Atria/AtriaHomeView.swift:10952 — AtriaHomeModel.publishDiagnosisReport 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaOnDeviceModel.dataBlock (cyclomatic 17) · ×1
  • AtriaOnDeviceModel.dataBlock (cyclomatic 17) Atria/Atria/AtriaOnDeviceCoach.swift:58 — AtriaOnDeviceModel.dataBlock has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaPreparedMetricChart.chartContent (cyclomatic 17) · ×1
  • AtriaPreparedMetricChart.chartContent (cyclomatic 17) Atria/Atria/AtriaOverviewSections.swift:7364 — AtriaPreparedMetricChart.chartContent 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. This is NOT this file's highest cyclomatic complexity: AtriaTodayMetric.label (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaPhysiologicalStressModel.qualifiedRMSSD (cyclomatic 17) · ×1
  • AtriaPhysiologicalStressModel.qualifiedRMSSD (cyclomatic 17) Atria/Atria/AtriaPhysiologicalStressModel.swift:561 — AtriaPhysiologicalStressModel.qualifiedRMSSD has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaRecoveredMotionProjection.epochFeaturesCancellable (cyclomatic 17) · ×1
  • AtriaRecoveredMotionProjection.epochFeaturesCancellable (cyclomatic 17) Atria/Atria/AtriaRecoveredMotionProjection.swift:153 — AtriaRecoveredMotionProjection.epochFeaturesCancellable has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaSensorReferenceEntry.init (cyclomatic 17) · ×1
  • AtriaSensorReferenceEntry.init (cyclomatic 17) Atria/Atria/AtriaSensorReferenceCapture.swift:62 — AtriaSensorReferenceEntry.init has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaSleepHypnogramPresentation.compositedRuns (cyclomatic 17) · ×1
  • AtriaSleepHypnogramPresentation.compositedRuns (cyclomatic 17) Atria/Atria/AtriaSleepHypnogram.swift:233 — AtriaSleepHypnogramPresentation.compositedRuns has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStrainLoadModel.evaluateInterval (cyclomatic 17) · ×1
  • AtriaStrainLoadModel.evaluateInterval (cyclomatic 17) Atria/Atria/AtriaStrainLoadModel.swift:237 — AtriaStrainLoadModel.evaluateInterval has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaStressElevatedEvidence.analyze (cyclomatic 17) · ×1
  • AtriaStressElevatedEvidence.analyze (cyclomatic 17) Atria/Atria/AtriaStressDetailView.swift:397 — AtriaStressElevatedEvidence.analyze has cyclomatic complexity 17 (threshold 15). Of this number, 13 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTrendActionReadout.init (cyclomatic 17) · ×1
  • AtriaTrendActionReadout.init (cyclomatic 17) Atria/Atria/AtriaTrendChart.swift:1357 — AtriaTrendActionReadout.init has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHeartRateAxisChart.baseChart (cyclomatic 17) · ×1
  • AtriaHeartRateAxisChart.baseChart (cyclomatic 17) Atria/Atria/AtriaVitalsCollectionSections.swift:4709 — AtriaHeartRateAxisChart.baseChart has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout (cyclomatic 17) · ×1
  • AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout (cyclomatic 17) Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:39 — AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary (cyclomatic 17) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary (cyclomatic 17) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:582 — AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments (cyclomatic 17) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments (cyclomatic 17) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1811 — AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight (cyclomatic 17) · ×1
  • DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight (cyclomatic 17) Atria/Atria/DailyRollupStore.swift:632 — DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.recordDrainedThroughCompletionIfNeeded (cyclomatic 17) · ×1
  • HistoricalArchive.recordDrainedThroughCompletionIfNeeded (cyclomatic 17) Atria/Atria/HistoricalArchive.swift:2619 — HistoricalArchive.recordDrainedThroughCompletionIfNeeded has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.append (cyclomatic 17) · ×1
  • HistoricalArchive.append (cyclomatic 17) Atria/Atria/HistoricalArchive.swift:8900 — HistoricalArchive.append has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SavedSession.distinctCoverageHonestWindows (cyclomatic 17) · ×1
  • SavedSession.distinctCoverageHonestWindows (cyclomatic 17) Atria/Atria/Sessions.swift:1912 — SavedSession.distinctCoverageHonestWindows has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WorkoutReadiness.gappedStrengthReviewCandidate (cyclomatic 17) · ×1
  • WorkoutReadiness.gappedStrengthReviewCandidate (cyclomatic 17) Atria/Atria/Sessions.swift:3042 — WorkoutReadiness.gappedStrengthReviewCandidate has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (WorkoutReplaySummary.gappedStrengthReviewCandidate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaSleepStageIntegrity.validates (cyclomatic 17) · ×1
  • AtriaSleepStageIntegrity.validates (cyclomatic 17) Atria/Atria/Sessions.swift:4157 — AtriaSleepStageIntegrity.validates has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WorkoutReplaySummary.gappedStrengthReviewCandidate (cyclomatic 17) · ×1
  • WorkoutReplaySummary.gappedStrengthReviewCandidate (cyclomatic 17) Atria/Atria/Sessions.swift:6548 — WorkoutReplaySummary.gappedStrengthReviewCandidate has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (WorkoutReadiness.gappedStrengthReviewCandidate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.verifiedCanonicalStepEvidenceDaysCancellable (cyclomatic 17) · ×1
  • SessionStore.verifiedCanonicalStepEvidenceDaysCancellable (cyclomatic 17) Atria/Atria/Sessions.swift:21678 — SessionStore.verifiedCanonicalStepEvidenceDaysCancellable has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.preservingMonotonicResearchAggregates (cyclomatic 17) · ×1
  • SessionStore.preservingMonotonicResearchAggregates (cyclomatic 17) Atria/Atria/Sessions.swift:29265 — SessionStore.preservingMonotonicResearchAggregates 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmMetadataOnlyWorkout (cyclomatic 17) · ×1
  • SessionStore.confirmMetadataOnlyWorkout (cyclomatic 17) Atria/Atria/Sessions.swift:34589 — SessionStore.confirmMetadataOnlyWorkout 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate (cyclomatic 17) · ×1
  • SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate (cyclomatic 17) Atria/Atria/Sessions.swift:42064 — SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.sleepStageQualifiedRRInputs (cyclomatic 17) · ×1
  • SessionStore.sleepStageQualifiedRRInputs (cyclomatic 17) Atria/Atria/Sessions.swift:43936 — SessionStore.sleepStageQualifiedRRInputs has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.shouldSplitPostWakeNap (cyclomatic 17) · ×1
  • SessionStore.shouldSplitPostWakeNap (cyclomatic 17) Atria/Atria/Sessions.swift:56559 — SessionStore.shouldSplitPostWakeNap has cyclomatic complexity 17 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · HistoryView.body (cyclomatic 17) · ×1
  • HistoryView.body (cyclomatic 17) Atria/Atria/Sessions.swift:58755 — HistoryView.body has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaWidgetProvider.getTimeline (cyclomatic 17) · ×1
  • AtriaWidgetProvider.getTimeline (cyclomatic 17) Atria/AtriaWidget/AtriaWidget.swift:516 — AtriaWidgetProvider.getTimeline has cyclomatic complexity 17 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaWidget.swift.liveActivityDailyStepGoalPresentation (cyclomatic 17) · ×1
  • AtriaWidget.swift.liveActivityDailyStepGoalPresentation (cyclomatic 17) Atria/AtriaWidget/AtriaWidget.swift:2697 — AtriaWidget.swift.liveActivityDailyStepGoalPresentation has cyclomatic complexity 17 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · ActiveSessionJournal.replaying (cyclomatic 16) · ×1
  • ActiveSessionJournal.replaying (cyclomatic 16) Atria/Atria/ActiveSessionJournal.swift:1050 — ActiveSessionJournal.replaying has cyclomatic complexity 16 (threshold 15). To reduce it, separate the branches: extract each independent case into its own named function so the top-level body reads as a short sequence of named decisions.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldSendCoverLiveBoundedRawCapture (cyclomatic 16) · ×1
  • AtriaBLEManager.shouldSendCoverLiveBoundedRawCapture (cyclomatic 16) REDACTED:4832 — AtriaBLEManager.shouldSendCoverLiveBoundedRawCapture has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldRefreshIMUOnLiveHeartRateFallback (cyclomatic 16) · ×1
  • AtriaBLEManager.shouldRefreshIMUOnLiveHeartRateFallback (cyclomatic 16) REDACTED:4960 — AtriaBLEManager.shouldRefreshIMUOnLiveHeartRateFallback has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.handleInteractiveForeground (cyclomatic 16) · ×1
  • AtriaBLEManager.handleInteractiveForeground (cyclomatic 16) REDACTED:9622 — AtriaBLEManager.handleInteractiveForeground has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.reassertHeartRateNotificationsIfConnected (cyclomatic 16) · ×1
  • AtriaBLEManager.reassertHeartRateNotificationsIfConnected (cyclomatic 16) REDACTED:9771 — AtriaBLEManager.reassertHeartRateNotificationsIfConnected has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.reassertR10NotificationIfConnected (cyclomatic 16) · ×1
  • AtriaBLEManager.reassertR10NotificationIfConnected (cyclomatic 16) REDACTED:9848 — AtriaBLEManager.reassertR10NotificationIfConnected has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldReacquireInterruptedFullDrain (cyclomatic 16) · ×1
  • AtriaBLEManager.shouldReacquireInterruptedFullDrain (cyclomatic 16) REDACTED:11613 — AtriaBLEManager.shouldReacquireInterruptedFullDrain has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded (cyclomatic 16) · ×1
  • AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded (cyclomatic 16) REDACTED:18259 — AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.finishRecording (cyclomatic 16) · ×1
  • AtriaBLEManager.finishRecording (cyclomatic 16) REDACTED:30536 — AtriaBLEManager.finishRecording has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.sendSacrificialFastDrainCommand (cyclomatic 16) · ×1
  • AtriaBLEManager.sendSacrificialFastDrainCommand (cyclomatic 16) REDACTED:41392 — AtriaBLEManager.sendSacrificialFastDrainCommand has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaBLEManager.addRRBatch (cyclomatic 16) · ×1
  • AtriaBLEManager.addRRBatch (cyclomatic 16) REDACTED:49908 — AtriaBLEManager.addRRBatch has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.selectedIdleWindowHistoryDrain (cyclomatic 16) · ×1
  • AtriaBLEManager.selectedIdleWindowHistoryDrain (cyclomatic 16) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:786 — AtriaBLEManager.selectedIdleWindowHistoryDrain has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry (cyclomatic 16) · ×1
  • AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry (cyclomatic 16) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1211 — AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaBLEManager.batteryLevelAcceptanceDecision (cyclomatic 16) · ×1
  • AtriaBLEManager.batteryLevelAcceptanceDecision (cyclomatic 16) Atria/Atria/AtriaStrapPowerPolicy.swift:70 — AtriaBLEManager.batteryLevelAcceptanceDecision has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHealthspanDetailView.orb (cyclomatic 16) · ×1
  • AtriaHealthspanDetailView.orb (cyclomatic 16) Atria/Atria/AtriaHealthspanDetailView.swift:269 — AtriaHealthspanDetailView.orb has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaHistoricalActivityInspectionProofFactory.prepareUsingFullScan (cyclomatic 16) · ×1
  • AtriaHistoricalActivityInspectionProofFactory.prepareUsingFullScan (cyclomatic 16) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:520 — AtriaHistoricalActivityInspectionProofFactory.prepareUsingFullScan has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalArchiveDurableStore.init (cyclomatic 16) · ×1
  • AtriaHistoricalArchiveDurableStore.init (cyclomatic 16) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:328 — AtriaHistoricalArchiveDurableStore.init has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalCanonicalConsumerDestinationStore.existingApplication (cyclomatic 16) · ×1
  • AtriaHistoricalCanonicalConsumerDestinationStore.existingApplication (cyclomatic 16) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:161 — AtriaHistoricalCanonicalConsumerDestinationStore.existingApplication has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.arm (cyclomatic 16) · ×1
  • AtriaHistoricalFullDrainCoverageStore.arm (cyclomatic 16) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:243 — AtriaHistoricalFullDrainCoverageStore.arm has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalFullDrainCoverageStore.validate (cyclomatic 16) · ×1
  • AtriaHistoricalFullDrainCoverageStore.validate (cyclomatic 16) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1069 — AtriaHistoricalFullDrainCoverageStore.validate has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalGapLedger.continuity (cyclomatic 16) · ×1
  • AtriaHistoricalGapLedger.continuity (cyclomatic 16) Atria/Atria/AtriaHistoricalGapLedger.swift:853 — AtriaHistoricalGapLedger.continuity has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted (cyclomatic 16) · ×1
  • AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted (cyclomatic 16) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:278 — AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaLiveWorkoutTabAccessory.body (cyclomatic 16) · ×1
  • AtriaLiveWorkoutTabAccessory.body (cyclomatic 16) Atria/Atria/AtriaHomeView.swift:8589 — AtriaLiveWorkoutTabAccessory.body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaLearnedInsights.dayRead (cyclomatic 16) · ×1
  • AtriaLearnedInsights.dayRead (cyclomatic 16) Atria/Atria/AtriaLearnedInsights.swift:922 — AtriaLearnedInsights.dayRead has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaMetricZone.zone (cyclomatic 16) · ×1
  • AtriaMetricZone.zone (cyclomatic 16) Atria/Atria/AtriaMetricTargets.swift:217 — AtriaMetricZone.zone has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaRecoveryScoreHero.body (cyclomatic 16) · ×1
  • AtriaRecoveryScoreHero.body (cyclomatic 16) Atria/Atria/AtriaOverviewSections.swift:7846 — AtriaRecoveryScoreHero.body has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: AtriaTodayMetric.label (cyclomatic 23) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · AtriaRecoveredMotionAnalytics.sleepProvenance (cyclomatic 16) · ×1
  • AtriaRecoveredMotionAnalytics.sleepProvenance (cyclomatic 16) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:150 — AtriaRecoveredMotionAnalytics.sleepProvenance has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaStepsWeekChart.body (cyclomatic 16) · ×1
  • AtriaStepsWeekChart.body (cyclomatic 16) Atria/Atria/AtriaStepsWeekChart.swift:247 — AtriaStepsWeekChart.body has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive (cyclomatic 16) · ×1
  • AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive (cyclomatic 16) Atria/Atria/AtriaStrapCalibrationArchive.swift:332 — AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaHistoricalStressReplay.snapshot (cyclomatic 16) · ×1
  • AtriaHistoricalStressReplay.snapshot (cyclomatic 16) Atria/Atria/AtriaStressMonitor.swift:1600 — AtriaHistoricalStressReplay.snapshot has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaTrendChartCard.body (cyclomatic 16) · ×1
  • AtriaTrendChartCard.body (cyclomatic 16) Atria/Atria/AtriaTrendChart.swift:99 — AtriaTrendChartCard.body has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AtriaCollectionResearchSignalsCard.body (cyclomatic 16) · ×1
  • AtriaCollectionResearchSignalsCard.body (cyclomatic 16) Atria/Atria/AtriaVitalsCollectionSections.swift:2259 — AtriaCollectionResearchSignalsCard.body has cyclomatic complexity 16 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · AtriaWhoop4MotionTickCompactStore.motionTickWindowRead (cyclomatic 16) · ×1
  • AtriaWhoop4MotionTickCompactStore.motionTickWindowRead (cyclomatic 16) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1911 — AtriaWhoop4MotionTickCompactStore.motionTickWindowRead has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout (cyclomatic 16) · ×1
  • AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout (cyclomatic 16) Atria/Atria/AtriaWorkoutPromptEvaluator.swift:346 — AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout has cyclomatic complexity 16 (threshold 15). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible (cyclomatic 16) · ×1
  • HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible (cyclomatic 16) Atria/Atria/HistoricalArchive.swift:4678 — HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · HistoricalArchive.prunedRecoveredCache (cyclomatic 16) · ×1
  • HistoricalArchive.prunedRecoveredCache (cyclomatic 16) Atria/Atria/HistoricalArchive.swift:6927 — HistoricalArchive.prunedRecoveredCache has cyclomatic complexity 16 (threshold 15). Of this number, 11 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · HistoricalArchive.fastHeartRatePoint (cyclomatic 16) · ×1
  • HistoricalArchive.fastHeartRatePoint (cyclomatic 16) Atria/Atria/HistoricalArchive.swift:9466 — HistoricalArchive.fastHeartRatePoint has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · LocalNotificationScheduler.scheduleActionableConnectionDiagnosis (cyclomatic 16) · ×1
  • LocalNotificationScheduler.scheduleActionableConnectionDiagnosis (cyclomatic 16) Atria/Atria/LocalNotificationScheduler.swift:814 — LocalNotificationScheduler.scheduleActionableConnectionDiagnosis has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · SessionStore.persistPreparedDailyRollups (cyclomatic 16) · ×1
  • SessionStore.persistPreparedDailyRollups (cyclomatic 16) Atria/Atria/Sessions.swift:13397 — SessionStore.persistPreparedDailyRollups has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.runRecoveredIndependentDerivedSteps (cyclomatic 16) · ×1
  • SessionStore.runRecoveredIndependentDerivedSteps (cyclomatic 16) Atria/Atria/Sessions.swift:19576 — SessionStore.runRecoveredIndependentDerivedSteps 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.shouldAdmitAutomaticArchiveCompaction (cyclomatic 16) · ×1
  • SessionStore.shouldAdmitAutomaticArchiveCompaction (cyclomatic 16) Atria/Atria/Sessions.swift:28160 — SessionStore.shouldAdmitAutomaticArchiveCompaction has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.preferredGrowingSleepReview (cyclomatic 16) · ×1
  • SessionStore.preferredGrowingSleepReview (cyclomatic 16) Atria/Atria/Sessions.swift:37671 — SessionStore.preferredGrowingSleepReview has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.maybeScheduleDaytimeQuiescenceReview (cyclomatic 16) · ×1
  • SessionStore.maybeScheduleDaytimeQuiescenceReview (cyclomatic 16) Atria/Atria/Sessions.swift:39774 — SessionStore.maybeScheduleDaytimeQuiescenceReview 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. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.prepareWakeBoundarySleep (cyclomatic 16) · ×1
  • SessionStore.prepareWakeBoundarySleep (cyclomatic 16) Atria/Atria/Sessions.swift:41626 — SessionStore.prepareWakeBoundarySleep has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.isStrongAutoConfirmableSleepCandidate (cyclomatic 16) · ×1
  • SessionStore.isStrongAutoConfirmableSleepCandidate (cyclomatic 16) Atria/Atria/Sessions.swift:42000 — SessionStore.isStrongAutoConfirmableSleepCandidate has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.isUnambiguousHROnlyMainSleepCandidate (cyclomatic 16) · ×1
  • SessionStore.isUnambiguousHROnlyMainSleepCandidate (cyclomatic 16) Atria/Atria/Sessions.swift:42093 — SessionStore.isUnambiguousHROnlyMainSleepCandidate has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · SessionStore.confirmedMainSleepHRVEvidenceCancellable (cyclomatic 16) · ×1
  • SessionStore.confirmedMainSleepHRVEvidenceCancellable (cyclomatic 16) Atria/Atria/Sessions.swift:44567 — SessionStore.confirmedMainSleepHRVEvidenceCancellable has cyclomatic complexity 16 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: Tag.label (cyclomatic 41) is higher and carries no row of its own — it was excluded as a flat dispatcher (a long switch/match over independent cases: many branches, almost no nesting), which this dimension does not treat as a refactor obligation. It is named here so the ranking you see in this file is not mistaken for the whole of it; the excluded method is counted neither in this dimension's figures nor in its score.
D1 · Cyclomatic Complexity · WidgetSnapshotPublisher.timelineReloadDelay (cyclomatic 16) · ×1
  • WidgetSnapshotPublisher.timelineReloadDelay (cyclomatic 16) Atria/Atria/WidgetSnapshot.swift:2504 — WidgetSnapshotPublisher.timelineReloadDelay has cyclomatic complexity 16 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · AtriaWidgetMetric.value (cyclomatic 16) · ×1
  • AtriaWidgetMetric.value (cyclomatic 16) Atria/AtriaWidget/AtriaWidget.swift:3608 — AtriaWidgetMetric.value 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.
D2 · Cognitive Complexity · SessionStore.aggregateSleepCandidatesCore (cognitive 330) · ×1
  • SessionStore.aggregateSleepCandidatesCore (cognitive 330) Atria/Atria/Sessions.swift:50025 — SessionStore.aggregateSleepCandidatesCore has cognitive complexity 330 (threshold 15). Drivers by points: boolean chains 160, if/else 71 (118 pts), loops 20 (29 pts), ternaries 16 (22 pts), match/switch 1 (nesting depth added 62). Of this number, 323 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.validateSessionBackupEnvelopeForImport (cognitive 302) · ×1
  • SessionStore.validateSessionBackupEnvelopeForImport (cognitive 302) Atria/Atria/Sessions.swift:48099 — SessionStore.validateSessionBackupEnvelopeForImport has cognitive complexity 302 (threshold 15). Drivers by points: boolean chains 336, if/else 16 (24 pts), loops 5 (7 pts), ternaries 3 (nesting depth added 10). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · HistoricalArchive.compactArchive (cognitive 257) · ×1
  • HistoricalArchive.compactArchive (cognitive 257) Atria/Atria/HistoricalArchive.swift:9722 — HistoricalArchive.compactArchive has cognitive complexity 257 (threshold 15). Drivers by points: if/else 58 (152 pts), ternaries 16 (57 pts), error handling 7 (21 pts), boolean chains 12, loops 3 (9 pts), match/switch 2 (6 pts) (nesting depth added 159). Of this number, 255 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cognitive 236) · ×1
  • AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded (cognitive 236) REDACTED:13289 — AtriaBLEManager.requestOfflineHistoricalSyncIfNeeded has cognitive complexity 236 (threshold 15). Drivers by points: if/else 61 (87 pts), boolean chains 80, ternaries 34 (64 pts), error handling 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.armHistoryOnlyProbe (cognitive 235) · ×1
  • AtriaBLEManager.armHistoryOnlyProbe (cognitive 235) REDACTED:40410 — AtriaBLEManager.armHistoryOnlyProbe has cognitive complexity 235 (threshold 15). Drivers by points: if/else 67 (152 pts), boolean chains 53, loops 7 (15 pts), ternaries 7 (13 pts), match/switch 1 (2 pts) (nesting depth added 100). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.peripheral (cognitive 231) · ×1
  • AtriaBLEManager.peripheral (cognitive 231) REDACTED:55594 — AtriaBLEManager.peripheral has cognitive complexity 231 (threshold 15). Drivers by points: if/else 72 (159 pts), boolean chains 44, ternaries 7 (19 pts), match/switch 2 (6 pts), loops 2 (3 pts) (nesting depth added 104). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleFullDrainConsumerMaterialization (cognitive 215) · ×1
  • AtriaBLEManager.scheduleFullDrainConsumerMaterialization (cognitive 215) REDACTED:46608 — AtriaBLEManager.scheduleFullDrainConsumerMaterialization has cognitive complexity 215 (threshold 15). Drivers by points: if/else 61 (157 pts), boolean chains 31, error handling 9 (15 pts), ternaries 4 (12 pts) (nesting depth added 110). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.peripheral (cognitive 211) · ×1
  • AtriaBLEManager.peripheral (cognitive 211) REDACTED:56686 — AtriaBLEManager.peripheral has cognitive complexity 211 (threshold 15). Drivers by points: if/else 77 (147 pts), boolean chains 33, ternaries 7 (21 pts), loops 4 (6 pts), match/switch 2 (4 pts) (nesting depth added 88). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.resumedSleepReviewCandidatesCore (cognitive 185) · ×1
  • SessionStore.resumedSleepReviewCandidatesCore (cognitive 185) Atria/Atria/Sessions.swift:51622 — SessionStore.resumedSleepReviewCandidatesCore has cognitive complexity 185 (threshold 15). Drivers by points: if/else 41 (108 pts), loops 22 (48 pts), boolean chains 25, ternaries 2 (4 pts) (nesting depth added 95). Of this number, 180 points are the body's own statements and 5 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify (cognitive 178) · ×1
  • AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify (cognitive 178) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:88 — AtriaWhoop4SacrificialFastDrainReceiptVerifier.verify has cognitive complexity 178 (threshold 15). Drivers by points: boolean chains 84, if/else 34 (84 pts), match/switch 2 (7 pts), loops 2 (3 pts) (nesting depth added 56). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.processHistoricalDrainEffects (cognitive 166) · ×1
  • AtriaBLEManager.processHistoricalDrainEffects (cognitive 166) REDACTED:45898 — AtriaBLEManager.processHistoricalDrainEffects has cognitive complexity 166 (threshold 15). Drivers by points: if/else 41 (125 pts), boolean chains 25, error handling 2 (7 pts), ternaries 2 (6 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 94). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.centralManager (cognitive 164) · ×1
  • AtriaBLEManager.centralManager (cognitive 164) REDACTED:54164 — AtriaBLEManager.centralManager has cognitive complexity 164 (threshold 15). Drivers by points: if/else 69 (97 pts), boolean chains 37, ternaries 14 (30 pts) (nesting depth added 44). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.applyLaunchAutomation (cognitive 159) · ×1
  • AtriaBLEManager.applyLaunchAutomation (cognitive 159) REDACTED:24590 — AtriaBLEManager.applyLaunchAutomation has cognitive complexity 159 (threshold 15). Drivers by points: if/else 67 (81 pts), boolean chains 66, ternaries 5 (10 pts), loops 1 (2 pts) (nesting depth added 20). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.logGateStatusFromLaunchIfRequested (cognitive 143) · ×1
  • SessionStore.logGateStatusFromLaunchIfRequested (cognitive 143) Atria/Atria/Sessions.swift:31247 — SessionStore.logGateStatusFromLaunchIfRequested has cognitive complexity 143 (threshold 15). Drivers by points: ternaries 103 (104 pts), boolean chains 32, if/else 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority (cognitive 143) · ×1
  • WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority (cognitive 143) Atria/Atria/WidgetSnapshot.swift:824 — WidgetSnapshotPublisher.snapshotPreservingFresherStepAuthority has cognitive complexity 143 (threshold 15). Drivers by points: if/else 32 (62 pts), ternaries 12 (48 pts), boolean chains 33 (nesting depth added 66). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.validate (cognitive 140) · ×1
  • AtriaHistoricalFullDrainCoverageStore.validate (cognitive 140) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1159 — AtriaHistoricalFullDrainCoverageStore.validate has cognitive complexity 140 (threshold 15). Drivers by points: boolean chains 77, if/else 31 (58 pts), match/switch 2 (3 pts), error handling 1, loops 1 (nesting depth added 28). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.startOfflineHistoricalSync (cognitive 139) · ×1
  • AtriaBLEManager.startOfflineHistoricalSync (cognitive 139) REDACTED:16963 — AtriaBLEManager.startOfflineHistoricalSync has cognitive complexity 139 (threshold 15). Drivers by points: if/else 63 (84 pts), boolean chains 43, ternaries 7 (9 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 24). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.runRecoveredHeartRateProjection (cognitive 135) · ×1
  • SessionStore.runRecoveredHeartRateProjection (cognitive 135) Atria/Atria/Sessions.swift:15199 — SessionStore.runRecoveredHeartRateProjection has cognitive complexity 135 (threshold 15). Drivers by points: if/else 79 (105 pts), boolean chains 17, loops 5 (7 pts), match/switch 3 (4 pts), ternaries 2 (nesting depth added 29). Of this number, 120 points are the body's own statements and 15 belong to 5 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.logBoundedLargeStoreGateStatus (cognitive 128) · ×1
  • SessionStore.logBoundedLargeStoreGateStatus (cognitive 128) Atria/Atria/Sessions.swift:31571 — SessionStore.logBoundedLargeStoreGateStatus has cognitive complexity 128 (threshold 15). Drivers by points: ternaries 90 (94 pts), boolean chains 31, if/else 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.awakeSplitSubClusters (cognitive 128) · ×1
  • SessionStore.awakeSplitSubClusters (cognitive 128) Atria/Atria/Sessions.swift:51200 — SessionStore.awakeSplitSubClusters has cognitive complexity 128 (threshold 15). Drivers by points: if/else 29 (75 pts), loops 10 (19 pts), ternaries 5 (19 pts), boolean chains 15 (nesting depth added 69). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_hrv.main (cognitive 124) · ×1
  • validate_hrv.main (cognitive 124) validate_hrv.py:580 — validate_hrv.main has cognitive complexity 124 (threshold 15). Drivers by points: if/else 70 (89 pts), ternaries 12 (15 pts), boolean chains 14, loops 4 (6 pts) (nesting depth added 24). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaPhysiologicalCycle.canonicalMainSleepsCancellable (cognitive 123) · ×1
  • AtriaPhysiologicalCycle.canonicalMainSleepsCancellable (cognitive 123) Atria/Atria/Sessions.swift:441 — AtriaPhysiologicalCycle.canonicalMainSleepsCancellable has cognitive complexity 123 (threshold 15). Drivers by points: if/else 33 (83 pts), boolean chains 19, loops 9 (18 pts), ternaries 2 (3 pts) (nesting depth added 60). Of this number, 92 points are the body's own statements and 31 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SleepHistorySnapshot.init (cognitive 121) · ×1
  • SleepHistorySnapshot.init (cognitive 121) Atria/Atria/Sessions.swift:60294 — SleepHistorySnapshot.init has cognitive complexity 121 (threshold 15). Drivers by points: if/else 32 (75 pts), boolean chains 23, loops 7 (14 pts), ternaries 5 (9 pts) (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.latestNightMotionRead (cognitive 120) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightMotionRead (cognitive 120) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:544 — AtriaWhoop4MotionTickCompactStore.latestNightMotionRead has cognitive complexity 120 (threshold 15). Drivers by points: if/else 28 (74 pts), boolean chains 28, loops 5 (10 pts), error handling 3 (6 pts), match/switch 2 (nesting depth added 54). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.finishOfflineHistoricalSync (cognitive 115) · ×1
  • AtriaBLEManager.finishOfflineHistoricalSync (cognitive 115) REDACTED:19222 — AtriaBLEManager.finishOfflineHistoricalSync has cognitive complexity 115 (threshold 15). Drivers by points: boolean chains 74, if/else 28 (37 pts), error handling 1 (2 pts), loops 1, ternaries 1 (nesting depth added 10). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded (cognitive 114) · ×1
  • AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded (cognitive 114) REDACTED:38001 — AtriaBLEManager.resumePendingWorkoutHistoricalMotionBankOffloadIfNeeded has cognitive complexity 114 (threshold 15). Drivers by points: if/else 44 (59 pts), boolean chains 46, ternaries 7, match/switch 1 (2 pts) (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaTopStatusProjection.presentation (cognitive 114) · ×1
  • AtriaTopStatusProjection.presentation (cognitive 114) Atria/Atria/AtriaHomeView.swift:14203 — AtriaTopStatusProjection.presentation has cognitive complexity 114 (threshold 15). Drivers by points: if/else 37 (50 pts), ternaries 15 (46 pts), match/switch 5 (11 pts), boolean chains 7 (nesting depth added 50). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.compactLatestNightSessionSlice (cognitive 114) · ×1
  • SessionStore.compactLatestNightSessionSlice (cognitive 114) Atria/Atria/Sessions.swift:38605 — SessionStore.compactLatestNightSessionSlice has cognitive complexity 114 (threshold 15). Drivers by points: if/else 29 (78 pts), boolean chains 17, loops 5 (12 pts), ternaries 2 (5 pts), error handling 1 (2 pts) (nesting depth added 60). Of this number, 108 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.handleRecoveredDataRecomputeEffects (cognitive 107) · ×1
  • SessionStore.handleRecoveredDataRecomputeEffects (cognitive 107) Atria/Atria/Sessions.swift:18410 — SessionStore.handleRecoveredDataRecomputeEffects has cognitive complexity 107 (threshold 15). Drivers by points: if/else 28 (84 pts), ternaries 5 (16 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 68). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.backfillConfirmedSleepStagesFromSessions (cognitive 106) · ×1
  • SessionStore.backfillConfirmedSleepStagesFromSessions (cognitive 106) Atria/Atria/Sessions.swift:46346 — SessionStore.backfillConfirmedSleepStagesFromSessions has cognitive complexity 106 (threshold 15). Drivers by points: if/else 30 (78 pts), boolean chains 15, loops 4 (11 pts), error handling 1, ternaries 1 (nesting depth added 55). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.peripheral (cognitive 101) · ×1
  • AtriaBLEManager.peripheral (cognitive 101) REDACTED:56373 — AtriaBLEManager.peripheral has cognitive complexity 101 (threshold 15). Drivers by points: if/else 47 (77 pts), boolean chains 19, ternaries 3 (5 pts) (nesting depth added 32). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWidgetMetric.statusText (cognitive 100) · ×1
  • AtriaWidgetMetric.statusText (cognitive 100) Atria/AtriaWidget/AtriaWidget.swift:3653 — AtriaWidgetMetric.statusText has cognitive complexity 100 (threshold 15). Drivers by points: if/else 30 (71 pts), ternaries 6 (17 pts), boolean chains 11, match/switch 1 (nesting depth added 52). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.init (cognitive 99) · ×1
  • AtriaBLEManager.init (cognitive 99) REDACTED:6959 — AtriaBLEManager.init has cognitive complexity 99 (threshold 15). Drivers by points: if/else 44 (60 pts), boolean chains 21, ternaries 9 (17 pts), error handling 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.publish (cognitive 95) · ×1
  • WidgetSnapshotPublisher.publish (cognitive 95) Atria/Atria/WidgetSnapshot.swift:1653 — WidgetSnapshotPublisher.publish has cognitive complexity 95 (threshold 15). Drivers by points: ternaries 47 (54 pts), if/else 20 (22 pts), boolean chains 19 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature (cognitive 93) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature (cognitive 93) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1057 — AtriaWhoop4MotionTickCompactStore.latestNightEpochFeature has cognitive complexity 93 (threshold 15). Drivers by points: if/else 26 (48 pts), boolean chains 22, loops 7 (16 pts), ternaries 5 (7 pts) (nesting depth added 33). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaColdSessionSourceScanner.scanFrames (cognitive 92) · ×1
  • AtriaColdSessionSourceScanner.scanFrames (cognitive 92) Atria/Atria/AtriaColdSessionSourceScanner.swift:48 — AtriaColdSessionSourceScanner.scanFrames has cognitive complexity 92 (threshold 15). Drivers by points: if/else 25 (77 pts), error handling 1 (6 pts), boolean chains 4, loops 2 (3 pts), ternaries 1 (2 pts) (nesting depth added 59). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaDailyStepPresentation.resolve (cognitive 92) · ×1
  • AtriaDailyStepPresentation.resolve (cognitive 92) Atria/Atria/AtriaDailyStepPresentation.swift:480 — AtriaDailyStepPresentation.resolve has cognitive complexity 92 (threshold 15). Drivers by points: boolean chains 49, ternaries 20 (29 pts), if/else 13 (14 pts) (nesting depth added 10). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWorkoutActivityType.resolved (cognitive 91) · ×1
  • AtriaWorkoutActivityType.resolved (cognitive 91) Atria/Atria/AtriaExerciseCatalog.swift:292 — AtriaWorkoutActivityType.resolved has cognitive complexity 91 (threshold 15). Drivers by points: if/else 60, boolean chains 31. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.archiveOnlyHeartRateSegmentsCancellable (cognitive 90) · ×1
  • SessionStore.archiveOnlyHeartRateSegmentsCancellable (cognitive 90) Atria/Atria/Sessions.swift:27378 — SessionStore.archiveOnlyHeartRateSegmentsCancellable has cognitive complexity 90 (threshold 15). Drivers by points: if/else 27 (56 pts), boolean chains 19, loops 9 (14 pts), ternaries 1 (nesting depth added 34). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalAggregateReader.streamedWholeArchiveDigest (cognitive 89) · ×1
  • AtriaHistoricalAggregateReader.streamedWholeArchiveDigest (cognitive 89) Atria/Atria/AtriaHistoricalAggregateReader.swift:269 — AtriaHistoricalAggregateReader.streamedWholeArchiveDigest has cognitive complexity 89 (threshold 15). Drivers by points: if/else 19 (49 pts), boolean chains 27, error handling 4 (9 pts), loops 3 (4 pts) (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.runForegroundKeepaliveTick (cognitive 88) · ×1
  • AtriaBLEManager.runForegroundKeepaliveTick (cognitive 88) REDACTED:10681 — AtriaBLEManager.runForegroundKeepaliveTick has cognitive complexity 88 (threshold 15). Drivers by points: if/else 35 (52 pts), boolean chains 25, ternaries 6 (9 pts), match/switch 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeBehaviorCorrelationSummariesCancellable (cognitive 88) · ×1
  • SessionStore.makeBehaviorCorrelationSummariesCancellable (cognitive 88) Atria/Atria/Sessions.swift:47378 — SessionStore.makeBehaviorCorrelationSummariesCancellable has cognitive complexity 88 (threshold 15). Drivers by points: if/else 22 (47 pts), ternaries 9 (17 pts), loops 10 (13 pts), boolean chains 11 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleLongWearSupervisor (cognitive 87) · ×1
  • AtriaBLEManager.scheduleLongWearSupervisor (cognitive 87) REDACTED:25154 — AtriaBLEManager.scheduleLongWearSupervisor has cognitive complexity 87 (threshold 15). Drivers by points: if/else 30 (64 pts), boolean chains 17, ternaries 2 (5 pts), loops 1 (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.peripheral (cognitive 87) · ×1
  • AtriaBLEManager.peripheral (cognitive 87) REDACTED:55342 — AtriaBLEManager.peripheral has cognitive complexity 87 (threshold 15). Drivers by points: if/else 35 (57 pts), ternaries 4 (14 pts), boolean chains 9, match/switch 2 (6 pts), loops 1 (nesting depth added 36). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.peripheral (cognitive 85) · ×1
  • AtriaBLEManager.peripheral (cognitive 85) REDACTED:56116 — AtriaBLEManager.peripheral has cognitive complexity 85 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 31, ternaries 4 (11 pts), match/switch 1 (3 pts) (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.durableStepPatchedSnapshot (cognitive 85) · ×1
  • WidgetSnapshotPublisher.durableStepPatchedSnapshot (cognitive 85) Atria/Atria/WidgetSnapshot.swift:566 — WidgetSnapshotPublisher.durableStepPatchedSnapshot has cognitive complexity 85 (threshold 15). Drivers by points: boolean chains 41, if/else 15 (22 pts), ternaries 19 (21 pts), match/switch 1 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaDiagnosisReport.discrepancies (cognitive 84) · ×1
  • AtriaDiagnosisReport.discrepancies (cognitive 84) Atria/Atria/AtriaDiagnosisReport.swift:285 — AtriaDiagnosisReport.discrepancies has cognitive complexity 84 (threshold 15). Drivers by points: boolean chains 45, if/else 31 (38 pts), loops 1 (nesting depth added 7). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare (cognitive 83) · ×1
  • AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare (cognitive 83) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1133 — AtriaWhoop4GravityCadenceStepModel.qualifiedOrdinaryBandPowerShare has cognitive complexity 83 (threshold 15). Drivers by points: if/else 33 (49 pts), boolean chains 23, loops 6 (10 pts), ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.autoConfirmSleepOnForegroundIfUseful (cognitive 83) · ×1
  • SessionStore.autoConfirmSleepOnForegroundIfUseful (cognitive 83) Atria/Atria/Sessions.swift:39229 — SessionStore.autoConfirmSleepOnForegroundIfUseful has cognitive complexity 83 (threshold 15). Drivers by points: if/else 36 (52 pts), boolean chains 18, ternaries 4 (7 pts), match/switch 3 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.makeRecoveredDataSnapshot (cognitive 82) · ×1
  • HistoricalArchive.makeRecoveredDataSnapshot (cognitive 82) Atria/Atria/HistoricalArchive.swift:6298 — HistoricalArchive.makeRecoveredDataSnapshot has cognitive complexity 82 (threshold 15). Drivers by points: if/else 41 (56 pts), boolean chains 19, loops 4 (6 pts), match/switch 1 (nesting depth added 17). Of this number, 65 points are the body's own statements and 17 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.attachRecoveredSkinTemperatureCancellable (cognitive 81) · ×1
  • SessionStore.attachRecoveredSkinTemperatureCancellable (cognitive 81) Atria/Atria/Sessions.swift:22768 — SessionStore.attachRecoveredSkinTemperatureCancellable has cognitive complexity 81 (threshold 15). Drivers by points: if/else 25 (52 pts), loops 11 (17 pts), boolean chains 10, ternaries 2 (nesting depth added 33). Of this number, 76 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.centralManager (cognitive 79) · ×1
  • AtriaBLEManager.centralManager (cognitive 79) REDACTED:53660 — AtriaBLEManager.centralManager has cognitive complexity 79 (threshold 15). Drivers by points: if/else 38 (53 pts), boolean chains 17, ternaries 4 (9 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalJSONLRecentScanner.scan (cognitive 79) · ×1
  • AtriaHistoricalJSONLRecentScanner.scan (cognitive 79) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:129 — AtriaHistoricalJSONLRecentScanner.scan has cognitive complexity 79 (threshold 15). Drivers by points: if/else 17 (62 pts), loops 3 (8 pts), boolean chains 5, error handling 2 (4 pts) (nesting depth added 52). Of this number, 52 points are the body's own statements and 27 belong to 2 function items inside it that branch. To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded (cognitive 78) · ×1
  • AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded (cognitive 78) REDACTED:41909 — AtriaBLEManager.startReadOnlyHistoryCaptureIfNeeded has cognitive complexity 78 (threshold 15). Drivers by points: if/else 26 (40 pts), boolean chains 29, ternaries 4 (5 pts), loops 3, error handling 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow (cognitive 78) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow (cognitive 78) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:527 — AtriaWhoop4GravityCadenceStepModel.estimateQualifiedWindow has cognitive complexity 78 (threshold 15). Drivers by points: if/else 31 (38 pts), boolean chains 27, loops 5 (8 pts), match/switch 1 (4 pts), ternaries 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint (cognitive 77) · ×1
  • HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint (cognitive 77) Atria/Atria/HistoricalArchive.swift:4725 — HistoricalArchive.readAutomaticRecoveredDataBootstrapCheckpoint has cognitive complexity 77 (threshold 15). Drivers by points: if/else 13 (37 pts), boolean chains 18, error handling 7 (11 pts), loops 4 (11 pts) (nesting depth added 35). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded (cognitive 76) · ×1
  • AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded (cognitive 76) REDACTED:17830 — AtriaBLEManager.archiveOrphanHistoricalIngressIfNeeded has cognitive complexity 76 (threshold 15). Drivers by points: if/else 23 (48 pts), ternaries 3 (10 pts), boolean chains 7, loops 2 (5 pts), match/switch 1 (4 pts), error handling 2 (nesting depth added 38). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.scheduleConfirmedWorkoutArchiveRehydration (cognitive 76) · ×1
  • SessionStore.scheduleConfirmedWorkoutArchiveRehydration (cognitive 76) Atria/Atria/Sessions.swift:19830 — SessionStore.scheduleConfirmedWorkoutArchiveRehydration has cognitive complexity 76 (threshold 15). Drivers by points: if/else 40 (51 pts), boolean chains 19, match/switch 1 (3 pts), ternaries 2, loops 1 (nesting depth added 13). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.evaluate (cognitive 75) · ×1
  • AtriaHistoricalStressReplay.evaluate (cognitive 75) Atria/Atria/AtriaStressMonitor.swift:2125 — AtriaHistoricalStressReplay.evaluate has cognitive complexity 75 (threshold 15). Drivers by points: if/else 17 (40 pts), boolean chains 21, loops 8 (14 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaLiveWorkoutTRIMPAccumulator.metrics (cognitive 74) · ×1
  • AtriaLiveWorkoutTRIMPAccumulator.metrics (cognitive 74) Atria/Atria/AtriaLiveWorkoutView.swift:450 — AtriaLiveWorkoutTRIMPAccumulator.metrics has cognitive complexity 74 (threshold 15). Drivers by points: boolean chains 33, if/else 21 (33 pts), ternaries 5 (7 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.publishAndVerifyHistoricalConsumerCutover (cognitive 73) · ×1
  • HistoricalArchive.publishAndVerifyHistoricalConsumerCutover (cognitive 73) Atria/Atria/HistoricalArchive.swift:2721 — HistoricalArchive.publishAndVerifyHistoricalConsumerCutover has cognitive complexity 73 (threshold 15). Drivers by points: boolean chains 42, if/else 22 (27 pts), error handling 2, ternaries 2 (nesting depth added 5). Of this number, 72 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.sleepStageResearchSegmentsCore (cognitive 72) · ×1
  • SessionStore.sleepStageResearchSegmentsCore (cognitive 72) Atria/Atria/Sessions.swift:43794 — SessionStore.sleepStageResearchSegmentsCore has cognitive complexity 72 (threshold 15). Drivers by points: if/else 17 (48 pts), boolean chains 12, loops 6 (12 pts) (nesting depth added 37). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration (cognitive 71) · ×1
  • AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration (cognitive 71) REDACTED:7773 — AtriaBLEManager.applyEarlyHistoricalLaunchConfiguration has cognitive complexity 71 (threshold 15). Drivers by points: if/else 25 (48 pts), ternaries 6 (10 pts), boolean chains 9, error handling 2 (4 pts) (nesting depth added 29). Of this number, 59 points are the body's own statements and 12 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.motionTickDayEvidenceReadImpl (cognitive 71) · ×1
  • HistoricalArchive.motionTickDayEvidenceReadImpl (cognitive 71) Atria/Atria/HistoricalArchive.swift:3744 — HistoricalArchive.motionTickDayEvidenceReadImpl has cognitive complexity 71 (threshold 15). Drivers by points: if/else 27 (45 pts), boolean chains 39, loops 4 (5 pts), ternaries 2 (4 pts), error handling 1 (2 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. This shape REPEATS in the file: one other method here (HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaHistoricalAggregateReader.load (cognitive 70) · ×1
  • AtriaHistoricalAggregateReader.load (cognitive 70) Atria/Atria/AtriaHistoricalAggregateReader.swift:104 — AtriaHistoricalAggregateReader.load has cognitive complexity 70 (threshold 15). Drivers by points: if/else 18 (45 pts), boolean chains 18, error handling 2 (4 pts), loops 2 (3 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.materialize (cognitive 70) · ×1
  • AtriaHistoricalStressReplay.materialize (cognitive 70) Atria/Atria/AtriaStressMonitor.swift:1665 — AtriaHistoricalStressReplay.materialize has cognitive complexity 70 (threshold 15). Drivers by points: if/else 14 (35 pts), boolean chains 24, loops 6 (9 pts), ternaries 2 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.recoveredSkinTemperatureProjectionCancellable (cognitive 70) · ×1
  • SessionStore.recoveredSkinTemperatureProjectionCancellable (cognitive 70) Atria/Atria/Sessions.swift:23037 — SessionStore.recoveredSkinTemperatureProjectionCancellable has cognitive complexity 70 (threshold 15). Drivers by points: if/else 25 (46 pts), loops 9 (12 pts), boolean chains 11, ternaries 1 (nesting depth added 24). Of this number, 65 points are the body's own statements and 5 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.physiologicalSleepReviewNightDraftCore (cognitive 68) · ×1
  • SessionStore.physiologicalSleepReviewNightDraftCore (cognitive 68) Atria/Atria/Sessions.swift:37821 — SessionStore.physiologicalSleepReviewNightDraftCore has cognitive complexity 68 (threshold 15). Drivers by points: if/else 14 (25 pts), ternaries 10 (20 pts), boolean chains 17, loops 5 (6 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.runSacrificialFastDrainSlices (cognitive 67) · ×1
  • AtriaBLEManager.runSacrificialFastDrainSlices (cognitive 67) REDACTED:41105 — AtriaBLEManager.runSacrificialFastDrainSlices has cognitive complexity 67 (threshold 15). Drivers by points: if/else 15 (36 pts), boolean chains 17, loops 4 (8 pts), error handling 1 (4 pts), ternaries 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.centralManagerDidUpdateState (cognitive 67) · ×1
  • AtriaBLEManager.centralManagerDidUpdateState (cognitive 67) REDACTED:53006 — AtriaBLEManager.centralManagerDidUpdateState has cognitive complexity 67 (threshold 15). Drivers by points: if/else 25 (41 pts), boolean chains 13, ternaries 4 (12 pts), match/switch 1 (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.centralManager (cognitive 65) · ×1
  • AtriaBLEManager.centralManager (cognitive 65) REDACTED:53285 — AtriaBLEManager.centralManager has cognitive complexity 65 (threshold 15). Drivers by points: if/else 33 (49 pts), boolean chains 7, ternaries 3 (5 pts), loops 2 (3 pts), match/switch 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalAggregateReader.loadPage (cognitive 64) · ×1
  • AtriaHistoricalAggregateReader.loadPage (cognitive 64) Atria/Atria/AtriaHistoricalAggregateReader.swift:525 — AtriaHistoricalAggregateReader.loadPage has cognitive complexity 64 (threshold 15). Drivers by points: if/else 12 (31 pts), boolean chains 21, error handling 4 (8 pts), loops 3 (4 pts) (nesting depth added 24). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeSleepReviewNightForCacheCore (cognitive 63) · ×1
  • SessionStore.makeSleepReviewNightForCacheCore (cognitive 63) Atria/Atria/Sessions.swift:37221 — SessionStore.makeSleepReviewNightForCacheCore has cognitive complexity 63 (threshold 15). Drivers by points: if/else 23 (33 pts), boolean chains 23, ternaries 4 (7 pts) (nesting depth added 13). Of this number, 52 points are the body's own statements and 11 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalActivityProjection.detectCandidates (cognitive 62) · ×1
  • AtriaHistoricalActivityProjection.detectCandidates (cognitive 62) Atria/Atria/AtriaHistoricalActivityProjection.swift:521 — AtriaHistoricalActivityProjection.detectCandidates has cognitive complexity 62 (threshold 15). Drivers by points: if/else 19 (39 pts), boolean chains 13, loops 5 (7 pts), ternaries 3 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeMorningFrozenDailyMetric (cognitive 62) · ×1
  • SessionStore.makeMorningFrozenDailyMetric (cognitive 62) Atria/Atria/Sessions.swift:24454 — SessionStore.makeMorningFrozenDailyMetric has cognitive complexity 62 (threshold 15). Drivers by points: if/else 24 (32 pts), boolean chains 15, ternaries 12 (13 pts), loops 2 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.confirmWorkoutWindow (cognitive 62) · ×1
  • SessionStore.confirmWorkoutWindow (cognitive 62) Atria/Atria/Sessions.swift:34270 — SessionStore.confirmWorkoutWindow has cognitive complexity 62 (threshold 15). Drivers by points: ternaries 21 (25 pts), if/else 13 (21 pts), boolean chains 13, loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable (cognitive 61) · ×1
  • AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable (cognitive 61) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:111 — AtriaRecoveredHeartRateProjection.recoveredSessionsCancellable has cognitive complexity 61 (threshold 15). Drivers by points: if/else 18 (35 pts), loops 8 (13 pts), boolean chains 8, ternaries 3 (5 pts) (nesting depth added 24). Of this number, 57 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.mergeDailyMetricHistoryCancellable (cognitive 61) · ×1
  • SessionStore.mergeDailyMetricHistoryCancellable (cognitive 61) Atria/Atria/Sessions.swift:23768 — SessionStore.mergeDailyMetricHistoryCancellable has cognitive complexity 61 (threshold 15). Drivers by points: if/else 20 (34 pts), boolean chains 18, ternaries 3 (6 pts), loops 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.editConfirmedWorkout (cognitive 61) · ×1
  • SessionStore.editConfirmedWorkout (cognitive 61) Atria/Atria/Sessions.swift:35971 — SessionStore.editConfirmedWorkout has cognitive complexity 61 (threshold 15). Drivers by points: ternaries 11 (31 pts), if/else 12 (19 pts), boolean chains 6, loops 2 (5 pts) (nesting depth added 30). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SleepHistorySnapshot.combiningResumedSleepSegments (cognitive 61) · ×1
  • SleepHistorySnapshot.combiningResumedSleepSegments (cognitive 61) Atria/Atria/Sessions.swift:60565 — SleepHistorySnapshot.combiningResumedSleepSegments has cognitive complexity 61 (threshold 15). Drivers by points: if/else 21 (32 pts), boolean chains 23, loops 6 (nesting depth added 11). Of this number, 43 points are the body's own statements and 18 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Night.reconciledHROnlyDisplaySegments (cognitive 60) · ×1
  • Night.reconciledHROnlyDisplaySegments (cognitive 60) Atria/Atria/Sessions.swift:59825 — Night.reconciledHROnlyDisplaySegments has cognitive complexity 60 (threshold 15). Drivers by points: if/else 22 (34 pts), boolean chains 20, loops 3, ternaries 2 (3 pts) (nesting depth added 13). Of this number, 41 points are the body's own statements and 19 belong to 4 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaNightTimelineAnalyzer.analyze (cognitive 59) · ×1
  • AtriaNightTimelineAnalyzer.analyze (cognitive 59) Atria/Atria/AtriaNightTimelineAnalyzer.swift:66 — AtriaNightTimelineAnalyzer.analyze has cognitive complexity 59 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 18, loops 6 (9 pts), ternaries 4 (7 pts) (nesting depth added 19). Of this number, 56 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures (cognitive 59) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures (cognitive 59) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:923 — AtriaWhoop4MotionTickCompactStore.latestNightEpochFeatures has cognitive complexity 59 (threshold 15). Drivers by points: if/else 14 (34 pts), loops 6 (14 pts), boolean chains 9, match/switch 1 (2 pts) (nesting depth added 29). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.prepareRecoveredProjectionInstall (cognitive 59) · ×1
  • SessionStore.prepareRecoveredProjectionInstall (cognitive 59) Atria/Atria/Sessions.swift:14991 — SessionStore.prepareRecoveredProjectionInstall has cognitive complexity 59 (threshold 15). Drivers by points: if/else 25 (39 pts), boolean chains 9, loops 7, ternaries 4 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.observeProductionHistoryCursorRange (cognitive 58) · ×1
  • AtriaBLEManager.observeProductionHistoryCursorRange (cognitive 58) REDACTED:42566 — AtriaBLEManager.observeProductionHistoryCursorRange has cognitive complexity 58 (threshold 15). Drivers by points: if/else 12 (30 pts), boolean chains 19, loops 3 (5 pts), match/switch 1 (4 pts) (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4HistoryDrainState.receiveFrame (cognitive 58) · ×1
  • AtriaWhoop4HistoryDrainState.receiveFrame (cognitive 58) REDACTED:336 — AtriaWhoop4HistoryDrainState.receiveFrame has cognitive complexity 58 (threshold 15). Drivers by points: if/else 22 (47 pts), boolean chains 10, match/switch 1 (nesting depth added 25). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaWorkoutRouteStore.recoverPendingTransaction (cognitive 58) · ×1
  • AtriaWorkoutRouteStore.recoverPendingTransaction (cognitive 58) Atria/Atria/AtriaWorkoutRoute.swift:1017 — AtriaWorkoutRouteStore.recoverPendingTransaction has cognitive complexity 58 (threshold 15). Drivers by points: if/else 13 (28 pts), boolean chains 14, ternaries 4 (12 pts), match/switch 2 (4 pts) (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.mergeCanonicalHistoricalDetectionsCancellable (cognitive 58) · ×1
  • SessionStore.mergeCanonicalHistoricalDetectionsCancellable (cognitive 58) Atria/Atria/Sessions.swift:21391 — SessionStore.mergeCanonicalHistoricalDetectionsCancellable has cognitive complexity 58 (threshold 15). Drivers by points: if/else 10 (31 pts), loops 5 (11 pts), ternaries 3 (9 pts), boolean chains 7 (nesting depth added 33). Of this number, 56 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.quickMetricReadinessProbe (cognitive 57) · ×1
  • HistoricalArchive.quickMetricReadinessProbe (cognitive 57) Atria/Atria/HistoricalArchive.swift:3248 — HistoricalArchive.quickMetricReadinessProbe has cognitive complexity 57 (threshold 15). Drivers by points: if/else 18 (41 pts), ternaries 4 (7 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaMetricDetailSheet.detailTemplate (cognitive 56) · ×1
  • AtriaMetricDetailSheet.detailTemplate (cognitive 56) Atria/Atria/AtriaOverviewSections.swift:4783 — AtriaMetricDetailSheet.detailTemplate has cognitive complexity 56 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 12 (24 pts), boolean chains 5, match/switch 1 (nesting depth added 24). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaSleepWakeResearch.stage (cognitive 56) · ×1
  • AtriaSleepWakeResearch.stage (cognitive 56) Atria/Atria/AtriaSleepWakeResearch.swift:693 — AtriaSleepWakeResearch.stage has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 33, if/else 16 (22 pts), ternaries 1 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · Recovery.estimate (cognitive 55) · ×1
  • Recovery.estimate (cognitive 55) Atria/Atria/AtriaAnalytics.swift:1374 — Recovery.estimate has cognitive complexity 55 (threshold 15). Drivers by points: ternaries 21 (22 pts), if/else 17 (21 pts), boolean chains 12 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.persistActiveSessionJournalIfNeeded (cognitive 55) · ×1
  • AtriaBLEManager.persistActiveSessionJournalIfNeeded (cognitive 55) REDACTED:23292 — AtriaBLEManager.persistActiveSessionJournalIfNeeded has cognitive complexity 55 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 15, ternaries 12 (14 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 10). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaFullFidelityColdSessionStore.persistLocked (cognitive 55) · ×1
  • AtriaFullFidelityColdSessionStore.persistLocked (cognitive 55) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:472 — AtriaFullFidelityColdSessionStore.persistLocked has cognitive complexity 55 (threshold 15). Drivers by points: if/else 17 (33 pts), boolean chains 12, error handling 2 (4 pts), loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.autoConfirmStrongSleepCandidates (cognitive 55) · ×1
  • SessionStore.autoConfirmStrongSleepCandidates (cognitive 55) Atria/Atria/Sessions.swift:40769 — SessionStore.autoConfirmStrongSleepCandidates has cognitive complexity 55 (threshold 15). Drivers by points: if/else 25 (42 pts), boolean chains 10, ternaries 1 (2 pts), loops 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration (cognitive 54) · ×1
  • AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration (cognitive 54) REDACTED:19797 — AtriaBLEManager.finalizeOfflineHistoricalSyncAfterLiveRestoration has cognitive complexity 54 (threshold 15). Drivers by points: boolean chains 24, if/else 17 (19 pts), ternaries 11 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHistoricalRawRetirementExecutor.retire (cognitive 54) · ×1
  • AtriaHistoricalRawRetirementExecutor.retire (cognitive 54) Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:72 — AtriaHistoricalRawRetirementExecutor.retire has cognitive complexity 54 (threshold 15). Drivers by points: if/else 25 (28 pts), boolean chains 26 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaRecoveredMotionProjection.projectCancellable (cognitive 54) · ×1
  • AtriaRecoveredMotionProjection.projectCancellable (cognitive 54) Atria/Atria/AtriaRecoveredMotionProjection.swift:275 — AtriaRecoveredMotionProjection.projectCancellable has cognitive complexity 54 (threshold 15). Drivers by points: if/else 25 (34 pts), boolean chains 11, loops 5, ternaries 4 (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickSequenceReducer.reduce (cognitive 54) · ×1
  • AtriaWhoop4MotionTickSequenceReducer.reduce (cognitive 54) Atria/Atria/AtriaWhoop4MotionTickSequenceReducer.swift:23 — AtriaWhoop4MotionTickSequenceReducer.reduce has cognitive complexity 54 (threshold 15). Drivers by points: if/else 11 (25 pts), boolean chains 15, ternaries 3 (9 pts), loops 3 (5 pts) (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.qualifiedLnRMSSDWindowsCore (cognitive 54) · ×1
  • SavedSession.qualifiedLnRMSSDWindowsCore (cognitive 54) Atria/Atria/Sessions.swift:1797 — SavedSession.qualifiedLnRMSSDWindowsCore has cognitive complexity 54 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 5 (10 pts), boolean chains 9, ternaries 1 (nesting depth added 22). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeTodayHRZoneMinutesCancellable (cognitive 54) · ×1
  • SessionStore.makeTodayHRZoneMinutesCancellable (cognitive 54) Atria/Atria/Sessions.swift:20805 — SessionStore.makeTodayHRZoneMinutesCancellable has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (36 pts), loops 6 (12 pts), boolean chains 6 (nesting depth added 27). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.freezingAdaptiveSleepNeed (cognitive 54) · ×1
  • SessionStore.freezingAdaptiveSleepNeed (cognitive 54) Atria/Atria/Sessions.swift:44447 — SessionStore.freezingAdaptiveSleepNeed has cognitive complexity 54 (threshold 15). Drivers by points: if/else 15 (37 pts), boolean chains 9, loops 4 (7 pts), ternaries 1 (nesting depth added 25). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.saveConfirmedSleeps (cognitive 54) · ×1
  • SessionStore.saveConfirmedSleeps (cognitive 54) Atria/Atria/Sessions.swift:45543 — SessionStore.saveConfirmedSleeps has cognitive complexity 54 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 16, loops 2 (4 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded (cognitive 53) · ×1
  • AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded (cognitive 53) REDACTED:48363 — AtriaBLEManager.resumePendingFullDrainPublicationIfNeeded has cognitive complexity 53 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 20, error handling 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalLongTermRollup.validate (cognitive 53) · ×1
  • AtriaHistoricalLongTermRollup.validate (cognitive 53) Atria/Atria/AtriaHistoricalLongTermRollup.swift:167 — AtriaHistoricalLongTermRollup.validate has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 41, if/else 9 (11 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.validateSessionBackupEnvelopeForImport · ×1
  • SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence (cognitive 53) Atria/Atria/Sessions.swift:48152 — SessionStore.validateSessionBackupEnvelopeForImport::validCalibrationEvidence has cognitive complexity 53 (threshold 15). Drivers by points: boolean chains 47, if/else 3, ternaries 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. This shape REPEATS in the file: one other method here (SessionStore.validateSessionBackupEnvelopeForImport) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaBLEHistoryTerminalPublicationStore.validate (cognitive 52) · ×1
  • AtriaBLEHistoryTerminalPublicationStore.validate (cognitive 52) Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:298 — AtriaBLEHistoryTerminalPublicationStore.validate has cognitive complexity 52 (threshold 15). Drivers by points: boolean chains 42, if/else 5 (9 pts), match/switch 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.resumeProtectedR10FromRestoredCache (cognitive 52) · ×1
  • AtriaBLEManager.resumeProtectedR10FromRestoredCache (cognitive 52) REDACTED:16487 — AtriaBLEManager.resumeProtectedR10FromRestoredCache has cognitive complexity 52 (threshold 15). Drivers by points: if/else 23 (40 pts), boolean chains 7, ternaries 4, loops 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepWakeResearch.motionContext (cognitive 52) · ×1
  • AtriaSleepWakeResearch.motionContext (cognitive 52) Atria/Atria/AtriaSleepWakeResearch.swift:947 — AtriaSleepWakeResearch.motionContext has cognitive complexity 52 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 14, loops 3 (4 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressMonitorStore.update (cognitive 52) · ×1
  • AtriaStressMonitorStore.update (cognitive 52) Atria/Atria/AtriaStressMonitor.swift:4275 — AtriaStressMonitorStore.update has cognitive complexity 52 (threshold 15). Drivers by points: if/else 26 (32 pts), boolean chains 17, ternaries 2, match/switch 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.logExecutionPriority (cognitive 52) · ×1
  • SessionStore.logExecutionPriority (cognitive 52) Atria/Atria/Sessions.swift:31979 — SessionStore.logExecutionPriority has cognitive complexity 52 (threshold 15). Drivers by points: if/else 25 (26 pts), ternaries 12 (16 pts), boolean chains 10 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.commitPreparedWorkoutWindowConfirmation (cognitive 52) · ×1
  • SessionStore.commitPreparedWorkoutWindowConfirmation (cognitive 52) Atria/Atria/Sessions.swift:33980 — SessionStore.commitPreparedWorkoutWindowConfirmation has cognitive complexity 52 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 19 (22 pts), boolean chains 8 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible (cognitive 51) · ×1
  • AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible (cognitive 51) REDACTED:36012 — AtriaBLEManager.armWorkoutHistoricalMotionBankIfPossible has cognitive complexity 51 (threshold 15). Drivers by points: if/else 21 (26 pts), boolean chains 22, ternaries 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.windowedWorkoutCandidates (cognitive 51) · ×1
  • SessionStore.windowedWorkoutCandidates (cognitive 51) Atria/Atria/Sessions.swift:49467 — SessionStore.windowedWorkoutCandidates has cognitive complexity 51 (threshold 15). Drivers by points: if/else 11 (30 pts), loops 4 (8 pts), ternaries 2 (7 pts), boolean chains 6 (nesting depth added 28). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.drainNextHistoricalTransportEventBurst (cognitive 50) · ×1
  • AtriaBLEManager.drainNextHistoricalTransportEventBurst (cognitive 50) REDACTED:45253 — AtriaBLEManager.drainNextHistoricalTransportEventBurst has cognitive complexity 50 (threshold 15). Drivers by points: if/else 19 (27 pts), error handling 5 (11 pts), boolean chains 8, loops 2 (3 pts), match/switch 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaColdSessionMigration.migrate (cognitive 50) · ×1
  • AtriaColdSessionMigration.migrate (cognitive 50) Atria/Atria/AtriaColdSessionMigration.swift:53 — AtriaColdSessionMigration.migrate has cognitive complexity 50 (threshold 15). Drivers by points: if/else 16 (29 pts), boolean chains 10, error handling 6 (8 pts), ternaries 1 (2 pts), loops 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeOverviewTrendPointsCancellable (cognitive 50) · ×1
  • SessionStore.makeOverviewTrendPointsCancellable (cognitive 50) Atria/Atria/Sessions.swift:20568 — SessionStore.makeOverviewTrendPointsCancellable has cognitive complexity 50 (threshold 15). Drivers by points: if/else 17 (34 pts), loops 6 (8 pts), boolean chains 4, ternaries 2 (4 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.observedHeartRateUnionSecondsCancellable (cognitive 50) · ×1
  • SessionStore.observedHeartRateUnionSecondsCancellable (cognitive 50) Atria/Atria/Sessions.swift:24381 — SessionStore.observedHeartRateUnionSecondsCancellable has cognitive complexity 50 (threshold 15). Drivers by points: if/else 15 (33 pts), boolean chains 10, loops 4 (6 pts), ternaries 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.handleSacrificialFastDrainPayload (cognitive 49) · ×1
  • AtriaBLEManager.handleSacrificialFastDrainPayload (cognitive 49) REDACTED:43423 — AtriaBLEManager.handleSacrificialFastDrainPayload has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (30 pts), boolean chains 13, error handling 3 (5 pts), match/switch 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBehaviorImpact.summariesCancellable (cognitive 49) · ×1
  • AtriaBehaviorImpact.summariesCancellable (cognitive 49) Atria/Atria/AtriaBehaviorImpact.swift:46 — AtriaBehaviorImpact.summariesCancellable has cognitive complexity 49 (threshold 15). Drivers by points: if/else 18 (34 pts), boolean chains 7, loops 5 (7 pts), ternaries 1 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry (cognitive 49) · ×1
  • AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry (cognitive 49) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1651 — AtriaHistoricalArchiveDurableStore.decodeCanonicalIndexEntry has cognitive complexity 49 (threshold 15). Drivers by points: boolean chains 30, if/else 14 (17 pts), loops 2 (nesting depth added 3). Of this number, 25 points are the body's own statements and 24 belong to 4 function items inside it that branch. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.homeSavedAggregateCancellable (cognitive 49) · ×1
  • SessionStore.homeSavedAggregateCancellable (cognitive 49) Atria/Atria/Sessions.swift:27053 — SessionStore.homeSavedAggregateCancellable has cognitive complexity 49 (threshold 15). Drivers by points: if/else 13 (28 pts), loops 9 (13 pts), boolean chains 7, ternaries 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RespRateRsa.estimateCancellable (cognitive 48) · ×1
  • RespRateRsa.estimateCancellable (cognitive 48) Atria/Atria/AtriaAnalytics.swift:57 — RespRateRsa.estimateCancellable has cognitive complexity 48 (threshold 15). Drivers by points: if/else 17 (27 pts), boolean chains 14, loops 6 (7 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.snapshotSession (cognitive 48) · ×1
  • AtriaBLEManager.snapshotSession (cognitive 48) REDACTED:51508 — AtriaBLEManager.snapshotSession has cognitive complexity 48 (threshold 15). Drivers by points: ternaries 29, if/else 10, boolean chains 9. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.compactRespiratoryRateEstimate (cognitive 48) · ×1
  • SessionStore.compactRespiratoryRateEstimate (cognitive 48) Atria/Atria/Sessions.swift:43323 — SessionStore.compactRespiratoryRateEstimate has cognitive complexity 48 (threshold 15). Drivers by points: if/else 21 (35 pts), loops 9 (10 pts), boolean chains 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaScanRecordParser.parseISO8601 (cognitive 47) · ×1
  • AtriaScanRecordParser.parseISO8601 (cognitive 47) Atria/Atria/HistoricalArchive.swift:11397 — AtriaScanRecordParser.parseISO8601 has cognitive complexity 47 (threshold 15). Drivers by points: boolean chains 22, if/else 11 (15 pts), ternaries 5 (7 pts), match/switch 2, loops 1 (nesting depth added 6). Of this number, 43 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.makeHistoryTrendSummariesCancellable (cognitive 47) · ×1
  • SessionStore.makeHistoryTrendSummariesCancellable (cognitive 47) Atria/Atria/Sessions.swift:22456 — SessionStore.makeHistoryTrendSummariesCancellable has cognitive complexity 47 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 5 (8 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 23). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaApp.scheduleLaunchExportsIfRequested (cognitive 46) · ×1
  • AtriaApp.scheduleLaunchExportsIfRequested (cognitive 46) Atria/Atria/AtriaApp.swift:1536 — AtriaApp.scheduleLaunchExportsIfRequested has cognitive complexity 46 (threshold 15). Drivers by points: ternaries 26, boolean chains 16, if/else 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery (cognitive 46) · ×1
  • AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery (cognitive 46) REDACTED:12782 — AtriaBLEManager.beginIdleWindowHistoryTransportWithoutHeartRateRediscovery has cognitive complexity 46 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 6, loops 3 (5 pts), ternaries 2 (4 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.armRealtime (cognitive 46) · ×1
  • AtriaBLEManager.armRealtime (cognitive 46) REDACTED:40087 — AtriaBLEManager.armRealtime has cognitive complexity 46 (threshold 15). Drivers by points: if/else 18 (28 pts), boolean chains 7, ternaries 2 (6 pts), loops 4 (5 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HealthKitExporter.export (cognitive 46) · ×1
  • HealthKitExporter.export (cognitive 46) Atria/Atria/HealthKitExporter.swift:371 — HealthKitExporter.export has cognitive complexity 46 (threshold 15). Drivers by points: boolean chains 21, if/else 17, ternaries 6 (8 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaApp.handleDeferredLaunchWork (cognitive 45) · ×1
  • AtriaApp.handleDeferredLaunchWork (cognitive 45) Atria/Atria/AtriaApp.swift:1398 — AtriaApp.handleDeferredLaunchWork has cognitive complexity 45 (threshold 15). Drivers by points: boolean chains 41, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch (cognitive 45) · ×1
  • AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch (cognitive 45) REDACTED:5076 — AtriaBLEManager.prepareProtectedR10CleanOwnerAtLaunch has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (26 pts), boolean chains 19 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HRVAnalyzer.analyze (cognitive 45) · ×1
  • HRVAnalyzer.analyze (cognitive 45) Atria/Atria/HRV.swift:400 — HRVAnalyzer.analyze has cognitive complexity 45 (threshold 15). Drivers by points: if/else 17 (34 pts), ternaries 5, boolean chains 3, loops 3 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.performAutomaticRecoveredDataBootstrapStep (cognitive 45) · ×1
  • HistoricalArchive.performAutomaticRecoveredDataBootstrapStep (cognitive 45) Atria/Atria/HistoricalArchive.swift:5478 — HistoricalArchive.performAutomaticRecoveredDataBootstrapStep has cognitive complexity 45 (threshold 15). Drivers by points: if/else 31 (36 pts), boolean chains 5, match/switch 2 (3 pts), loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.refreshHistorySnapshotCache (cognitive 45) · ×1
  • SessionStore.refreshHistorySnapshotCache (cognitive 45) Atria/Atria/Sessions.swift:11739 — SessionStore.refreshHistorySnapshotCache has cognitive complexity 45 (threshold 15). Drivers by points: if/else 23 (38 pts), boolean chains 5, ternaries 1 (2 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded (cognitive 44) · ×1
  • AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded (cognitive 44) REDACTED:21878 — AtriaBLEManager.attemptConnectedRawHistoryCatchUpAfterAcceptedHRIfNeeded has cognitive complexity 44 (threshold 15). Drivers by points: if/else 24 (30 pts), boolean chains 11, ternaries 2 (3 pts) (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaR10MotionPipeline.accept (cognitive 44) · ×1
  • AtriaR10MotionPipeline.accept (cognitive 44) Atria/Atria/AtriaR10Motion.swift:1829 — AtriaR10MotionPipeline.accept has cognitive complexity 44 (threshold 15). Drivers by points: if/else 20 (29 pts), ternaries 3 (8 pts), boolean chains 3, match/switch 2 (3 pts), loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepWakeResearch.stageSegmentsCore (cognitive 44) · ×1
  • AtriaSleepWakeResearch.stageSegmentsCore (cognitive 44) Atria/Atria/AtriaSleepWakeResearch.swift:335 — AtriaSleepWakeResearch.stageSegmentsCore has cognitive complexity 44 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 12, loops 3 (5 pts), ternaries 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.physiologicalCycleStrainByDisplayDayCancellable (cognitive 44) · ×1
  • SessionStore.physiologicalCycleStrainByDisplayDayCancellable (cognitive 44) Atria/Atria/Sessions.swift:13686 — SessionStore.physiologicalCycleStrainByDisplayDayCancellable has cognitive complexity 44 (threshold 15). Drivers by points: if/else 18 (32 pts), boolean chains 5, ternaries 3 (4 pts), loops 3 (nesting depth added 15). Of this number, 35 points are the body's own statements and 9 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.handleProprietary (cognitive 43) · ×1
  • AtriaBLEManager.handleProprietary (cognitive 43) REDACTED:43176 — AtriaBLEManager.handleProprietary has cognitive complexity 43 (threshold 15). Drivers by points: if/else 17 (22 pts), ternaries 4 (9 pts), boolean chains 7, loops 2 (4 pts), match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations (cognitive 43) · ×1
  • AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations (cognitive 43) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1090 — AtriaHistoricalFullDrainCoverageStore.validateTerminalGapReconciliations has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 19, if/else 8 (19 pts), error handling 1 (2 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded (cognitive 43) · ×1
  • AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded (cognitive 43) Atria/Atria/AtriaHomeView.swift:3067 — AtriaHomeView.applyDebugUIScreenLaunchArgumentIfNeeded has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (22 pts), boolean chains 16, loops 1 (2 pts), ternaries 1 (2 pts), match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · HeroSnapshot.== (cognitive 43) · ×1
  • HeroSnapshot.== (cognitive 43) Atria/Atria/AtriaHomeView.swift:9506 — HeroSnapshot.== has cognitive complexity 43 (threshold 15). Drivers by points: boolean chains 43. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.appendRecoveredRecord (cognitive 43) · ×1
  • HistoricalArchive.appendRecoveredRecord (cognitive 43) Atria/Atria/HistoricalArchive.swift:6765 — HistoricalArchive.appendRecoveredRecord has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (34 pts), boolean chains 9 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.legacyCompactArchiveDisabled (cognitive 43) · ×1
  • HistoricalArchive.legacyCompactArchiveDisabled (cognitive 43) Atria/Atria/HistoricalArchive.swift:10644 — HistoricalArchive.legacyCompactArchiveDisabled has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (27 pts), boolean chains 8, loops 4 (5 pts), ternaries 1 (2 pts), error handling 1 (nesting depth added 8). Of this number, 29 points are the body's own statements and 14 belong to 2 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.makeSavedDailyMetricsCancellable (cognitive 43) · ×1
  • SessionStore.makeSavedDailyMetricsCancellable (cognitive 43) Atria/Atria/Sessions.swift:23333 — SessionStore.makeSavedDailyMetricsCancellable has cognitive complexity 43 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 5 (9 pts), boolean chains 5, loops 3 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.prepareConfirmedSleepSave (cognitive 43) · ×1
  • SessionStore.prepareConfirmedSleepSave (cognitive 43) Atria/Atria/Sessions.swift:45283 — SessionStore.prepareConfirmedSleepSave has cognitive complexity 43 (threshold 15). Drivers by points: if/else 22 (29 pts), boolean chains 12, loops 2 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.logSleepValidation (cognitive 43) · ×1
  • SessionStore.logSleepValidation (cognitive 43) Atria/Atria/Sessions.swift:53559 — SessionStore.logSleepValidation has cognitive complexity 43 (threshold 15). Drivers by points: ternaries 12 (19 pts), boolean chains 12, if/else 12 (nesting depth added 7). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaManifestedColdSessionCompaction.compactAndRetire (cognitive 42) · ×1
  • AtriaManifestedColdSessionCompaction.compactAndRetire (cognitive 42) Atria/Atria/AtriaColdSessionMigration.swift:311 — AtriaManifestedColdSessionCompaction.compactAndRetire has cognitive complexity 42 (threshold 15). Drivers by points: if/else 16 (30 pts), boolean chains 6, loops 3 (6 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked (cognitive 42) · ×1
  • AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked (cognitive 42) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:281 — AtriaFullFidelityColdSessionStore.adoptStreamingSourcesLocked has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (30 pts), boolean chains 5, error handling 2 (4 pts), loops 2, ternaries 1 (nesting depth added 13). Of this number, 23 points are the body's own statements and 19 belong to 3 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaPhysiologicalStressModel.evaluate (cognitive 42) · ×1
  • AtriaPhysiologicalStressModel.evaluate (cognitive 42) Atria/Atria/AtriaPhysiologicalStressModel.swift:384 — AtriaPhysiologicalStressModel.evaluate has cognitive complexity 42 (threshold 15). Drivers by points: if/else 17 (21 pts), boolean chains 20, loops 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.makeHistoryDailyRollups (cognitive 42) · ×1
  • SessionStore.makeHistoryDailyRollups (cognitive 42) Atria/Atria/Sessions.swift:21843 — SessionStore.makeHistoryDailyRollups has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 7 (15 pts), ternaries 4, boolean chains 1 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.restoreSessionBackup (cognitive 42) · ×1
  • SessionStore.restoreSessionBackup (cognitive 42) Atria/Atria/Sessions.swift:55587 — SessionStore.restoreSessionBackup has cognitive complexity 42 (threshold 15). Drivers by points: if/else 12 (33 pts), match/switch 2 (5 pts), ternaries 1 (3 pts), loops 1 (nesting depth added 26). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.leftoverFlushLines (cognitive 41) · ×1
  • AtriaBLEManager.leftoverFlushLines (cognitive 41) REDACTED:9071 — AtriaBLEManager.leftoverFlushLines has cognitive complexity 41 (threshold 15). Drivers by points: if/else 27, ternaries 5 (9 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority (cognitive 41) · ×1
  • AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority (cognitive 41) REDACTED:12023 — AtriaBLEManager.applyPersistedInterruptedFullDrainAuthority has cognitive complexity 41 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 8, ternaries 3 (8 pts), error handling 1 (2 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.acceptHeartRate (cognitive 41) · ×1
  • AtriaBLEManager.acceptHeartRate (cognitive 41) REDACTED:31145 — AtriaBLEManager.acceptHeartRate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (26 pts), boolean chains 14, ternaries 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.sendCommand (cognitive 41) · ×1
  • AtriaBLEManager.sendCommand (cognitive 41) REDACTED:33373 — AtriaBLEManager.sendCommand has cognitive complexity 41 (threshold 15). Drivers by points: if/else 20 (30 pts), boolean chains 7, error handling 1 (2 pts), match/switch 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.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateWorkoutMotionLease (cognitive 41) · ×1
  • AtriaBLEManager.evaluateWorkoutMotionLease (cognitive 41) REDACTED:39514 — AtriaBLEManager.evaluateWorkoutMotionLease has cognitive complexity 41 (threshold 15). Drivers by points: if/else 16 (26 pts), boolean chains 8, ternaries 4, match/switch 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.handleUnknownProtocolPayload (cognitive 41) · ×1
  • AtriaBLEManager.handleUnknownProtocolPayload (cognitive 41) REDACTED:43712 — AtriaBLEManager.handleUnknownProtocolPayload has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (24 pts), ternaries 4 (11 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeModel.makeDeferredDetails (cognitive 41) · ×1
  • AtriaHomeModel.makeDeferredDetails (cognitive 41) Atria/Atria/AtriaHomeView.swift:13627 — AtriaHomeModel.makeDeferredDetails has cognitive complexity 41 (threshold 15). Drivers by points: if/else 33, ternaries 4 (7 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible (cognitive 41) · ×1
  • AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible (cognitive 41) Atria/Atria/AtriaOnboardingHistoryBootstrap.swift:112 — AtriaOnboardingHistoryBootstrap.startOrResumeIfPossible has cognitive complexity 41 (threshold 15). Drivers by points: if/else 23 (30 pts), boolean chains 8, ternaries 2 (3 pts) (nesting depth added 8). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaRecoveredMotionAnalytics.sleepProvenance (cognitive 41) · ×1
  • AtriaRecoveredMotionAnalytics.sleepProvenance (cognitive 41) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:214 — AtriaRecoveredMotionAnalytics.sleepProvenance has cognitive complexity 41 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 12, loops 5, ternaries 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepWakeResearch.epochFeatures (cognitive 41) · ×1
  • AtriaSleepWakeResearch.epochFeatures (cognitive 41) Atria/Atria/AtriaSleepWakeResearch.swift:510 — AtriaSleepWakeResearch.epochFeatures has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 3 (5 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStrapSetup.evaluate (cognitive 41) · ×1
  • AtriaStrapSetup.evaluate (cognitive 41) Atria/Atria/AtriaStrapSetup.swift:360 — AtriaStrapSetup.evaluate has cognitive complexity 41 (threshold 15). Drivers by points: if/else 15 (20 pts), ternaries 7 (12 pts), match/switch 4 (5 pts), boolean chains 4 (nesting depth added 11). Of this number, 38 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutRouteStore.reconcile (cognitive 41) · ×1
  • AtriaWorkoutRouteStore.reconcile (cognitive 41) Atria/Atria/AtriaWorkoutRoute.swift:1346 — AtriaWorkoutRouteStore.reconcile has cognitive complexity 41 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 13, error handling 2 (4 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.logGateReadinessFromLaunchIfRequested (cognitive 41) · ×1
  • SessionStore.logGateReadinessFromLaunchIfRequested (cognitive 41) Atria/Atria/Sessions.swift:31142 — SessionStore.logGateReadinessFromLaunchIfRequested has cognitive complexity 41 (threshold 15). Drivers by points: ternaries 26 (27 pts), boolean chains 9, if/else 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.rebasedRecoveredConfirmedSleepsCancellable (cognitive 41) · ×1
  • SessionStore.rebasedRecoveredConfirmedSleepsCancellable (cognitive 41) Atria/Atria/Sessions.swift:44982 — SessionStore.rebasedRecoveredConfirmedSleepsCancellable has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (24 pts), boolean chains 9, loops 6 (7 pts), ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded (cognitive 40) · ×1
  • AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded (cognitive 40) REDACTED:11723 — AtriaBLEManager.scheduleInterruptedFullDrainReacquisitionIfNeeded has cognitive complexity 40 (threshold 15). Drivers by points: if/else 35, boolean chains 3, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.recordHeartRateMeasurement (cognitive 40) · ×1
  • AtriaBLEManager.recordHeartRateMeasurement (cognitive 40) REDACTED:31545 — AtriaBLEManager.recordHeartRateMeasurement has cognitive complexity 40 (threshold 15). Drivers by points: if/else 18 (23 pts), boolean chains 11, ternaries 3 (6 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.notifyDecision (cognitive 40) · ×1
  • AtriaIMUDiagnosticTransport.notifyDecision (cognitive 40) Atria/Atria/AtriaIMUDiagnosticTransport.swift:971 — AtriaIMUDiagnosticTransport.notifyDecision has cognitive complexity 40 (threshold 15). Drivers by points: if/else 17 (29 pts), boolean chains 5, ternaries 2 (4 pts), match/switch 1 (2 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutPromptEvaluator.evaluate (cognitive 40) · ×1
  • AtriaWorkoutPromptEvaluator.evaluate (cognitive 40) Atria/Atria/AtriaWorkoutPromptEvaluator.swift:147 — AtriaWorkoutPromptEvaluator.evaluate has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 18, if/else 12 (17 pts), loops 3 (4 pts), ternaries 1 (nesting depth added 6). Of this number, 36 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · probe.on_notify (cognitive 40) · ×1
  • probe.on_notify (cognitive 40) probe.py:42 — probe.on_notify has cognitive complexity 40 (threshold 15). Drivers by points: if/else 11 (27 pts), ternaries 3 (6 pts), boolean chains 4, loops 1 (3 pts) (nesting depth added 21). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaBLEManager.recoverAcceptedHRWatchdog (cognitive 39) · ×1
  • AtriaBLEManager.recoverAcceptedHRWatchdog (cognitive 39) REDACTED:26490 — AtriaBLEManager.recoverAcceptedHRWatchdog has cognitive complexity 39 (threshold 15). Drivers by points: ternaries 9 (18 pts), if/else 11 (13 pts), boolean chains 8 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded (cognitive 39) · ×1
  • AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded (cognitive 39) REDACTED:34442 — AtriaBLEManager.refreshProtectedBoundedRawCaptureIfNeeded has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 19, if/else 16 (19 pts), ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.sendWorkoutMotionActivationPair (cognitive 39) · ×1
  • AtriaBLEManager.sendWorkoutMotionActivationPair (cognitive 39) REDACTED:39764 — AtriaBLEManager.sendWorkoutMotionActivationPair has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 21, if/else 14 (16 pts), loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalActivityProjection.validatesInternalShape (cognitive 39) · ×1
  • AtriaHistoricalActivityProjection.validatesInternalShape (cognitive 39) Atria/Atria/AtriaHistoricalActivityProjection.swift:693 — AtriaHistoricalActivityProjection.validatesInternalShape has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 35, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeModel.bind (cognitive 39) · ×1
  • AtriaHomeModel.bind (cognitive 39) Atria/Atria/AtriaHomeView.swift:10396 — AtriaHomeModel.bind has cognitive complexity 39 (threshold 15). Drivers by points: if/else 23, boolean chains 16. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaPreparedMetricHistory.init (cognitive 39) · ×1
  • AtriaPreparedMetricHistory.init (cognitive 39) Atria/Atria/AtriaOverviewSections.swift:9109 — AtriaPreparedMetricHistory.init has cognitive complexity 39 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 12, ternaries 2 (4 pts), loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutRuntime.applyPendingActions (cognitive 39) · ×1
  • AtriaWorkoutRuntime.applyPendingActions (cognitive 39) Atria/Atria/AtriaWorkoutRuntime.swift:490 — AtriaWorkoutRuntime.applyPendingActions has cognitive complexity 39 (threshold 15). Drivers by points: if/else 9 (16 pts), loops 5 (13 pts), ternaries 3 (6 pts), boolean chains 4 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.exactMetricHeartRatePoints (cognitive 39) · ×1
  • HistoricalArchive.exactMetricHeartRatePoints (cognitive 39) Atria/Atria/HistoricalArchive.swift:7564 — HistoricalArchive.exactMetricHeartRatePoints has cognitive complexity 39 (threshold 15). Drivers by points: if/else 20 (31 pts), boolean chains 7, loops 1 (nesting depth added 11). Of this number, 32 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.detectedActivity (cognitive 39) · ×1
  • SavedSession.detectedActivity (cognitive 39) Atria/Atria/Sessions.swift:7806 — SavedSession.detectedActivity has cognitive complexity 39 (threshold 15). Drivers by points: boolean chains 18, if/else 9 (14 pts), ternaries 3 (7 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.noteLeftoverFlushNotifyState (cognitive 38) · ×1
  • AtriaBLEManager.noteLeftoverFlushNotifyState (cognitive 38) REDACTED:8952 — AtriaBLEManager.noteLeftoverFlushNotifyState has cognitive complexity 38 (threshold 15). Drivers by points: if/else 22 (32 pts), boolean chains 6 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget (cognitive 38) · ×1
  • AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget (cognitive 38) REDACTED:37410 — AtriaBLEManager.armConnectedRealtimePreservingHistoryBudget has cognitive complexity 38 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 12, ternaries 2 (8 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.applyHistoricalArchivePersistenceResult (cognitive 38) · ×1
  • AtriaBLEManager.applyHistoricalArchivePersistenceResult (cognitive 38) REDACTED:45661 — AtriaBLEManager.applyHistoricalArchivePersistenceResult has cognitive complexity 38 (threshold 15). Drivers by points: if/else 15 (26 pts), ternaries 3 (8 pts), boolean chains 4 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.centralManager (cognitive 38) · ×1
  • AtriaBLEManager.centralManager (cognitive 38) REDACTED:55084 — AtriaBLEManager.centralManager has cognitive complexity 38 (threshold 15). Drivers by points: if/else 20 (27 pts), boolean chains 7, match/switch 2, ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalRetentionTransaction.commit (cognitive 38) · ×1
  • AtriaHistoricalRetentionTransaction.commit (cognitive 38) Atria/Atria/AtriaHistoricalRetentionTransaction.swift:176 — AtriaHistoricalRetentionTransaction.commit has cognitive complexity 38 (threshold 15). Drivers by points: if/else 26 (31 pts), boolean chains 7 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.bestSavedRRReferenceWindow (cognitive 38) · ×1
  • SessionStore.bestSavedRRReferenceWindow (cognitive 38) Atria/Atria/Sessions.swift:32250 — SessionStore.bestSavedRRReferenceWindow has cognitive complexity 38 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 4 (9 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot (cognitive 38) · ×1
  • WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot (cognitive 38) Atria/Atria/WidgetSnapshot.swift:1102 — WidgetSnapshotPublisher.liveWorkoutPatchedSnapshot has cognitive complexity 38 (threshold 15). Drivers by points: ternaries 31, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaApp.handleBackgroundTask (cognitive 37) · ×1
  • AtriaApp.handleBackgroundTask (cognitive 37) Atria/Atria/AtriaApp.swift:798 — AtriaApp.handleBackgroundTask has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp (cognitive 37) · ×1
  • AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp (cognitive 37) REDACTED:24356 — AtriaBLEManager.scheduleOfficialGen4CompactOnStream5LinkUp has cognitive complexity 37 (threshold 15). Drivers by points: if/else 17 (28 pts), boolean chains 7, loops 1 (2 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid (cognitive 37) · ×1
  • AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid (cognitive 37) REDACTED:37212 — AtriaBLEManager.connectedRawHistoryCatchUpRequestAuthorityIsValid has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (19 pts), boolean chains 17, match/switch 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload (cognitive 37) · ×1
  • AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload (cognitive 37) REDACTED:38805 — AtriaBLEManager.evaluatePendingWorkoutHistoricalMotionBankOffload has cognitive complexity 37 (threshold 15). Drivers by points: if/else 16 (21 pts), ternaries 6 (9 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaDaytimeQuiescentSleepDetector.detect (cognitive 37) · ×1
  • AtriaDaytimeQuiescentSleepDetector.detect (cognitive 37) Atria/Atria/AtriaDaytimeQuiescentSleepDetector.swift:135 — AtriaDaytimeQuiescentSleepDetector.detect has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (26 pts), boolean chains 9, loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSyncProgressFooterPresentation.footer (cognitive 37) · ×1
  • AtriaSyncProgressFooterPresentation.footer (cognitive 37) Atria/Atria/AtriaHomeView.swift:7283 — AtriaSyncProgressFooterPresentation.footer has cognitive complexity 37 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 15, ternaries 4 (5 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaShareSheet.canvasButtonLabel (cognitive 37) · ×1
  • AtriaShareSheet.canvasButtonLabel (cognitive 37) Atria/Atria/AtriaShareCard.swift:1847 — AtriaShareSheet.canvasButtonLabel has cognitive complexity 37 (threshold 15). Drivers by points: ternaries 16 (30 pts), if/else 5 (7 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.classifyGapMinutes (cognitive 37) · ×1
  • AtriaHistoricalStressReplay.classifyGapMinutes (cognitive 37) Atria/Atria/AtriaStressMonitor.swift:1957 — AtriaHistoricalStressReplay.classifyGapMinutes has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (24 pts), loops 5 (8 pts), boolean chains 5 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaScanRecordParser.storeValue (cognitive 37) · ×1
  • AtriaScanRecordParser.storeValue (cognitive 37) Atria/Atria/HistoricalArchive.swift:11002 — AtriaScanRecordParser.storeValue has cognitive complexity 37 (threshold 15). Drivers by points: if/else 34 (35 pts), boolean chains 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.makeIncrementalRecoveredHistorySnapshots (cognitive 37) · ×1
  • SessionStore.makeIncrementalRecoveredHistorySnapshots (cognitive 37) Atria/Atria/Sessions.swift:21143 — SessionStore.makeIncrementalRecoveredHistorySnapshots has cognitive complexity 37 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 6, loops 5, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.archiveOnlyHeartRateSegments (cognitive 37) · ×1
  • SessionStore.archiveOnlyHeartRateSegments (cognitive 37) Atria/Atria/Sessions.swift:27526 — SessionStore.archiveOnlyHeartRateSegments has cognitive complexity 37 (threshold 15). Drivers by points: if/else 11 (23 pts), loops 6 (8 pts), boolean chains 6 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.rebasedConfirmedSleepsCancellable (cognitive 37) · ×1
  • SessionStore.rebasedConfirmedSleepsCancellable (cognitive 37) Atria/Atria/Sessions.swift:44908 — SessionStore.rebasedConfirmedSleepsCancellable has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 8, loops 6, ternaries 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ActiveSessionJournal.saveIncremental (cognitive 36) · ×1
  • ActiveSessionJournal.saveIncremental (cognitive 36) Atria/Atria/ActiveSessionJournal.swift:441 — ActiveSessionJournal.saveIncremental has cognitive complexity 36 (threshold 15). Drivers by points: if/else 16 (23 pts), boolean chains 13 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady (cognitive 36) · ×1
  • AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady (cognitive 36) REDACTED:15640 — AtriaBLEManager.sendProtectedR10ResponseEventDataSequenceIfReady has cognitive complexity 36 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 13 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.median (cognitive 36) · ×1
  • AtriaBLEManager.median (cognitive 36) REDACTED:31761 — AtriaBLEManager.median has cognitive complexity 36 (threshold 15). Drivers by points: if/else 18 (35 pts), match/switch 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaColdSessionFact.validate (cognitive 36) · ×1
  • AtriaColdSessionFact.validate (cognitive 36) Atria/Atria/AtriaColdSessionFacts.swift:316 — AtriaColdSessionFact.validate has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 26, if/else 8 (10 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalWorkoutProjection.detectCandidates (cognitive 36) · ×1
  • AtriaHistoricalWorkoutProjection.detectCandidates (cognitive 36) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:952 — AtriaHistoricalWorkoutProjection.detectCandidates has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (14 pts), loops 4 (6 pts), ternaries 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.diagnostics (cognitive 36) · ×1
  • HistoricalArchive.diagnostics (cognitive 36) Atria/Atria/HistoricalArchive.swift:3123 — HistoricalArchive.diagnostics has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (28 pts), ternaries 2 (4 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.loadPointsCancellable (cognitive 36) · ×1
  • SavedSession.loadPointsCancellable (cognitive 36) Atria/Atria/Sessions.swift:2628 — SavedSession.loadPointsCancellable has cognitive complexity 36 (threshold 15). Drivers by points: if/else 17 (23 pts), boolean chains 9, loops 3, ternaries 1 (nesting depth added 6). Of this number, 23 points are the body's own statements and 13 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.scheduleConfirmedWorkoutStepEvidencePublication (cognitive 36) · ×1
  • SessionStore.scheduleConfirmedWorkoutStepEvidencePublication (cognitive 36) Atria/Atria/Sessions.swift:20190 — SessionStore.scheduleConfirmedWorkoutStepEvidencePublication has cognitive complexity 36 (threshold 15). Drivers by points: if/else 14 (22 pts), boolean chains 5, ternaries 3 (5 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.reducedConfidenceUnconfirmedRecoveryInput (cognitive 36) · ×1
  • SessionStore.reducedConfidenceUnconfirmedRecoveryInput (cognitive 36) Atria/Atria/Sessions.swift:24261 — SessionStore.reducedConfidenceUnconfirmedRecoveryInput has cognitive complexity 36 (threshold 15). Drivers by points: if/else 15 (21 pts), boolean chains 10, loops 3, ternaries 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.confirmedSleepWindowMetricsCore (cognitive 36) · ×1
  • SessionStore.confirmedSleepWindowMetricsCore (cognitive 36) Atria/Atria/Sessions.swift:43185 — SessionStore.confirmedSleepWindowMetricsCore has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 5 (6 pts), ternaries 4 (6 pts), boolean chains 5 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.confirmedSleepRespiratoryRateCore (cognitive 36) · ×1
  • SessionStore.confirmedSleepRespiratoryRateCore (cognitive 36) Atria/Atria/Sessions.swift:43488 — SessionStore.confirmedSleepRespiratoryRateCore has cognitive complexity 36 (threshold 15). Drivers by points: if/else 22 (50 pts), loops 7 (14 pts), boolean chains 8, ternaries 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. This shape REPEATS in the file: one other method here (SessionStore.confirmedSleepRespiratoryRateCore::finishRun::checkedEstimate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionStore.settleConfirmedMorningAuthority (cognitive 36) · ×1
  • SessionStore.settleConfirmedMorningAuthority (cognitive 36) Atria/Atria/Sessions.swift:57826 — SessionStore.settleConfirmedMorningAuthority has cognitive complexity 36 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 12, ternaries 6 (8 pts) (nesting depth added 5). Of this number, 25 points are the body's own statements and 11 belong to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps (cognitive 35) · ×1
  • AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps (cognitive 35) REDACTED:47774 — AtriaBLEManager.reconcileAdditionalTerminalFullDrainGaps has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (25 pts), boolean chains 7, ternaries 1 (2 pts), loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized (cognitive 35) · ×1
  • AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized (cognitive 35) REDACTED:49004 — AtriaBLEManager.scheduleTerminalConsumerMaterializationIfAuthorized has cognitive complexity 35 (threshold 15). Drivers by points: if/else 15 (23 pts), boolean chains 10, error handling 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.completeHistoricalACKAcceptance (cognitive 35) · ×1
  • AtriaBLEManager.completeHistoricalACKAcceptance (cognitive 35) REDACTED:49388 — AtriaBLEManager.completeHistoricalACKAcceptance has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 12, error handling 1 (2 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority (cognitive 35) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority (cognitive 35) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:70 — AtriaHistoricalFullDrainCoveragePolicy.validateTransportAuthority has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 28, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalJSONLInput.decodeRawDeflate (cognitive 35) · ×1
  • AtriaHistoricalJSONLInput.decodeRawDeflate (cognitive 35) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:561 — AtriaHistoricalJSONLInput.decodeRawDeflate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (26 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalVerifiedConsumerReader.readSource (cognitive 35) · ×1
  • AtriaHistoricalVerifiedConsumerReader.readSource (cognitive 35) Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:136 — AtriaHistoricalVerifiedConsumerReader.readSource has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (15 pts), error handling 8 (9 pts), boolean chains 6, ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaIrregularRhythmAssessment.evaluate (cognitive 35) · ×1
  • AtriaIrregularRhythmAssessment.evaluate (cognitive 35) Atria/Atria/AtriaIrregularRhythm.swift:121 — AtriaIrregularRhythmAssessment.evaluate has cognitive complexity 35 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 5, loops 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately (cognitive 35) · ×1
  • AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately (cognitive 35) Atria/Atria/AtriaLiveActivityCoordinator.swift:905 — AtriaLiveActivityCoordinator.shouldSendActivityUpdateImmediately has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 30, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaLiveWorkoutView.workoutActionsCard (cognitive 35) · ×1
  • AtriaLiveWorkoutView.workoutActionsCard (cognitive 35) Atria/Atria/AtriaLiveWorkoutView.swift:2845 — AtriaLiveWorkoutView.workoutActionsCard has cognitive complexity 35 (threshold 15). Drivers by points: ternaries 11 (15 pts), if/else 9 (13 pts), boolean chains 7 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts (cognitive 35) · ×1
  • AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts (cognitive 35) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1436 — AtriaWhoop4GravityCadenceStepModel.autonomousGaitBouts has cognitive complexity 35 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 12, loops 8 (10 pts) (nesting depth added 7). Of this number, 25 points are the body's own statements and 10 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaShortWindowRMSSD.value (cognitive 35) · ×1
  • AtriaShortWindowRMSSD.value (cognitive 35) Atria/Atria/HRV.swift:325 — AtriaShortWindowRMSSD.value has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 7, ternaries 2 (4 pts), loops 2 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.motionTickWindowRead (cognitive 35) · ×1
  • HistoricalArchive.motionTickWindowRead (cognitive 35) Atria/Atria/HistoricalArchive.swift:3488 — HistoricalArchive.motionTickWindowRead has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 23, if/else 9, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.readVerifiedCanonicalConsumerSourcePage (cognitive 35) · ×1
  • HistoricalArchive.readVerifiedCanonicalConsumerSourcePage (cognitive 35) Atria/Atria/HistoricalArchive.swift:6122 — HistoricalArchive.readVerifiedCanonicalConsumerSourcePage has cognitive complexity 35 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 11, loops 2 (7 pts), error handling 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AutomaticRecoveredDataBootstrapCheckpoint.init (cognitive 35) · ×1
  • AutomaticRecoveredDataBootstrapCheckpoint.init (cognitive 35) Atria/Atria/HistoricalArchive.swift:670 — AutomaticRecoveredDataBootstrapCheckpoint.init has cognitive complexity 35 (threshold 15). Drivers by points: if/else 19 (31 pts), loops 4 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaScanRecordParser.parseRecord (cognitive 35) · ×1
  • AtriaScanRecordParser.parseRecord (cognitive 35) Atria/Atria/HistoricalArchive.swift:10937 — AtriaScanRecordParser.parseRecord has cognitive complexity 35 (threshold 15). Drivers by points: boolean chains 20, if/else 9 (14 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.mergeDailyMetricHistory (cognitive 35) · ×1
  • SessionStore.mergeDailyMetricHistory (cognitive 35) Atria/Atria/Sessions.swift:23591 — SessionStore.mergeDailyMetricHistory has cognitive complexity 35 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 14, ternaries 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaCoachPayload.serializedNumbers (cognitive 34) · ×1
  • AtriaCoachPayload.serializedNumbers (cognitive 34) Atria/Atria/AtriaAICoach.swift:229 — AtriaCoachPayload.serializedNumbers has cognitive complexity 34 (threshold 15). Drivers by points: if/else 17 (32 pts), boolean chains 1, loops 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.sendProtectedR10ActivationNowIfReady (cognitive 34) · ×1
  • AtriaBLEManager.sendProtectedR10ActivationNowIfReady (cognitive 34) REDACTED:15948 — AtriaBLEManager.sendProtectedR10ActivationNowIfReady has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 19, if/else 13 (15 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.logClockCommandResponse (cognitive 34) · ×1
  • AtriaBLEManager.logClockCommandResponse (cognitive 34) REDACTED:32138 — AtriaBLEManager.logClockCommandResponse has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 11, ternaries 5 (10 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.recordMetricUsableRows (cognitive 34) · ×1
  • AtriaHistoricalGapLedger.recordMetricUsableRows (cognitive 34) Atria/Atria/AtriaHistoricalGapLedger.swift:579 — AtriaHistoricalGapLedger.recordMetricUsableRows has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeView.endWorkoutSession (cognitive 34) · ×1
  • AtriaHomeView.endWorkoutSession (cognitive 34) Atria/Atria/AtriaHomeView.swift:4210 — AtriaHomeView.endWorkoutSession has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (28 pts), ternaries 5, boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeModel.makeHeroSnapshot (cognitive 34) · ×1
  • AtriaHomeModel.makeHeroSnapshot (cognitive 34) Atria/Atria/AtriaHomeView.swift:12877 — AtriaHomeModel.makeHeroSnapshot has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 17, ternaries 11, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaRecoveredHeartRateProjection.projectCancellable (cognitive 34) · ×1
  • AtriaRecoveredHeartRateProjection.projectCancellable (cognitive 34) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:264 — AtriaRecoveredHeartRateProjection.projectCancellable has cognitive complexity 34 (threshold 15). Drivers by points: if/else 14 (21 pts), boolean chains 8, loops 5 (nesting depth added 7). Of this number, 26 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveredRRProjection.verify (cognitive 34) · ×1
  • AtriaRecoveredRRProjection.verify (cognitive 34) Atria/Atria/AtriaRecoveredRRProjection.swift:436 — AtriaRecoveredRRProjection.verify has cognitive complexity 34 (threshold 15). Drivers by points: boolean chains 21, if/else 13. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaScanRecordParser.skipValue (cognitive 34) · ×1
  • AtriaScanRecordParser.skipValue (cognitive 34) Atria/Atria/HistoricalArchive.swift:11352 — AtriaScanRecordParser.skipValue has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (26 pts), loops 2 (4 pts), boolean chains 3, match/switch 1 (nesting depth added 18). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SavedSession.qualifiedLnRMSSDCore (cognitive 34) · ×1
  • SavedSession.qualifiedLnRMSSDCore (cognitive 34) Atria/Atria/Sessions.swift:1978 — SavedSession.qualifiedLnRMSSDCore has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (21 pts), boolean chains 6, ternaries 2 (4 pts), loops 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.scheduleSleepReviewCacheRefresh (cognitive 34) · ×1
  • SessionStore.scheduleSleepReviewCacheRefresh (cognitive 34) Atria/Atria/Sessions.swift:36749 — SessionStore.scheduleSleepReviewCacheRefresh has cognitive complexity 34 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 10, ternaries 3 (4 pts), match/switch 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.sustainedWakeOnsetCore (cognitive 34) · ×1
  • SessionStore.sustainedWakeOnsetCore (cognitive 34) Atria/Atria/Sessions.swift:41289 — SessionStore.sustainedWakeOnsetCore has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (22 pts), loops 8 (9 pts), boolean chains 3 (nesting depth added 11). Of this number, 28 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.commitPreparedWakeBoundarySleepIfUseful (cognitive 34) · ×1
  • SessionStore.commitPreparedWakeBoundarySleepIfUseful (cognitive 34) Atria/Atria/Sessions.swift:41734 — SessionStore.commitPreparedWakeBoundarySleepIfUseful has cognitive complexity 34 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 5, ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.rebuildBaselineCancellable (cognitive 34) · ×1
  • SessionStore.rebuildBaselineCancellable (cognitive 34) Atria/Atria/Sessions.swift:58511 — SessionStore.rebuildBaselineCancellable has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (24 pts), boolean chains 4, loops 2 (3 pts), ternaries 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleRangeLossBackfillIfNeeded (cognitive 33) · ×1
  • AtriaBLEManager.scheduleRangeLossBackfillIfNeeded (cognitive 33) REDACTED:21112 — AtriaBLEManager.scheduleRangeLossBackfillIfNeeded has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 12, if/else 11, ternaries 10. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.performHRContinuityWatchdogAction (cognitive 33) · ×1
  • AtriaBLEManager.performHRContinuityWatchdogAction (cognitive 33) REDACTED:25889 — AtriaBLEManager.performHRContinuityWatchdogAction has cognitive complexity 33 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 7, ternaries 5 (7 pts), match/switch 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBackupCompression.transform (cognitive 33) · ×1
  • AtriaBackupCompression.transform (cognitive 33) Atria/Atria/AtriaBackupCompression.swift:63 — AtriaBackupCompression.transform has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, ternaries 2 (7 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.writeDecision (cognitive 33) · ×1
  • AtriaIMUDiagnosticTransport.writeDecision (cognitive 33) Atria/Atria/AtriaIMUDiagnosticTransport.swift:716 — AtriaIMUDiagnosticTransport.writeDecision has cognitive complexity 33 (threshold 15). Drivers by points: if/else 18 (27 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaJournalInsights.insightsCancellable (cognitive 33) · ×1
  • AtriaJournalInsights.insightsCancellable (cognitive 33) Atria/Atria/AtriaJournalInsights.swift:164 — AtriaJournalInsights.insightsCancellable has cognitive complexity 33 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 6, loops 3 (4 pts), 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.
D2 · Cognitive Complexity · AtriaNightMinuteBuilder.build (cognitive 33) · ×1
  • AtriaNightMinuteBuilder.build (cognitive 33) Atria/Atria/AtriaNightMinuteBuilder.swift:83 — AtriaNightMinuteBuilder.build has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 4 (7 pts), boolean chains 6, loops 5 (nesting depth added 10). Of this number, 32 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSettingsView.dataSection (cognitive 33) · ×1
  • AtriaSettingsView.dataSection (cognitive 33) Atria/Atria/AtriaSettingsView.swift:1121 — AtriaSettingsView.dataSection has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 10 (22 pts), if/else 6 (8 pts), boolean chains 3 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.qualifiedActivityContexts (cognitive 33) · ×1
  • AtriaHistoricalStressReplay.qualifiedActivityContexts (cognitive 33) Atria/Atria/AtriaStressMonitor.swift:2382 — AtriaHistoricalStressReplay.qualifiedActivityContexts has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 14, loops 2 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4DailyMotionBankRearmPolicy.evaluate (cognitive 33) · ×1
  • AtriaWhoop4DailyMotionBankRearmPolicy.evaluate (cognitive 33) Atria/Atria/AtriaWhoop4DailyMotionBankRearmPolicy.swift:143 — AtriaWhoop4DailyMotionBankRearmPolicy.evaluate has cognitive complexity 33 (threshold 15). Drivers by points: if/else 31 (32 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaWhoop4HistoryArchivePipeline.prepare (cognitive 33) · ×1
  • AtriaWhoop4HistoryArchivePipeline.prepare (cognitive 33) Atria/Atria/AtriaWhoop4HistoryArchivePipeline.swift:43 — AtriaWhoop4HistoryArchivePipeline.prepare has cognitive complexity 33 (threshold 15). Drivers by points: ternaries 10 (13 pts), boolean chains 10, if/else 10 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash (cognitive 33) · ×1
  • HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash (cognitive 33) Atria/Atria/HistoricalArchive.swift:2306 — HistoricalArchive.resumeTerminalConsumerProjectionsAfterCrash has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 26, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.automaticRecoveredDataBootstrapSourceImage (cognitive 33) · ×1
  • HistoricalArchive.automaticRecoveredDataBootstrapSourceImage (cognitive 33) Atria/Atria/HistoricalArchive.swift:4594 — HistoricalArchive.automaticRecoveredDataBootstrapSourceImage has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 19, if/else 6 (11 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SavedSession.detectedSleepOrRestActivityCancellable (cognitive 33) · ×1
  • SavedSession.detectedSleepOrRestActivityCancellable (cognitive 33) Atria/Atria/Sessions.swift:7894 — SavedSession.detectedSleepOrRestActivityCancellable has cognitive complexity 33 (threshold 15). Drivers by points: boolean chains 18, if/else 6 (8 pts), ternaries 3 (7 pts) (nesting depth added 6). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.updateStrapStreamState (cognitive 32) · ×1
  • AtriaBLEManager.updateStrapStreamState (cognitive 32) REDACTED:3255 — AtriaBLEManager.updateStrapStreamState has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 21, if/else 8, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded (cognitive 32) · ×1
  • AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded (cognitive 32) REDACTED:29136 — AtriaBLEManager.beginPostReconnectStreamLeaseIfNeeded has cognitive complexity 32 (threshold 15). Drivers by points: if/else 10 (21 pts), ternaries 3 (6 pts), boolean chains 4, loops 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.startOneShotHistoryTrimIfNeeded (cognitive 32) · ×1
  • AtriaBLEManager.startOneShotHistoryTrimIfNeeded (cognitive 32) REDACTED:41546 — AtriaBLEManager.startOneShotHistoryTrimIfNeeded has cognitive complexity 32 (threshold 15). Drivers by points: boolean chains 17, if/else 10 (12 pts), error handling 1, loops 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts (cognitive 32) · ×1
  • AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts (cognitive 32) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:257 — AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceipts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (13 pts), error handling 3 (8 pts), loops 3 (7 pts), boolean chains 3, match/switch 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeView.updateWorkoutDetectionPrompt (cognitive 32) · ×1
  • AtriaHomeView.updateWorkoutDetectionPrompt (cognitive 32) Atria/Atria/AtriaHomeView.swift:3949 — AtriaHomeView.updateWorkoutDetectionPrompt has cognitive complexity 32 (threshold 15). Drivers by points: if/else 19 (22 pts), boolean chains 10 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Tracker.observe (cognitive 32) · ×1
  • Tracker.observe (cognitive 32) Atria/Atria/AtriaStrapSetup.swift:152 — Tracker.observe has cognitive complexity 32 (threshold 15). Drivers by points: if/else 13 (21 pts), boolean chains 7, match/switch 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HealthKitExporter.plannedCounts (cognitive 32) · ×1
  • HealthKitExporter.plannedCounts (cognitive 32) Atria/Atria/HealthKitExporter.swift:896 — HealthKitExporter.plannedCounts has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 13, loops 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence (cognitive 32) · ×1
  • HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence (cognitive 32) Atria/Atria/HistoricalArchive.swift:5198 — HistoricalArchive.canonicalizeAutomaticRecoveredDataBootstrapEvidence has cognitive complexity 32 (threshold 15). Drivers by points: if/else 18 (24 pts), boolean chains 5, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.boundedSleepReviewAuthorities (cognitive 32) · ×1
  • SessionStore.boundedSleepReviewAuthorities (cognitive 32) Atria/Atria/Sessions.swift:37118 — SessionStore.boundedSleepReviewAuthorities has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 5, loops 5 (nesting depth added 10). Of this number, 31 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance (cognitive 32) · ×1
  • SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance (cognitive 32) Atria/Atria/Sessions.swift:46965 — SessionStore.rebuildConfirmedSleepRecoveredMotionProvenance has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 9, ternaries 2 (4 pts), loops 1 (2 pts), error handling 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoryView.body (cognitive 32) · ×1
  • HistoryView.body (cognitive 32) Atria/Atria/Sessions.swift:58755 — HistoryView.body has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (21 pts), ternaries 2 (6 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaActivityWorkoutDetailSheet.body (cognitive 31) · ×1
  • AtriaActivityWorkoutDetailSheet.body (cognitive 31) Atria/Atria/AtriaActivityMonitor.swift:4025 — AtriaActivityWorkoutDetailSheet.body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 22 (24 pts), boolean chains 4, ternaries 3 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaApp.body (cognitive 31) · ×1
  • AtriaApp.body (cognitive 31) Atria/Atria/AtriaApp.swift:465 — AtriaApp.body has cognitive complexity 31 (threshold 15). Drivers by points: if/else 18 (23 pts), match/switch 4, ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBehaviorImpactPresentation.model (cognitive 31) · ×1
  • AtriaBehaviorImpactPresentation.model (cognitive 31) Atria/Atria/AtriaBehaviorImpactPresentation.swift:282 — AtriaBehaviorImpactPresentation.model has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (14 pts), loops 5 (6 pts), ternaries 3 (6 pts), boolean chains 5 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveCatalogStore.recordCompressedStorage (cognitive 31) · ×1
  • AtriaHistoricalArchiveCatalogStore.recordCompressedStorage (cognitive 31) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:413 — AtriaHistoricalArchiveCatalogStore.recordCompressedStorage has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 21, if/else 8 (9 pts), error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoveragePolicy.validate (cognitive 31) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.validate (cognitive 31) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:401 — AtriaHistoricalFullDrainCoveragePolicy.validate has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 25, if/else 4, loops 1, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalLongTermRollup.validate (cognitive 31) · ×1
  • AtriaHistoricalLongTermRollup.validate (cognitive 31) Atria/Atria/AtriaHistoricalLongTermRollup.swift:277 — AtriaHistoricalLongTermRollup.validate has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 22, if/else 7 (9 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaStepsWeekChart.body (cognitive 31) · ×1
  • AtriaStepsWeekChart.body (cognitive 31) Atria/Atria/AtriaStepsWeekChart.swift:247 — AtriaStepsWeekChart.body has cognitive complexity 31 (threshold 15). Drivers by points: ternaries 7 (20 pts), if/else 4 (6 pts), boolean chains 5 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStrapStepLedger.reconciledCheckpoint (cognitive 31) · ×1
  • AtriaStrapStepLedger.reconciledCheckpoint (cognitive 31) Atria/Atria/AtriaStrapStepLedger.swift:411 — AtriaStrapStepLedger.reconciledCheckpoint has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 15 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressMonitorStore.replayMayReplace (cognitive 31) · ×1
  • AtriaStressMonitorStore.replayMayReplace (cognitive 31) Atria/Atria/AtriaStressMonitor.swift:3484 — AtriaStressMonitorStore.replayMayReplace has cognitive complexity 31 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 12 (nesting depth added 11). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity (cognitive 31) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity (cognitive 31) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1655 — AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivity has cognitive complexity 31 (threshold 15). Drivers by points: if/else 14 (24 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash (cognitive 31) · ×1
  • HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash (cognitive 31) Atria/Atria/HistoricalArchive.swift:2437 — HistoricalArchive.resumeFullDrainConsumerProjectionsAfterCrash has cognitive complexity 31 (threshold 15). Drivers by points: boolean chains 24, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.makeHistorySnapshotsCancellable (cognitive 31) · ×1
  • SessionStore.makeHistorySnapshotsCancellable (cognitive 31) Atria/Atria/Sessions.swift:20953 — SessionStore.makeHistorySnapshotsCancellable has cognitive complexity 31 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 9, ternaries 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.recoveredDailyPreparationSessions (cognitive 31) · ×1
  • SessionStore.recoveredDailyPreparationSessions (cognitive 31) Atria/Atria/Sessions.swift:21261 — SessionStore.recoveredDailyPreparationSessions has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable (cognitive 31) · ×1
  • SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable (cognitive 31) Atria/Atria/Sessions.swift:22956 — SessionStore.finalizedSkinTemperatureDeviationByMorningDayCancellable has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (21 pts), loops 4 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.motionQuiescenceRefinedBounds · ×1
  • SessionStore.motionQuiescenceRefinedBounds::boundaryEvents (cognitive 31) Atria/Atria/Sessions.swift:49799 — SessionStore.motionQuiescenceRefinedBounds::boundaryEvents has cognitive complexity 31 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 3, boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SessionStore.motionQuiescenceRefinedBounds) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · Strain.contiguousSegments (cognitive 30) · ×1
  • Strain.contiguousSegments (cognitive 30) Atria/Atria/AtriaAnalytics.swift:1139 — Strain.contiguousSegments has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 5, loops 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 8). Of this number, 29 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.requestStrapStatusRead (cognitive 30) · ×1
  • AtriaBLEManager.requestStrapStatusRead (cognitive 30) REDACTED:10451 — AtriaBLEManager.requestStrapStatusRead has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 8, match/switch 2 (5 pts), ternaries 1 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.finishRecording (cognitive 30) · ×1
  • AtriaBLEManager.finishRecording (cognitive 30) REDACTED:30536 — AtriaBLEManager.finishRecording has cognitive complexity 30 (threshold 15). Drivers by points: ternaries 11 (22 pts), if/else 6 (7 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleHistorySequenceConfirmationRetry (cognitive 30) · ×1
  • AtriaBLEManager.scheduleHistorySequenceConfirmationRetry (cognitive 30) REDACTED:46370 — AtriaBLEManager.scheduleHistorySequenceConfirmationRetry has cognitive complexity 30 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 12, ternaries 2 (4 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaDailyStepPresentation.detailText (cognitive 30) · ×1
  • AtriaDailyStepPresentation.detailText (cognitive 30) Atria/Atria/AtriaDailyStepPresentation.swift:342 — AtriaDailyStepPresentation.detailText has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (17 pts), ternaries 3 (7 pts), boolean chains 3, match/switch 2 (3 pts) (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest (cognitive 30) · ×1
  • AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest (cognitive 30) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1563 — AtriaHistoricalArchiveDurableStore.decodedIndexEntriesAndDigest has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 5, loops 2 (5 pts), ternaries 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoveragePolicy.evaluate (cognitive 30) · ×1
  • AtriaHistoricalFullDrainCoveragePolicy.evaluate (cognitive 30) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:299 — AtriaHistoricalFullDrainCoveragePolicy.evaluate has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (13 pts), loops 2, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory (cognitive 30) · ×1
  • AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory (cognitive 30) Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:145 — AtriaHistoricalGeneratedArtifactGC.planReceiptDirectory has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 9, loops 5 (6 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepMotionQuiescence.quiescentWindows (cognitive 30) · ×1
  • AtriaSleepMotionQuiescence.quiescentWindows (cognitive 30) Atria/Atria/AtriaSleepMotionQuiescence.swift:132 — AtriaSleepMotionQuiescence.quiescentWindows has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (21 pts), loops 7 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressMonitorStore.mergeHistoricalMinuteFacts (cognitive 30) · ×1
  • AtriaStressMonitorStore.mergeHistoricalMinuteFacts (cognitive 30) Atria/Atria/AtriaStressMonitor.swift:4030 — AtriaStressMonitorStore.mergeHistoricalMinuteFacts has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 19, if/else 8 (9 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify (cognitive 30) · ×1
  • AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify (cognitive 30) Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:41 — AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.verify has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 16, if/else 12 (13 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaDailyStrainTargetStore.resolve (cognitive 30) · ×1
  • AtriaDailyStrainTargetStore.resolve (cognitive 30) Atria/Atria/Dashboard.swift:129 — AtriaDailyStrainTargetStore.resolve has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (22 pts), boolean chains 6, match/switch 1, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.gravitySample (cognitive 30) · ×1
  • HistoricalArchive.gravitySample (cognitive 30) Atria/Atria/HistoricalArchive.swift:9273 — HistoricalArchive.gravitySample has cognitive complexity 30 (threshold 15). Drivers by points: boolean chains 21, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SavedSession.sleepRespiratoryRateCancellable (cognitive 30) · ×1
  • SavedSession.sleepRespiratoryRateCancellable (cognitive 30) Atria/Atria/Sessions.swift:2145 — SavedSession.sleepRespiratoryRateCancellable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 9, loops 2, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SavedSession.dailyLoadTRIMPCancellable (cognitive 30) · ×1
  • SavedSession.dailyLoadTRIMPCancellable (cognitive 30) Atria/Atria/Sessions.swift:2481 — SavedSession.dailyLoadTRIMPCancellable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (16 pts), boolean chains 8, loops 4 (5 pts), ternaries 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeDailyRollupStoreEntriesCancellable (cognitive 30) · ×1
  • SessionStore.makeDailyRollupStoreEntriesCancellable (cognitive 30) Atria/Atria/Sessions.swift:24073 — SessionStore.makeDailyRollupStoreEntriesCancellable has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 10, ternaries 2 (3 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.sleepStageResearchSampleCount (cognitive 30) · ×1
  • SessionStore.sleepStageResearchSampleCount (cognitive 30) Atria/Atria/Sessions.swift:44008 — SessionStore.sleepStageResearchSampleCount has cognitive complexity 30 (threshold 15). Drivers by points: if/else 8 (19 pts), boolean chains 7, loops 3 (4 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.cooperativeRecoveredMotionSleepProvenance (cognitive 30) · ×1
  • SessionStore.cooperativeRecoveredMotionSleepProvenance (cognitive 30) Atria/Atria/Sessions.swift:51405 — SessionStore.cooperativeRecoveredMotionSleepProvenance has cognitive complexity 30 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, loops 3, ternaries 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Strain.maxHeartRateZoneSeconds (cognitive 29) · ×1
  • Strain.maxHeartRateZoneSeconds (cognitive 29) Atria/Atria/AtriaAnalytics.swift:975 — Strain.maxHeartRateZoneSeconds has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 8 (15 pts), if/else 4 (7 pts), boolean chains 6, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalActivityProjection.validatedInspectionEvidence (cognitive 29) · ×1
  • AtriaHistoricalActivityProjection.validatedInspectionEvidence (cognitive 29) Atria/Atria/AtriaHistoricalActivityProjection.swift:417 — AtriaHistoricalActivityProjection.validatedInspectionEvidence has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 12, error handling 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalGeneratedArtifactGC.prune (cognitive 29) · ×1
  • AtriaHistoricalGeneratedArtifactGC.prune (cognitive 29) Atria/Atria/AtriaHistoricalGeneratedArtifactGC.swift:40 — AtriaHistoricalGeneratedArtifactGC.prune has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), loops 4 (6 pts), boolean chains 2, ternaries 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalLongTermStore.verifiedRetirementCandidates (cognitive 29) · ×1
  • AtriaHistoricalLongTermStore.verifiedRetirementCandidates (cognitive 29) Atria/Atria/AtriaHistoricalLongTermRollup.swift:864 — AtriaHistoricalLongTermStore.verifiedRetirementCandidates has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 17, if/else 4 (7 pts), loops 3 (4 pts), ternaries 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalSleepProjection.detectCandidates (cognitive 29) · ×1
  • AtriaHistoricalSleepProjection.detectCandidates (cognitive 29) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:548 — AtriaHistoricalSleepProjection.detectCandidates has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (11 pts), loops 2, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.updateLiveActivity (cognitive 29) · ×1
  • AtriaHomeView.updateLiveActivity (cognitive 29) Atria/Atria/AtriaHomeView.swift:3533 — AtriaHomeView.updateLiveActivity has cognitive complexity 29 (threshold 15). Drivers by points: ternaries 11, boolean chains 9, if/else 8 (9 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaLiveActivityCoordinator.update (cognitive 29) · ×1
  • AtriaLiveActivityCoordinator.update (cognitive 29) Atria/Atria/AtriaLiveActivityCoordinator.swift:295 — AtriaLiveActivityCoordinator.update has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (25 pts), boolean chains 3, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.fillingHeartRateHoles (cognitive 29) · ×1
  • AtriaHistoricalStressReplay.fillingHeartRateHoles (cognitive 29) Atria/Atria/AtriaStressMonitor.swift:1813 — AtriaHistoricalStressReplay.fillingHeartRateHoles has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 8, loops 3, ternaries 2 (nesting depth added 4). Of this number, 16 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · LocalNotificationScheduler.schedule (cognitive 29) · ×1
  • LocalNotificationScheduler.schedule (cognitive 29) Atria/Atria/LocalNotificationScheduler.swift:1167 — LocalNotificationScheduler.schedule has cognitive complexity 29 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 7, boolean chains 3, error handling 1 (2 pts), loops 2 (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaSleepStageIntegrity.validatesCancellable (cognitive 29) · ×1
  • AtriaSleepStageIntegrity.validatesCancellable (cognitive 29) Atria/Atria/Sessions.swift:4203 — AtriaSleepStageIntegrity.validatesCancellable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 12, loops 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.deriveInsightsCancellable (cognitive 29) · ×1
  • SessionStore.deriveInsightsCancellable (cognitive 29) Atria/Atria/Sessions.swift:25028 — SessionStore.deriveInsightsCancellable has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 5, match/switch 2 (3 pts), loops 2 (nesting depth added 8). Of this number, 28 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.sleepStageQualifiedRRInputs (cognitive 29) · ×1
  • SessionStore.sleepStageQualifiedRRInputs (cognitive 29) Atria/Atria/Sessions.swift:43936 — SessionStore.sleepStageQualifiedRRInputs has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 6, loops 2 (3 pts) (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.deferredLaunchCardSettlementMatches (cognitive 29) · ×1
  • SessionStore.deferredLaunchCardSettlementMatches (cognitive 29) Atria/Atria/Sessions.swift:57511 — SessionStore.deferredLaunchCardSettlementMatches has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 14, if/else 8 (11 pts), match/switch 3, ternaries 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.requestDeferredLaunchCardSettlement (cognitive 29) · ×1
  • SessionStore.requestDeferredLaunchCardSettlement (cognitive 29) Atria/Atria/Sessions.swift:57572 — SessionStore.requestDeferredLaunchCardSettlement has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (15 pts), ternaries 4 (10 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.protectedR10RecoveryDecision (cognitive 28) · ×1
  • AtriaBLEManager.protectedR10RecoveryDecision (cognitive 28) REDACTED:4063 — AtriaBLEManager.protectedR10RecoveryDecision has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 9, ternaries 1 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded (cognitive 28) · ×1
  • AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded (cognitive 28) REDACTED:11876 — AtriaBLEManager.rearmPersistedInterruptedFullDrainAfterFreshHRIfNeeded has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 14, if/else 6, ternaries 6, error handling 1, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded (cognitive 28) · ×1
  • AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded (cognitive 28) REDACTED:13034 — AtriaBLEManager.scheduleIdleWindowHistoryPipeRetryIfNeeded has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (18 pts), ternaries 2 (6 pts), boolean chains 3, loops 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded (cognitive 28) · ×1
  • AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded (cognitive 28) REDACTED:14783 — AtriaBLEManager.requestOnboardingPairingPreflightIfNeeded has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 16, if/else 8 (11 pts), loops 1 (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation (cognitive 28) · ×1
  • AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation (cognitive 28) REDACTED:20076 — AtriaBLEManager.scheduleConnectedRawHistoryCatchUpContinuation has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, ternaries 4 (6 pts), match/switch 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.recoverNoDataWatchdog (cognitive 28) · ×1
  • AtriaBLEManager.recoverNoDataWatchdog (cognitive 28) REDACTED:25601 — AtriaBLEManager.recoverNoDataWatchdog has cognitive complexity 28 (threshold 15). Drivers by points: if/else 13 (16 pts), ternaries 5 (10 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.publishRRContinuityQuality (cognitive 28) · ×1
  • AtriaBLEManager.publishRRContinuityQuality (cognitive 28) REDACTED:43010 — AtriaBLEManager.publishRRContinuityQuality has cognitive complexity 28 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 5 (10 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaDeviceUseJournal.sustainedUseIntervals (cognitive 28) · ×1
  • AtriaDeviceUseJournal.sustainedUseIntervals (cognitive 28) Atria/Atria/AtriaDeviceUseJournal.swift:81 — AtriaDeviceUseJournal.sustainedUseIntervals has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (21 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalSealedJSONLCompression.commit (cognitive 28) · ×1
  • AtriaHistoricalSealedJSONLCompression.commit (cognitive 28) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:90 — AtriaHistoricalSealedJSONLCompression.commit has cognitive complexity 28 (threshold 15). Drivers by points: if/else 18 (21 pts), boolean chains 6, error handling 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive (cognitive 28) · ×1
  • AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive (cognitive 28) Atria/Atria/AtriaStrapCalibrationArchive.swift:332 — AtriaStrapCalibrationArchive.materializeDecodedCompactIMUSamplesFromArchive has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 3 (6 pts), boolean chains 5 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStrapStepLedger.isValid (cognitive 28) · ×1
  • AtriaStrapStepLedger.isValid (cognitive 28) Atria/Atria/AtriaStrapStepLedger.swift:351 — AtriaStrapStepLedger.isValid has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 21, if/else 6 (7 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaStressMonitorStore.timeAlignedRRIntervals (cognitive 28) · ×1
  • AtriaStressMonitorStore.timeAlignedRRIntervals (cognitive 28) Atria/Atria/AtriaStressMonitor.swift:3230 — AtriaStressMonitorStore.timeAlignedRRIntervals has cognitive complexity 28 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 6, loops 4 (5 pts), ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4ExactRangeTrialHarness.validateStored (cognitive 28) · ×1
  • AtriaWhoop4ExactRangeTrialHarness.validateStored (cognitive 28) Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1068 — AtriaWhoop4ExactRangeTrialHarness.validateStored has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 26, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection (cognitive 28) · ×1
  • AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection (cognitive 28) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2252 — AtriaWhoop4MotionTickCompactStore.motionTickDayEvidenceProjection has cognitive complexity 28 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (10 pts), loops 4 (7 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.read (cognitive 28) · ×1
  • AtriaWhoop4MotionTickCompactStore.read (cognitive 28) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2516 — AtriaWhoop4MotionTickCompactStore.read has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 8, loops 3 (5 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalNotificationScheduler.makeActionableConnectionDecisions (cognitive 28) · ×1
  • LocalNotificationScheduler.makeActionableConnectionDecisions (cognitive 28) Atria/Atria/LocalNotificationScheduler.swift:1466 — LocalNotificationScheduler.makeActionableConnectionDecisions has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 10, ternaries 4 (7 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.beginFreshHistoryOwnerCutover (cognitive 27) · ×1
  • AtriaBLEManager.beginFreshHistoryOwnerCutover (cognitive 27) REDACTED:14590 — AtriaBLEManager.beginFreshHistoryOwnerCutover has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (11 pts), ternaries 4, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.recordAcceptedHRSample (cognitive 27) · ×1
  • AtriaBLEManager.recordAcceptedHRSample (cognitive 27) REDACTED:30927 — AtriaBLEManager.recordAcceptedHRSample has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (8 pts), boolean chains 6 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested (cognitive 27) · ×1
  • AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested (cognitive 27) REDACTED:39304 — AtriaBLEManager.sendGate4OfficialGen4CompactMotionSequenceIfRequested has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.resilientHistoryDrainSeekUnix (cognitive 27) · ×1
  • AtriaBLEManager.resilientHistoryDrainSeekUnix (cognitive 27) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2820 — AtriaBLEManager.resilientHistoryDrainSeekUnix has cognitive complexity 27 (threshold 15). Drivers by points: boolean chains 19, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.parseProprietaryUpdate (cognitive 27) · ×1
  • AtriaBLEManager.parseProprietaryUpdate (cognitive 27) REDACTED:57667 — AtriaBLEManager.parseProprietaryUpdate has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet (cognitive 27) · ×1
  • AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet (cognitive 27) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:313 — AtriaHistoricalConsumerReceiptLedger.validatedCurrentSet has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (10 pts), boolean chains 8, error handling 6 (8 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalSessionInspectionProof.validatedEvidence (cognitive 27) · ×1
  • AtriaHistoricalSessionInspectionProof.validatedEvidence (cognitive 27) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:60 — AtriaHistoricalSessionInspectionProof.validatedEvidence has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 12, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepHypnogramPresentation.compositedRuns (cognitive 27) · ×1
  • AtriaSleepHypnogramPresentation.compositedRuns (cognitive 27) Atria/Atria/AtriaSleepHypnogram.swift:233 — AtriaSleepHypnogramPresentation.compositedRuns has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTodayScreen.body (cognitive 27) · ×1
  • AtriaTodayScreen.body (cognitive 27) Atria/Atria/AtriaTodayScreen.swift:357 — AtriaTodayScreen.body has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 5, ternaries 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · HistoricalArchive.loadHeartRateSamples (cognitive 27) · ×1
  • HistoricalArchive.loadHeartRateSamples (cognitive 27) Atria/Atria/HistoricalArchive.swift:9346 — HistoricalArchive.loadHeartRateSamples has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 10, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.bytes (cognitive 27) · ×1
  • HistoricalArchive.bytes (cognitive 27) Atria/Atria/HistoricalArchive.swift:9568 — HistoricalArchive.bytes has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (17 pts), ternaries 2 (6 pts), loops 2, match/switch 1 (2 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe (cognitive 27) · ×1
  • SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe (cognitive 27) Atria/Atria/Sessions.swift:12099 — SessionStore.scheduleBoundedLegacyCurrentCycleStepMigrationIfSafe has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 13 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.mergeCanonicalHistoricalRollups (cognitive 27) · ×1
  • SessionStore.mergeCanonicalHistoricalRollups (cognitive 27) Atria/Atria/Sessions.swift:21512 — SessionStore.mergeCanonicalHistoricalRollups has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3 (5 pts), boolean chains 4, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.compactHistoricalArchiveIfUseful (cognitive 27) · ×1
  • SessionStore.compactHistoricalArchiveIfUseful (cognitive 27) Atria/Atria/Sessions.swift:28569 — SessionStore.compactHistoricalArchiveIfUseful has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 12, ternaries 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.confirmSleepHistoryNight (cognitive 27) · ×1
  • SessionStore.confirmSleepHistoryNight (cognitive 27) Atria/Atria/Sessions.swift:38198 — SessionStore.confirmSleepHistoryNight has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 11 (13 pts), if/else 8 (9 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.validateRRReferenceFromDocuments (cognitive 27) · ×1
  • SessionStore.validateRRReferenceFromDocuments (cognitive 27) Atria/Atria/Sessions.swift:54247 — SessionStore.validateRRReferenceFromDocuments has cognitive complexity 27 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 5 (7 pts), boolean chains 3, error handling 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.continueDeferredLoadFollowUp (cognitive 27) · ×1
  • SessionStore.continueDeferredLoadFollowUp (cognitive 27) Atria/Atria/Sessions.swift:57128 — SessionStore.continueDeferredLoadFollowUp has cognitive complexity 27 (threshold 15). Drivers by points: if/else 11 (18 pts), ternaries 3 (5 pts), boolean chains 2, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.flushLeftoverMotion (cognitive 26) · ×1
  • AtriaBLEManager.flushLeftoverMotion (cognitive 26) REDACTED:8693 — AtriaBLEManager.flushLeftoverMotion has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 6, loops 3 (4 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.handleReadOnlyHistoricalPayload (cognitive 26) · ×1
  • AtriaBLEManager.handleReadOnlyHistoricalPayload (cognitive 26) REDACTED:43310 — AtriaBLEManager.handleReadOnlyHistoricalPayload has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 4, error handling 2 (3 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.flush (cognitive 26) · ×1
  • AtriaHistoricalArchiveDurableStore.flush (cognitive 26) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:783 — AtriaHistoricalArchiveDurableStore.flush has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 4, loops 4, error handling 1 (2 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalCanonicalConsumerDestinationStore.verify (cognitive 26) · ×1
  • AtriaHistoricalCanonicalConsumerDestinationStore.verify (cognitive 26) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:214 — AtriaHistoricalCanonicalConsumerDestinationStore.verify has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 19, if/else 5, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence (cognitive 26) · ×1
  • AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence (cognitive 26) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:682 — AtriaHistoricalDailyConsumerProjection.validatedInspectionEvidence has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (12 pts), error handling 1, loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt (cognitive 26) · ×1
  • AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt (cognitive 26) Atria/Atria/AtriaHistoricalReplayIdentityShard.swift:175 — AtriaHistoricalReplayIdentityShard.verifyRetainedReceipt has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 24, if/else 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.finalizePendingWorkoutIntent (cognitive 26) · ×1
  • AtriaHomeView.finalizePendingWorkoutIntent (cognitive 26) Atria/Atria/AtriaHomeView.swift:2748 — AtriaHomeView.finalizePendingWorkoutIntent has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 5 (13 pts), if/else 8 (11 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaManualSleepSheet.detectedEvidenceCard (cognitive 26) · ×1
  • AtriaManualSleepSheet.detectedEvidenceCard (cognitive 26) Atria/Atria/AtriaManualSleepSheet.swift:420 — AtriaManualSleepSheet.detectedEvidenceCard has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (18 pts), ternaries 2 (6 pts), boolean chains 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTodayMorningWhiteboardModel.make (cognitive 26) · ×1
  • AtriaTodayMorningWhiteboardModel.make (cognitive 26) Atria/Atria/AtriaMorningWhiteboardModel.swift:31 — AtriaTodayMorningWhiteboardModel.make has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 6 (10 pts), if/else 9, boolean chains 7 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaNightBaseline.sentence (cognitive 26) · ×1
  • AtriaNightBaseline.sentence (cognitive 26) Atria/Atria/AtriaNightBaseline.swift:167 — AtriaNightBaseline.sentence has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 13 (25 pts), match/switch 1 (nesting depth added 12). Of this number, 25 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaOnDeviceModel.dataBlock (cognitive 26) · ×1
  • AtriaOnDeviceModel.dataBlock (cognitive 26) Atria/Atria/AtriaOnDeviceCoach.swift:58 — AtriaOnDeviceModel.dataBlock has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (16 pts), ternaries 3 (5 pts), boolean chains 3, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments (cognitive 26) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments (cognitive 26) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1811 — AtriaWhoop4GravityCadenceStepModel.estimateCoveredActivityFragments has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (22 pts), boolean chains 2, loops 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan (cognitive 26) · ×1
  • HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan (cognitive 26) Atria/Atria/HistoricalArchive.swift:4394 — HistoricalArchive.automaticRecoveredDataCacheAuthorityRestorationPlan has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 18, if/else 3 (5 pts), loops 2, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint (cognitive 26) · ×1
  • HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint (cognitive 26) Atria/Atria/HistoricalArchive.swift:5027 — HistoricalArchive.makeAutomaticRecoveredDataBootstrapCheckpoint has cognitive complexity 26 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 10, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.workoutReadinessCore (cognitive 26) · ×1
  • SavedSession.workoutReadinessCore (cognitive 26) Atria/Atria/Sessions.swift:7665 — SavedSession.workoutReadinessCore has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, ternaries 4, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.dumpSleepCandidateDiagnostics (cognitive 26) · ×1
  • SessionStore.dumpSleepCandidateDiagnostics (cognitive 26) Atria/Atria/Sessions.swift:13216 — SessionStore.dumpSleepCandidateDiagnostics has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 10 (18 pts), boolean chains 4, loops 3, if/else 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeDailyMetricRollupPreparationCancellable (cognitive 26) · ×1
  • SessionStore.makeDailyMetricRollupPreparationCancellable (cognitive 26) Atria/Atria/Sessions.swift:14105 — SessionStore.makeDailyMetricRollupPreparationCancellable has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), ternaries 3 (5 pts), boolean chains 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.runRecoveredVerifiedActivityShadowStep (cognitive 26) · ×1
  • SessionStore.runRecoveredVerifiedActivityShadowStep (cognitive 26) Atria/Atria/Sessions.swift:19241 — SessionStore.runRecoveredVerifiedActivityShadowStep has cognitive complexity 26 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 5, error handling 1 (2 pts), match/switch 1, ternaries 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.loadCachedResidentJournalSessionForSleepReview (cognitive 26) · ×1
  • SessionStore.loadCachedResidentJournalSessionForSleepReview (cognitive 26) Atria/Atria/Sessions.swift:29813 — SessionStore.loadCachedResidentJournalSessionForSleepReview has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 7, loops 2, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeCompactLatestNightSettlementPreparation (cognitive 26) · ×1
  • SessionStore.makeCompactLatestNightSettlementPreparation (cognitive 26) Atria/Atria/Sessions.swift:38919 — SessionStore.makeCompactLatestNightSettlementPreparation has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (5 pts), ternaries 1 (3 pts), boolean chains 2, error handling 2, match/switch 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.sleepReviewAdmissionDiagnosis (cognitive 26) · ×1
  • SessionStore.sleepReviewAdmissionDiagnosis (cognitive 26) Atria/Atria/Sessions.swift:40103 — SessionStore.sleepReviewAdmissionDiagnosis has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 9, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Night.init (cognitive 26) · ×1
  • Night.init (cognitive 26) Atria/Atria/Sessions.swift:59556 — Night.init has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (10 pts), ternaries 2 (3 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded (cognitive 25) · ×1
  • AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded (cognitive 25) REDACTED:13144 — AtriaBLEManager.evaluateIdleWindowHistoryDrainIfNeeded has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 5 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed (cognitive 25) · ×1
  • AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed (cognitive 25) REDACTED:16350 — AtriaBLEManager.requestProtectedR10InitialProfileNotificationIfAllowed has cognitive complexity 25 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 7 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.pruneRRWindow (cognitive 25) · ×1
  • AtriaBLEManager.pruneRRWindow (cognitive 25) REDACTED:27129 — AtriaBLEManager.pruneRRWindow has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (20 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.reconnectToSavedPeripheralIfPossible (cognitive 25) · ×1
  • AtriaBLEManager.reconnectToSavedPeripheralIfPossible (cognitive 25) REDACTED:27965 — AtriaBLEManager.reconnectToSavedPeripheralIfPossible has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.retryProtectedR10ShortBurstIfEligible (cognitive 25) · ×1
  • AtriaBLEManager.retryProtectedR10ShortBurstIfEligible (cognitive 25) REDACTED:34777 — AtriaBLEManager.retryProtectedR10ShortBurstIfEligible has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 16, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.gate4DailyBankRearmPolicyInput (cognitive 25) · ×1
  • AtriaBLEManager.gate4DailyBankRearmPolicyInput (cognitive 25) REDACTED:36640 — AtriaBLEManager.gate4DailyBankRearmPolicyInput has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 19, if/else 4, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.recordResearchProbeCandidate (cognitive 25) · ×1
  • AtriaBLEManager.recordResearchProbeCandidate (cognitive 25) REDACTED:44592 — AtriaBLEManager.recordResearchProbeCandidate has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 9, ternaries 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.handleParsedRealtimePacket (cognitive 25) · ×1
  • AtriaBLEManager.handleParsedRealtimePacket (cognitive 25) REDACTED:51284 — AtriaBLEManager.handleParsedRealtimePacket has cognitive complexity 25 (threshold 15). Drivers by points: if/else 14 (19 pts), boolean chains 6 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.restoreStrapStepLedgerAtLaunch (cognitive 25) · ×1
  • AtriaBLEManager.restoreStrapStepLedgerAtLaunch (cognitive 25) REDACTED:51728 — AtriaBLEManager.restoreStrapStepLedgerAtLaunch has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, ternaries 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBreathworkSession.finishArtifacts (cognitive 25) · ×1
  • AtriaBreathworkSession.finishArtifacts (cognitive 25) Atria/Atria/AtriaBreathworkSession.swift:649 — AtriaBreathworkSession.finishArtifacts has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, loops 2, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepStressCard.body (cognitive 25) · ×1
  • AtriaSleepStressCard.body (cognitive 25) Atria/Atria/AtriaHealthScreen.swift:3284 — AtriaSleepStressCard.body has cognitive complexity 25 (threshold 15). Drivers by points: if/else 11 (16 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.init (cognitive 25) · ×1
  • AtriaHistoricalArchiveDurableStore.init (cognitive 25) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:328 — AtriaHistoricalArchiveDurableStore.init has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 3 (6 pts), boolean chains 4 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex (cognitive 25) · ×1
  • AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex (cognitive 25) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1355 — AtriaHistoricalArchiveDurableStore.loadValidatedDerivedIndex has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 7, loops 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceiptsFromSnapshot (cognitive 25) · ×1
  • AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceiptsFromSnapshot (cognitive 25) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:456 — AtriaHistoricalConsumerProjectionCoordinator.publishEligibleReceiptsFromSnapshot has cognitive complexity 25 (threshold 15). Drivers by points: error handling 3 (8 pts), loops 3 (7 pts), if/else 3 (6 pts), boolean chains 3, match/switch 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers (cognitive 25) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers (cognitive 25) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:598 — AtriaHistoricalFullDrainCoverageStore.recordCommittedConsumers has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 16, if/else 7 (8 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaJournalInsights.thresholdSplitInsightCancellable (cognitive 25) · ×1
  • AtriaJournalInsights.thresholdSplitInsightCancellable (cognitive 25) Atria/Atria/AtriaJournalInsights.swift:309 — AtriaJournalInsights.thresholdSplitInsightCancellable has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 5, ternaries 2 (4 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveredRRProjection.decodeHex (cognitive 25) · ×1
  • AtriaRecoveredRRProjection.decodeHex (cognitive 25) Atria/Atria/AtriaRecoveredRRProjection.swift:620 — AtriaRecoveredRRProjection.decodeHex has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (6 pts), boolean chains 2, loops 2, match/switch 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepCooperativeAlgorithms.stableSort (cognitive 25) · ×1
  • AtriaSleepCooperativeAlgorithms.stableSort (cognitive 25) Atria/Atria/AtriaSleepWakeResearch.swift:8 — AtriaSleepCooperativeAlgorithms.stableSort has cognitive complexity 25 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhiteboardCoachSentence.rewrite (cognitive 25) · ×1
  • AtriaWhiteboardCoachSentence.rewrite (cognitive 25) Atria/Atria/Dashboard.swift:690 — AtriaWhiteboardCoachSentence.rewrite has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (16 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · HealthKitExporter.queryHeartRateExportReadback (cognitive 25) · ×1
  • HealthKitExporter.queryHeartRateExportReadback (cognitive 25) Atria/Atria/HealthKitExporter.swift:1565 — HealthKitExporter.queryHeartRateExportReadback has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (8 pts), ternaries 8, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.stressReplaySessionInputShrank (cognitive 25) · ×1
  • SessionStore.stressReplaySessionInputShrank (cognitive 25) Atria/Atria/Sessions.swift:9063 — SessionStore.stressReplaySessionInputShrank has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 16, if/else 9. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.stressReplaySessionInputGrew (cognitive 25) · ×1
  • SessionStore.stressReplaySessionInputGrew (cognitive 25) Atria/Atria/Sessions.swift:9102 — SessionStore.stressReplaySessionInputGrew has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 15, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.persistPreparedDailyRollups (cognitive 25) · ×1
  • SessionStore.persistPreparedDailyRollups (cognitive 25) Atria/Atria/Sessions.swift:13397 — SessionStore.persistPreparedDailyRollups has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (17 pts), ternaries 3 (6 pts), boolean chains 1, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.pendingSleepRecoveryEstimate (cognitive 25) · ×1
  • SessionStore.pendingSleepRecoveryEstimate (cognitive 25) Atria/Atria/Sessions.swift:26094 — SessionStore.pendingSleepRecoveryEstimate has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 18, if/else 6, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.confirmBestWorkoutCandidate (cognitive 25) · ×1
  • SessionStore.confirmBestWorkoutCandidate (cognitive 25) Atria/Atria/Sessions.swift:33666 — SessionStore.confirmBestWorkoutCandidate has cognitive complexity 25 (threshold 15). Drivers by points: ternaries 8 (11 pts), boolean chains 8, if/else 6 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.biologicalAgeSummary (cognitive 25) · ×1
  • SessionStore.biologicalAgeSummary (cognitive 25) Atria/Atria/Sessions.swift:52456 — SessionStore.biologicalAgeSummary has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 18, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt (cognitive 24) · ×1
  • AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt (cognitive 24) REDACTED:4747 — AtriaBLEManager.allDayPassiveInProcessRequalifyShouldAttempt has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 13, if/else 9 (11 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.updateDutyCycleState (cognitive 24) · ×1
  • AtriaBLEManager.updateDutyCycleState (cognitive 24) REDACTED:10326 — AtriaBLEManager.updateDutyCycleState has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 15, if/else 5 (7 pts), match/switch 1, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.derivedConnectionStatus (cognitive 24) · ×1
  • AtriaBLEManager.derivedConnectionStatus (cognitive 24) REDACTED:27889 — AtriaBLEManager.derivedConnectionStatus has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 6 (16 pts), if/else 3 (4 pts), match/switch 2 (4 pts) (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaBLEManager.performProductionHistoryReadPreflight (cognitive 24) · ×1
  • AtriaBLEManager.performProductionHistoryReadPreflight (cognitive 24) REDACTED:42781 — AtriaBLEManager.performProductionHistoryReadPreflight has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 11, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization (cognitive 24) · ×1
  • AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization (cognitive 24) REDACTED:47672 — AtriaBLEManager.schedulePendingConsumerFollowupScanMaterialization has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 5, error handling 3 (4 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.activeCaloriesForSnapshot (cognitive 24) · ×1
  • AtriaBLEManager.activeCaloriesForSnapshot (cognitive 24) REDACTED:50097 — AtriaBLEManager.activeCaloriesForSnapshot has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (8 pts), loops 1 (4 pts), ternaries 1 (3 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.applyOrderedProprietaryCallbackBatch (cognitive 24) · ×1
  • AtriaBLEManager.applyOrderedProprietaryCallbackBatch (cognitive 24) REDACTED:57401 — AtriaBLEManager.applyOrderedProprietaryCallbackBatch has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaCivilDayStepAuthority.exactTotalsLocked (cognitive 24) · ×1
  • AtriaCivilDayStepAuthority.exactTotalsLocked (cognitive 24) Atria/Atria/AtriaCivilDayStepAuthority.swift:290 — AtriaCivilDayStepAuthority.exactTotalsLocked has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 5, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHeroStatusCardHost.body (cognitive 24) · ×1
  • AtriaHeroStatusCardHost.body (cognitive 24) Atria/Atria/AtriaHeroConnectionSections.swift:194 — AtriaHeroStatusCardHost.body has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 8 (19 pts), if/else 3 (4 pts), match/switch 1 (nesting depth added 12). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaHistoricalActivityInspectionProofFactory.prepareVerified (cognitive 24) · ×1
  • AtriaHistoricalActivityInspectionProofFactory.prepareVerified (cognitive 24) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:583 — AtriaHistoricalActivityInspectionProofFactory.prepareVerified has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, loops 3 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.appendOnlyArchiveDelta (cognitive 24) · ×1
  • AtriaHistoricalArchiveDurableStore.appendOnlyArchiveDelta (cognitive 24) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1784 — AtriaHistoricalArchiveDurableStore.appendOnlyArchiveDelta has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (20 pts), boolean chains 3, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalDailyConsumerProjection.stepDays (cognitive 24) · ×1
  • AtriaHistoricalDailyConsumerProjection.stepDays (cognitive 24) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:613 — AtriaHistoricalDailyConsumerProjection.stepDays has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 14, if/else 4 (6 pts), ternaries 3, loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalLongTermRollup.validate (cognitive 24) · ×1
  • AtriaHistoricalLongTermRollup.validate (cognitive 24) Atria/Atria/AtriaHistoricalLongTermRollup.swift:314 — AtriaHistoricalLongTermRollup.validate has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 21, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.handleDeepLink (cognitive 24) · ×1
  • AtriaHomeView.handleDeepLink (cognitive 24) Atria/Atria/AtriaHomeView.swift:1877 — AtriaHomeView.handleDeepLink has cognitive complexity 24 (threshold 15). Drivers by points: if/else 16 (19 pts), ternaries 1 (3 pts), match/switch 1 (2 pts) (nesting depth added 6). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHomeView.scheduleLiveSensorWidgetPatch (cognitive 24) · ×1
  • AtriaHomeView.scheduleLiveSensorWidgetPatch (cognitive 24) Atria/Atria/AtriaHomeView.swift:3860 — AtriaHomeView.scheduleLiveSensorWidgetPatch has cognitive complexity 24 (threshold 15). Drivers by points: ternaries 14, boolean chains 7, if/else 3. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaManagedStorageInventory.allocatedBytes (cognitive 24) · ×1
  • AtriaManagedStorageInventory.allocatedBytes (cognitive 24) Atria/Atria/AtriaManagedStorageInventory.swift:87 — AtriaManagedStorageInventory.allocatedBytes has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (19 pts), loops 2 (4 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaMetricZone.zone (cognitive 24) · ×1
  • AtriaMetricZone.zone (cognitive 24) Atria/Atria/AtriaMetricTargets.swift:217 — AtriaMetricZone.zone has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (21 pts), boolean chains 2, match/switch 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaGyroCadenceResearchPedometer.windowVerdict (cognitive 24) · ×1
  • AtriaGyroCadenceResearchPedometer.windowVerdict (cognitive 24) Atria/Atria/AtriaR10Motion.swift:474 — AtriaGyroCadenceResearchPedometer.windowVerdict has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, loops 5 (6 pts), ternaries 2 (nesting depth added 4). Of this number, 23 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressElevatedEvidence.analyze (cognitive 24) · ×1
  • AtriaStressElevatedEvidence.analyze (cognitive 24) Atria/Atria/AtriaStressDetailView.swift:397 — AtriaStressElevatedEvidence.analyze has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 8, loops 2 (3 pts) (nesting depth added 6). Of this number, 20 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow (cognitive 24) · ×1
  • AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow (cognitive 24) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1917 — AtriaWhoop4GravityCadenceStepModel.dominantMotionWindow has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 7, loops 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutRouteRecorder.locationManager (cognitive 24) · ×1
  • AtriaWorkoutRouteRecorder.locationManager (cognitive 24) Atria/Atria/AtriaWorkoutRoute.swift:474 — AtriaWorkoutRouteRecorder.locationManager has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 9, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutCommandTransaction.applying (cognitive 24) · ×1
  • AtriaWorkoutCommandTransaction.applying (cognitive 24) Atria/Atria/AtriaWorkoutRuntime.swift:193 — AtriaWorkoutCommandTransaction.applying has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 5, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.motionTickDayEvidenceReadImpl · ×1
  • HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine (cognitive 24) Atria/Atria/HistoricalArchive.swift:3813 — HistoricalArchive.motionTickDayEvidenceReadImpl::consumeDayEvidenceLine has cognitive complexity 24 (threshold 15). Drivers by points: boolean chains 21, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (HistoricalArchive.motionTickDayEvidenceReadImpl) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · HistoricalArchive.append (cognitive 24) · ×1
  • HistoricalArchive.append (cognitive 24) Atria/Atria/HistoricalArchive.swift:8900 — HistoricalArchive.append has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaScanRecordParser.unescape (cognitive 24) · ×1
  • AtriaScanRecordParser.unescape (cognitive 24) Atria/Atria/HistoricalArchive.swift:11169 — AtriaScanRecordParser.unescape has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, match/switch 1 (2 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.persistRecoveredCurrentCheckpoint (cognitive 24) · ×1
  • SessionStore.persistRecoveredCurrentCheckpoint (cognitive 24) Atria/Atria/Sessions.swift:16682 — SessionStore.persistRecoveredCurrentCheckpoint has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 8, error handling 1, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.completeRecoveredDataComponent (cognitive 24) · ×1
  • SessionStore.completeRecoveredDataComponent (cognitive 24) Atria/Atria/Sessions.swift:19685 — SessionStore.completeRecoveredDataComponent has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (17 pts), match/switch 2 (4 pts), boolean chains 2, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.verifiedCanonicalStepEvidenceDaysCancellable (cognitive 24) · ×1
  • SessionStore.verifiedCanonicalStepEvidenceDaysCancellable (cognitive 24) Atria/Atria/Sessions.swift:21678 — SessionStore.verifiedCanonicalStepEvidenceDaysCancellable has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), boolean chains 6, loops 3 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeSavedDailyMetrics (cognitive 24) · ×1
  • SessionStore.makeSavedDailyMetrics (cognitive 24) Atria/Atria/Sessions.swift:23194 — SessionStore.makeSavedDailyMetrics has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 5, boolean chains 3, loops 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · RespRateRsa.estimate (cognitive 23) · ×1
  • RespRateRsa.estimate (cognitive 23) Atria/Atria/AtriaAnalytics.swift:5 — RespRateRsa.estimate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 8, loops 3 (4 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.startScan (cognitive 23) · ×1
  • AtriaBLEManager.startScan (cognitive 23) REDACTED:27296 — AtriaBLEManager.startScan has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10, boolean chains 9, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart (cognitive 23) · ×1
  • AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart (cognitive 23) REDACTED:44911 — AtriaBLEManager.armFullDrainAuthorityAfterHistoryStart has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 19, if/else 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.processAdmittedHistoricalFrame (cognitive 23) · ×1
  • AtriaBLEManager.processAdmittedHistoricalFrame (cognitive 23) REDACTED:45443 — AtriaBLEManager.processAdmittedHistoricalFrame has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 6, error handling 2 (5 pts) (nesting depth added 5). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry (cognitive 23) · ×1
  • AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry (cognitive 23) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1211 — AtriaBLEManager.shouldAdmitIdleWindowHistoryDrainRetry has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaGeneratedArtifactRetention.prune (cognitive 23) · ×1
  • AtriaGeneratedArtifactRetention.prune (cognitive 23) Atria/Atria/AtriaGeneratedArtifactRetention.swift:61 — AtriaGeneratedArtifactRetention.prune has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 3 (7 pts), boolean chains 6, if/else 4 (6 pts), error handling 1 (2 pts), loops 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveCatalog.validate (cognitive 23) · ×1
  • AtriaHistoricalArchiveCatalog.validate (cognitive 23) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:58 — AtriaHistoricalArchiveCatalog.validate has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 15, if/else 6, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalArchiveCatalogStore.verifyFiles (cognitive 23) · ×1
  • AtriaHistoricalArchiveCatalogStore.verifyFiles (cognitive 23) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:361 — AtriaHistoricalArchiveCatalogStore.verifyFiles has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (18 pts), boolean chains 4, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.decoratedIdentity (cognitive 23) · ×1
  • AtriaHistoricalArchiveDurableStore.decoratedIdentity (cognitive 23) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:2362 — AtriaHistoricalArchiveDurableStore.decoratedIdentity has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (8 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalConsumerReceiptLedger.validatedMaterializedProjections (cognitive 23) · ×1
  • AtriaHistoricalConsumerReceiptLedger.validatedMaterializedProjections (cognitive 23) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:460 — AtriaHistoricalConsumerReceiptLedger.validatedMaterializedProjections has cognitive complexity 23 (threshold 15). Drivers by points: if/else 5 (15 pts), error handling 1 (3 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced (cognitive 23) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced (cognitive 23) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:304 — AtriaHistoricalFullDrainCoverageStore.recordHistoryEndFsynced has cognitive complexity 23 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 11 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHistoricalHighVolumeDiagnosticsCoordinator.evaluate (cognitive 23) · ×1
  • AtriaHistoricalHighVolumeDiagnosticsCoordinator.evaluate (cognitive 23) Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:420 — AtriaHistoricalHighVolumeDiagnosticsCoordinator.evaluate has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalRetiredReplayIndex.importAndVerify (cognitive 23) · ×1
  • AtriaHistoricalRetiredReplayIndex.importAndVerify (cognitive 23) Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:126 — AtriaHistoricalRetiredReplayIndex.importAndVerify has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (9 pts), loops 1 (3 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutZoneHapticTransition.accept (cognitive 23) · ×1
  • AtriaWorkoutZoneHapticTransition.accept (cognitive 23) Atria/Atria/AtriaLiveWorkoutView.swift:1566 — AtriaWorkoutZoneHapticTransition.accept has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 8 (16 pts), if/else 3, boolean chains 2, match/switch 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaNightBaseline.comparison (cognitive 23) · ×1
  • AtriaNightBaseline.comparison (cognitive 23) Atria/Atria/AtriaNightBaseline.swift:119 — AtriaNightBaseline.comparison has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (9 pts), ternaries 6 (9 pts), match/switch 2 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveryScoreHero.body (cognitive 23) · ×1
  • AtriaRecoveryScoreHero.body (cognitive 23) Atria/Atria/AtriaOverviewSections.swift:7846 — AtriaRecoveryScoreHero.body has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 13 (20 pts), if/else 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaResearchBundleBuilder.makePayload (cognitive 23) · ×1
  • AtriaResearchBundleBuilder.makePayload (cognitive 23) Atria/Atria/AtriaResearchBundle.swift:310 — AtriaResearchBundleBuilder.makePayload has cognitive complexity 23 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 7, loops 4 (6 pts), match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSegmentButtonStyle.makeBody (cognitive 23) · ×1
  • AtriaSegmentButtonStyle.makeBody (cognitive 23) Atria/Atria/AtriaSharedChrome.swift:12 — AtriaSegmentButtonStyle.makeBody has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 11 (20 pts), if/else 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTrendChartCard.body (cognitive 23) · ×1
  • AtriaTrendChartCard.body (cognitive 23) Atria/Atria/AtriaTrendChart.swift:99 — AtriaTrendChartCard.body has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 5 (8 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTrendShift.shifts (cognitive 23) · ×1
  • AtriaTrendShift.shifts (cognitive 23) Atria/Atria/AtriaTrendShift.swift:111 — AtriaTrendShift.shifts has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 3 (4 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHeartRateAxisChart.baseChart (cognitive 23) · ×1
  • AtriaHeartRateAxisChart.baseChart (cognitive 23) Atria/Atria/AtriaVitalsCollectionSections.swift:4709 — AtriaHeartRateAxisChart.baseChart has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames (cognitive 23) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames (cognitive 23) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:673 — AtriaWhoop4HistoryAdmissionLedger.enumerateDurableFrames has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 6, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4LiveFlushPlanner.tick (cognitive 23) · ×1
  • AtriaWhoop4LiveFlushPlanner.tick (cognitive 23) Atria/Atria/AtriaWhoop4LiveFlushPlanner.swift:221 — AtriaWhoop4LiveFlushPlanner.tick has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 5, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.appendMigrated (cognitive 23) · ×1
  • AtriaWhoop4MotionTickCompactStore.appendMigrated (cognitive 23) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:340 — AtriaWhoop4MotionTickCompactStore.appendMigrated has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 7, error handling 2 (6 pts), if/else 3 (6 pts), loops 2 (4 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow (cognitive 23) · ×1
  • AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow (cognitive 23) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:421 — AtriaWhoop4GravityCadenceStepModel.estimateAlignedWindow has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 10, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.motionWindowReadableFileURLs (cognitive 23) · ×1
  • HistoricalArchive.motionWindowReadableFileURLs (cognitive 23) Atria/Atria/HistoricalArchive.swift:8014 — HistoricalArchive.motionWindowReadableFileURLs has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 19, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SavedSession.distinctCoverageHonestWindows (cognitive 23) · ×1
  • SavedSession.distinctCoverageHonestWindows (cognitive 23) Atria/Atria/Sessions.swift:1912 — SavedSession.distinctCoverageHonestWindows has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 4 (5 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.publishStressContextIfNeeded (cognitive 23) · ×1
  • SessionStore.publishStressContextIfNeeded (cognitive 23) Atria/Atria/Sessions.swift:8964 — SessionStore.publishStressContextIfNeeded has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), boolean chains 5 (nesting depth added 10). To reduce it, flatten the nesting: this score is depth rather than breadth — most of its points come from checks stacked inside one another, so the work sits several levels in. Invert each enclosing check into an early exit (a return, or the language's equivalent) so the happy path stays at one level, and where a level cannot be exited early, lift the block it encloses into its own named function.
D2 · Cognitive Complexity · SessionStore.startCurrentCycleStrapStepReceiptRead (cognitive 23) · ×1
  • SessionStore.startCurrentCycleStrapStepReceiptRead (cognitive 23) Atria/Atria/Sessions.swift:12544 — SessionStore.startCurrentCycleStrapStepReceiptRead has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), match/switch 2 (5 pts), ternaries 1 (3 pts), boolean chains 1, loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.refreshHistoricalArchiveStatus (cognitive 23) · ×1
  • SessionStore.refreshHistoricalArchiveStatus (cognitive 23) Atria/Atria/Sessions.swift:14711 — SessionStore.refreshHistoricalArchiveStatus has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 6, ternaries 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.logCollectionHealthFromLaunchIfRequested (cognitive 23) · ×1
  • SessionStore.logCollectionHealthFromLaunchIfRequested (cognitive 23) Atria/Atria/Sessions.swift:31079 — SessionStore.logCollectionHealthFromLaunchIfRequested has cognitive complexity 23 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 6, ternaries 5 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.motionEvidenceMonotonicConfirmedSleeps (cognitive 23) · ×1
  • SessionStore.motionEvidenceMonotonicConfirmedSleeps (cognitive 23) Atria/Atria/Sessions.swift:45209 — SessionStore.motionEvidenceMonotonicConfirmedSleeps has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 10, if/else 6 (10 pts), loops 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.aggregateWorkoutCandidatesUnshared (cognitive 23) · ×1
  • SessionStore.aggregateWorkoutCandidatesUnshared (cognitive 23) Atria/Atria/Sessions.swift:49141 — SessionStore.aggregateWorkoutCandidatesUnshared has cognitive complexity 23 (threshold 15). Drivers by points: if/else 17, boolean chains 4, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ActiveSessionJournal.exactReplaySafeNovelSuffix (cognitive 22) · ×1
  • ActiveSessionJournal.exactReplaySafeNovelSuffix (cognitive 22) Atria/Atria/ActiveSessionJournal.swift:628 — ActiveSessionJournal.exactReplaySafeNovelSuffix has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaActivityMonitorMemo.timelineSpans (cognitive 22) · ×1
  • AtriaActivityMonitorMemo.timelineSpans (cognitive 22) Atria/Atria/AtriaActivityMonitor.swift:3469 — AtriaActivityMonitorMemo.timelineSpans has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (10 pts), ternaries 4 (6 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaActivityWorkoutDetailSheet.saveAllAsync (cognitive 22) · ×1
  • AtriaActivityWorkoutDetailSheet.saveAllAsync (cognitive 22) Atria/Atria/AtriaActivityMonitor.swift:4336 — AtriaActivityWorkoutDetailSheet.saveAllAsync has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (10 pts), match/switch 4 (8 pts), boolean chains 4 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.kickZombieProprietaryStreamIfNeeded (cognitive 22) · ×1
  • AtriaBLEManager.kickZombieProprietaryStreamIfNeeded (cognitive 22) REDACTED:9973 — AtriaBLEManager.kickZombieProprietaryStreamIfNeeded has cognitive complexity 22 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.liveR10EligibilityBlockers (cognitive 22) · ×1
  • AtriaBLEManager.liveR10EligibilityBlockers (cognitive 22) REDACTED:32739 — AtriaBLEManager.liveR10EligibilityBlockers has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 10, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.allDayCompactIMURecoveryStep (cognitive 22) · ×1
  • AtriaBLEManager.allDayCompactIMURecoveryStep (cognitive 22) REDACTED:33023 — AtriaBLEManager.allDayCompactIMURecoveryStep has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 13, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible (cognitive 22) · ×1
  • AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible (cognitive 22) REDACTED:36884 — AtriaBLEManager.stopWorkoutHistoricalMotionBankIfPossible has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 10 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.armHistoricalPageContinuationAfterACK (cognitive 22) · ×1
  • AtriaBLEManager.armHistoricalPageContinuationAfterACK (cognitive 22) REDACTED:49660 — AtriaBLEManager.armHistoricalPageContinuationAfterACK has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 8, ternaries 1 (2 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.
D2 · Cognitive Complexity · AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated (cognitive 22) · ×1
  • AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated (cognitive 22) Atria/Atria/AtriaStrapPowerPolicy.swift:388 — AtriaBLEManager.batteryBoundaryEventIsIndependentlyCorroborated has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 17, if/else 3 (4 pts), match/switch 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.mergeExactWindows (cognitive 22) · ×1
  • AtriaHistoricalGapLedger.mergeExactWindows (cognitive 22) Atria/Atria/AtriaHistoricalGapLedger.swift:1200 — AtriaHistoricalGapLedger.mergeExactWindows has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts), boolean chains 4, ternaries 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeView.overviewContent (cognitive 22) · ×1
  • AtriaHomeView.overviewContent (cognitive 22) Atria/Atria/AtriaHomeView.swift:6066 — AtriaHomeView.overviewContent has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 14, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaConnectionDiagnosis.derive (cognitive 22) · ×1
  • AtriaConnectionDiagnosis.derive (cognitive 22) Atria/Atria/AtriaHomeView.swift:14794 — AtriaConnectionDiagnosis.derive has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 6, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MinuteFact.isStructurallyValid (cognitive 22) · ×1
  • MinuteFact.isStructurallyValid (cognitive 22) Atria/Atria/AtriaPhysiologicalStressModel.swift:284 — MinuteFact.isStructurallyValid has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 22. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaRecoveredDataRecomputeCoordinator.request (cognitive 22) · ×1
  • AtriaRecoveredDataRecomputeCoordinator.request (cognitive 22) Atria/Atria/AtriaRecoveredDataRecomputeCoordinator.swift:164 — AtriaRecoveredDataRecomputeCoordinator.request has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 5, match/switch 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveredMotionProjection.epochFeaturesCancellable (cognitive 22) · ×1
  • AtriaRecoveredMotionProjection.epochFeaturesCancellable (cognitive 22) Atria/Atria/AtriaRecoveredMotionProjection.swift:153 — AtriaRecoveredMotionProjection.epochFeaturesCancellable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5, loops 3 (5 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRestoreTransactionCoordinator.apply (cognitive 22) · ×1
  • AtriaRestoreTransactionCoordinator.apply (cognitive 22) Atria/Atria/AtriaRestoreTransaction.swift:211 — AtriaRestoreTransactionCoordinator.apply has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (4 pts), ternaries 2 (4 pts) (nesting depth added 11). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaStrengthLog.historyProjection (cognitive 22) · ×1
  • AtriaStrengthLog.historyProjection (cognitive 22) Atria/Atria/AtriaStrengthLog.swift:311 — AtriaStrengthLog.historyProjection has cognitive complexity 22 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.finalizeGapReceipts (cognitive 22) · ×1
  • AtriaHistoricalStressReplay.finalizeGapReceipts (cognitive 22) Atria/Atria/AtriaStressMonitor.swift:2046 — AtriaHistoricalStressReplay.finalizeGapReceipts has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 3, match/switch 1 (3 pts), loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaGlanceSparkline.body (cognitive 22) · ×1
  • AtriaGlanceSparkline.body (cognitive 22) Atria/Atria/AtriaTodayScreen.swift:4158 — AtriaGlanceSparkline.body has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 6 (11 pts), if/else 4 (8 pts), loops 1 (2 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked (cognitive 22) · ×1
  • AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked (cognitive 22) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1294 — AtriaWhoop4MotionTickCompactStore.latestNightReceiptIsCurrentLocked has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 19, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.backfillHeartRateSidecars (cognitive 22) · ×1
  • HistoricalArchive.backfillHeartRateSidecars (cognitive 22) Atria/Atria/HistoricalArchive.swift:8296 — HistoricalArchive.backfillHeartRateSidecars has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 3, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalNotificationScheduler.makeSleepReviewDecision (cognitive 22) · ×1
  • LocalNotificationScheduler.makeSleepReviewDecision (cognitive 22) Atria/Atria/LocalNotificationScheduler.swift:1556 — LocalNotificationScheduler.makeSleepReviewDecision has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 4, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.latestReferenceValidatedHRVSourceCancellable (cognitive 22) · ×1
  • SessionStore.latestReferenceValidatedHRVSourceCancellable (cognitive 22) Atria/Atria/Sessions.swift:26465 — SessionStore.latestReferenceValidatedHRVSourceCancellable has cognitive complexity 22 (threshold 15). Drivers by points: if/else 5 (12 pts), boolean chains 6, loops 2 (3 pts), ternaries 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeNapReviewNightsForCacheCore (cognitive 22) · ×1
  • SessionStore.makeNapReviewNightsForCacheCore (cognitive 22) Atria/Atria/Sessions.swift:37537 — SessionStore.makeNapReviewNightsForCacheCore has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (13 pts), ternaries 3 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.aggregateSleepDiagnostics (cognitive 22) · ×1
  • SessionStore.aggregateSleepDiagnostics (cognitive 22) Atria/Atria/Sessions.swift:52339 — SessionStore.aggregateSleepDiagnostics has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (10 pts), loops 1 (nesting depth added 5). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.scoreExternalRR (cognitive 22) · ×1
  • SessionStore.scoreExternalRR (cognitive 22) Atria/Atria/Sessions.swift:54781 — SessionStore.scoreExternalRR has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 8, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · prepare_reference_rr.read_samples (cognitive 22) · ×1
  • prepare_reference_rr.read_samples (cognitive 22) prepare_reference_rr.py:72 — prepare_reference_rr.read_samples has cognitive complexity 22 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 4 (6 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaActivitySelectedDaySleeps.overlapping (cognitive 21) · ×1
  • AtriaActivitySelectedDaySleeps.overlapping (cognitive 21) Atria/Atria/AtriaActivityMonitor.swift:770 — AtriaActivitySelectedDaySleeps.overlapping has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 6, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · BiologicalAge.interpolatedAgeEquivalent (cognitive 21) · ×1
  • BiologicalAge.interpolatedAgeEquivalent (cognitive 21) Atria/Atria/AtriaAnalytics.swift:2163 — BiologicalAge.interpolatedAgeEquivalent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (4 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.sendProtectedR10ActivationIfReady (cognitive 21) · ×1
  • AtriaBLEManager.sendProtectedR10ActivationIfReady (cognitive 21) REDACTED:15889 — AtriaBLEManager.sendProtectedR10ActivationIfReady has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 15, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleWorkoutAutoSaveIfRequested (cognitive 21) · ×1
  • AtriaBLEManager.scheduleWorkoutAutoSaveIfRequested (cognitive 21) REDACTED:25051 — AtriaBLEManager.scheduleWorkoutAutoSaveIfRequested has cognitive complexity 21 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (8 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.startReconnectWatchdog (cognitive 21) · ×1
  • AtriaBLEManager.startReconnectWatchdog (cognitive 21) REDACTED:28655 — AtriaBLEManager.startReconnectWatchdog has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.logDataRangeCommandResponse (cognitive 21) · ×1
  • AtriaBLEManager.logDataRangeCommandResponse (cognitive 21) REDACTED:31946 — AtriaBLEManager.logDataRangeCommandResponse has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 4 (5 pts), boolean chains 4, loops 2 (4 pts) (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.shouldAllowProtectedTransportCommand (cognitive 21) · ×1
  • AtriaBLEManager.shouldAllowProtectedTransportCommand (cognitive 21) REDACTED:33336 — AtriaBLEManager.shouldAllowProtectedTransportCommand has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 21. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation (cognitive 21) · ×1
  • AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation (cognitive 21) REDACTED:33671 — AtriaBLEManager.sendHistoryCommandAwaitingWriteConfirmation has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (7 pts), match/switch 1 (3 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart (cognitive 21) · ×1
  • AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart (cognitive 21) REDACTED:36548 — AtriaBLEManager.scheduleGate4DailyBankRearmAfterHistoryStart has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 7, match/switch 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.startSacrificialFastDrainIfNeeded (cognitive 21) · ×1
  • AtriaBLEManager.startSacrificialFastDrainIfNeeded (cognitive 21) REDACTED:40992 — AtriaBLEManager.startSacrificialFastDrainIfNeeded has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (7 pts), error handling 1, loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation (cognitive 21) · ×1
  • AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation (cognitive 21) REDACTED:42190 — AtriaBLEManager.sendReadOnlyHistoryCommandAwaitingConfirmation has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 11, if/else 7 (9 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.handleHistoricalData (cognitive 21) · ×1
  • AtriaBLEManager.handleHistoricalData (cognitive 21) REDACTED:45084 — AtriaBLEManager.handleHistoricalData has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (17 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHistoricalAggregateChunk.validateForCommit (cognitive 21) · ×1
  • AtriaHistoricalAggregateChunk.validateForCommit (cognitive 21) Atria/Atria/AtriaHistoricalAggregateChunk.swift:178 — AtriaHistoricalAggregateChunk.validateForCommit has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 14, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked (cognitive 21) · ×1
  • AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked (cognitive 21) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:257 — AtriaHistoricalCanonicalConsumerApplicationStore.loadCurrentLocked has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 6, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · TransportAuthority.isValid (cognitive 21) · ×1
  • TransportAuthority.isValid (cognitive 21) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:32 — TransportAuthority.isValid has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 21. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.updateConnectionDiagnosisVisibility (cognitive 21) · ×1
  • AtriaHomeView.updateConnectionDiagnosisVisibility (cognitive 21) Atria/Atria/AtriaHomeView.swift:6310 — AtriaHomeView.updateConnectionDiagnosisVisibility has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 6 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaPreparedMetricChart.chartContent (cognitive 21) · ×1
  • AtriaPreparedMetricChart.chartContent (cognitive 21) Atria/Atria/AtriaOverviewSections.swift:7364 — AtriaPreparedMetricChart.chartContent has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (14 pts), ternaries 3 (4 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaRecoveredMotionReplayIdentity.payload (cognitive 21) · ×1
  • AtriaRecoveredMotionReplayIdentity.payload (cognitive 21) Atria/Atria/AtriaRecoveredMotionReplayIdentity.swift:108 — AtriaRecoveredMotionReplayIdentity.payload has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (4 pts), ternaries 1 (3 pts), match/switch 1 (2 pts), boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveryDrivers.make (cognitive 21) · ×1
  • AtriaRecoveryDrivers.make (cognitive 21) Atria/Atria/AtriaRecoveryDrivers.swift:70 — AtriaRecoveryDrivers.make has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (7 pts), boolean chains 2, loops 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressMonitorStore.checkpointHistory (cognitive 21) · ×1
  • AtriaStressMonitorStore.checkpointHistory (cognitive 21) Atria/Atria/AtriaStressMonitor.swift:3738 — AtriaStressMonitorStore.checkpointHistory has cognitive complexity 21 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 6, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaWhoop4CompactIMUAssembler.push (cognitive 21) · ×1
  • AtriaWhoop4CompactIMUAssembler.push (cognitive 21) Atria/Atria/AtriaWhoop4CompactIMU.swift:207 — AtriaWhoop4CompactIMUAssembler.push has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout (cognitive 21) · ×1
  • AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout (cognitive 21) Atria/Atria/AtriaWorkoutPromptEvaluator.swift:346 — AtriaWorkoutPromptEvaluator.lastCompletedSustainedBout has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9 (14 pts), boolean chains 6, loops 1 (nesting depth added 5). Of this number, 17 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.verifiedMetricTimestamps (cognitive 21) · ×1
  • HistoricalArchive.verifiedMetricTimestamps (cognitive 21) Atria/Atria/HistoricalArchive.swift:1679 — HistoricalArchive.verifiedMetricTimestamps has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 13, if/else 7 (8 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.motionBankTransportCoverage (cognitive 21) · ×1
  • HistoricalArchive.motionBankTransportCoverage (cognitive 21) Atria/Atria/HistoricalArchive.swift:4166 — HistoricalArchive.motionBankTransportCoverage has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (7 pts), loops 1, ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaScanRecordParser.parseStringSpan (cognitive 21) · ×1
  • AtriaScanRecordParser.parseStringSpan (cognitive 21) Atria/Atria/HistoricalArchive.swift:11127 — AtriaScanRecordParser.parseStringSpan has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (14 pts), match/switch 2 (6 pts), loops 1 (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.cooperativeStableSort (cognitive 21) · ×1
  • SavedSession.cooperativeStableSort (cognitive 21) Atria/Atria/Sessions.swift:2055 — SavedSession.cooperativeStableSort has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SessionStore.cooperativeStableSort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionStore.requestRecoveredDataRecomputation (cognitive 21) · ×1
  • SessionStore.requestRecoveredDataRecomputation (cognitive 21) Atria/Atria/Sessions.swift:16845 — SessionStore.requestRecoveredDataRecomputation has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (13 pts), ternaries 3 (5 pts), boolean chains 3 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.currentCollectionStatus (cognitive 21) · ×1
  • SessionStore.currentCollectionStatus (cognitive 21) Atria/Atria/Sessions.swift:29554 — SessionStore.currentCollectionStatus has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (10 pts), ternaries 3 (8 pts), boolean chains 3 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.activityCalibrationEvidence (cognitive 21) · ×1
  • SessionStore.activityCalibrationEvidence (cognitive 21) Atria/Atria/Sessions.swift:33282 — SessionStore.activityCalibrationEvidence has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 3 (4 pts), loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.scheduleCurrentCycleSleepReviewAdmission (cognitive 21) · ×1
  • SessionStore.scheduleCurrentCycleSleepReviewAdmission (cognitive 21) Atria/Atria/Sessions.swift:40167 — SessionStore.scheduleCurrentCycleSleepReviewAdmission has cognitive complexity 21 (threshold 15). Drivers by points: if/else 11 (12 pts), ternaries 3 (5 pts), match/switch 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.confirmedMainSleepHRVEvidenceCancellable (cognitive 21) · ×1
  • SessionStore.confirmedMainSleepHRVEvidenceCancellable (cognitive 21) Atria/Atria/Sessions.swift:44567 — SessionStore.confirmedMainSleepHRVEvidenceCancellable has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeBehaviorCorrelationSummaries (cognitive 21) · ×1
  • SessionStore.makeBehaviorCorrelationSummaries (cognitive 21) Atria/Atria/Sessions.swift:47272 — SessionStore.makeBehaviorCorrelationSummaries has cognitive complexity 21 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7, ternaries 4, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.validateHRReferenceFromDocuments (cognitive 21) · ×1
  • SessionStore.validateHRReferenceFromDocuments (cognitive 21) Atria/Atria/Sessions.swift:54321 — SessionStore.validateHRReferenceFromDocuments has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 7 (13 pts), if/else 5 (7 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.cooperativeStableSort (cognitive 21) · ×1
  • SessionStore.cooperativeStableSort (cognitive 21) Atria/Atria/Sessions.swift:56701 — SessionStore.cooperativeStableSort has cognitive complexity 21 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SavedSession.cooperativeStableSort) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaWidget.swift.liveActivityStatusPresentation (cognitive 21) · ×1
  • AtriaWidget.swift.liveActivityStatusPresentation (cognitive 21) Atria/AtriaWidget/AtriaWidget.swift:2024 — AtriaWidget.swift.liveActivityStatusPresentation has cognitive complexity 21 (threshold 15). Drivers by points: ternaries 6 (14 pts), if/else 4 (6 pts), match/switch 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaAddWorkoutSheet.body (cognitive 20) · ×1
  • AtriaAddWorkoutSheet.body (cognitive 20) Atria/Atria/AtriaActivityMonitor.swift:5063 — AtriaAddWorkoutSheet.body has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (14 pts), boolean chains 4, ternaries 2 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.noteLeftoverFlushInbound (cognitive 20) · ×1
  • AtriaBLEManager.noteLeftoverFlushInbound (cognitive 20) REDACTED:8902 — AtriaBLEManager.noteLeftoverFlushInbound has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 5, match/switch 1 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.reassertR10NotificationIfConnected (cognitive 20) · ×1
  • AtriaBLEManager.reassertR10NotificationIfConnected (cognitive 20) REDACTED:9848 — AtriaBLEManager.reassertR10NotificationIfConnected has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (15 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.recoverRRPresenceWatchdog (cognitive 20) · ×1
  • AtriaBLEManager.recoverRRPresenceWatchdog (cognitive 20) REDACTED:26243 — AtriaBLEManager.recoverRRPresenceWatchdog has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (13 pts), boolean chains 4, ternaries 2 (3 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.sendOneShotHistoryTrimCommand (cognitive 20) · ×1
  • AtriaBLEManager.sendOneShotHistoryTrimCommand (cognitive 20) REDACTED:41754 — AtriaBLEManager.sendOneShotHistoryTrimCommand has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 9, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.addRRBatch (cognitive 20) · ×1
  • AtriaBLEManager.addRRBatch (cognitive 20) REDACTED:49908 — AtriaBLEManager.addRRBatch has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.shouldRequestProprietaryBatteryRefresh (cognitive 20) · ×1
  • AtriaBLEManager.shouldRequestProprietaryBatteryRefresh (cognitive 20) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:55 — AtriaBLEManager.shouldRequestProprietaryBatteryRefresh has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 15, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBackgroundProjectionThrottle.checkpointShouldAbort (cognitive 20) · ×1
  • AtriaBackgroundProjectionThrottle.checkpointShouldAbort (cognitive 20) Atria/Atria/AtriaBackgroundProjectionThrottle.swift:219 — AtriaBackgroundProjectionThrottle.checkpointShouldAbort has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 6, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBackupCompression.decodeRawDeflate (cognitive 20) · ×1
  • AtriaBackupCompression.decodeRawDeflate (cognitive 20) Atria/Atria/AtriaBackupCompression.swift:150 — AtriaBackupCompression.decodeRawDeflate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 3, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalConsumerReceiptLedger.validatedReceipt (cognitive 20) · ×1
  • AtriaHistoricalConsumerReceiptLedger.validatedReceipt (cognitive 20) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:525 — AtriaHistoricalConsumerReceiptLedger.validatedReceipt has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 17, if/else 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.stageMetricUsableRows (cognitive 20) · ×1
  • AtriaHistoricalGapLedger.stageMetricUsableRows (cognitive 20) Atria/Atria/AtriaHistoricalGapLedger.swift:527 — AtriaHistoricalGapLedger.stageMetricUsableRows has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.commitResolvedWindow (cognitive 20) · ×1
  • AtriaHistoricalGapLedger.commitResolvedWindow (cognitive 20) Atria/Atria/AtriaHistoricalGapLedger.swift:756 — AtriaHistoricalGapLedger.commitResolvedWindow has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, if/else 5 (6 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded (cognitive 20) · ×1
  • AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded (cognitive 20) Atria/Atria/AtriaHomeView.swift:12648 — AtriaHomeModel.publishFrozenSceneIdleLiveActivityIfNeeded has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 8, boolean chains 7, if/else 5. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaHomeModel.nextLiveSessionDerived (cognitive 20) · ×1
  • AtriaHomeModel.nextLiveSessionDerived (cognitive 20) Atria/Atria/AtriaHomeView.swift:13816 — AtriaHomeModel.nextLiveSessionDerived has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (9 pts), loops 1, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaLiveWorkoutTRIMPAccumulator.exclusionsAddCoverage (cognitive 20) · ×1
  • AtriaLiveWorkoutTRIMPAccumulator.exclusionsAddCoverage (cognitive 20) Atria/Atria/AtriaLiveWorkoutView.swift:728 — AtriaLiveWorkoutTRIMPAccumulator.exclusionsAddCoverage has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (16 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaPendingWorkoutIntentStore.persistTerminalLocked (cognitive 20) · ×1
  • AtriaPendingWorkoutIntentStore.persistTerminalLocked (cognitive 20) Atria/Atria/AtriaLiveWorkoutView.swift:1354 — AtriaPendingWorkoutIntentStore.persistTerminalLocked has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts), ternaries 2, loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaPhysiologicalStressModel.qualifiedRMSSD (cognitive 20) · ×1
  • AtriaPhysiologicalStressModel.qualifiedRMSSD (cognitive 20) Atria/Atria/AtriaPhysiologicalStressModel.swift:561 — AtriaPhysiologicalStressModel.qualifiedRMSSD has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 5 (9 pts), loops 1 (nesting depth added 4). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaSensorReferenceEntry.init (cognitive 20) · ×1
  • AtriaSensorReferenceEntry.init (cognitive 20) Atria/Atria/AtriaSensorReferenceCapture.swift:62 — AtriaSensorReferenceEntry.init has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), ternaries 4 (5 pts), boolean chains 3, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSleepCooperativeAlgorithms.stableSort (cognitive 20) · ×1
  • AtriaSleepCooperativeAlgorithms.stableSort (cognitive 20) Atria/Atria/AtriaSleepWakeResearch.swift:57 — AtriaSleepCooperativeAlgorithms.stableSort has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTodayScreen.glanceItem (cognitive 20) · ×1
  • AtriaTodayScreen.glanceItem (cognitive 20) Atria/Atria/AtriaTodayScreen.swift:2960 — AtriaTodayScreen.glanceItem has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (18 pts), boolean chains 1, match/switch 1 (nesting depth added 9). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaTrendChartCard.preparePeriodReadout (cognitive 20) · ×1
  • AtriaTrendChartCard.preparePeriodReadout (cognitive 20) Atria/Atria/AtriaTrendChart.swift:409 — AtriaTrendChartCard.preparePeriodReadout has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 4 (10 pts), if/else 3 (6 pts), boolean chains 3, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4FusedStepEstimator.estimate (cognitive 20) · ×1
  • AtriaWhoop4FusedStepEstimator.estimate (cognitive 20) Atria/Atria/AtriaWhoop4FusedStepEstimator.swift:56 — AtriaWhoop4FusedStepEstimator.estimate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 4 (9 pts), boolean chains 2 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.subtracting (cognitive 20) · ×1
  • AtriaWhoop4MotionTickCompactStore.subtracting (cognitive 20) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2166 — AtriaWhoop4MotionTickCompactStore.subtracting has cognitive complexity 20 (threshold 15). Drivers by points: if/else 4 (13 pts), loops 3 (6 pts), boolean chains 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DailyRecoveryResolver.summary (cognitive 20) · ×1
  • DailyRecoveryResolver.summary (cognitive 20) Atria/Atria/DailyRollupStore.swift:427 — DailyRecoveryResolver.summary has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (8 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HealthKitExporter.fetchNutritionSummary (cognitive 20) · ×1
  • HealthKitExporter.fetchNutritionSummary (cognitive 20) Atria/Atria/HealthKitExporter.swift:233 — HealthKitExporter.fetchNutritionSummary has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (15 pts), ternaries 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HealthKitExporter.healthSamples (cognitive 20) · ×1
  • HealthKitExporter.healthSamples (cognitive 20) Atria/Atria/HealthKitExporter.swift:2055 — HealthKitExporter.healthSamples has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 14, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · LocalNotificationScheduler.scheduleActionableConnectionDiagnosis (cognitive 20) · ×1
  • LocalNotificationScheduler.scheduleActionableConnectionDiagnosis (cognitive 20) Atria/Atria/LocalNotificationScheduler.swift:814 — LocalNotificationScheduler.scheduleActionableConnectionDiagnosis has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4, ternaries 1 (3 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StrainPresentation.resolve (cognitive 20) · ×1
  • StrainPresentation.resolve (cognitive 20) Atria/Atria/Metrics.swift:258 — StrainPresentation.resolve has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 9, if/else 7, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SavedSession.hrRRDisagreesWithReportedHR (cognitive 20) · ×1
  • SavedSession.hrRRDisagreesWithReportedHR (cognitive 20) Atria/Atria/Sessions.swift:7537 — SavedSession.hrRRDisagreesWithReportedHR has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SavedSession.workoutPrimaryBlocker (cognitive 20) · ×1
  • SavedSession.workoutPrimaryBlocker (cognitive 20) Atria/Atria/Sessions.swift:8238 — SavedSession.workoutPrimaryBlocker has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 10, if/else 10. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.recoveredWorkoutEvidenceIsStronger (cognitive 20) · ×1
  • SessionStore.recoveredWorkoutEvidenceIsStronger (cognitive 20) Atria/Atria/Sessions.swift:35939 — SessionStore.recoveredWorkoutEvidenceIsStronger has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 19, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.autoSleepClassification (cognitive 20) · ×1
  • SessionStore.autoSleepClassification (cognitive 20) Atria/Atria/Sessions.swift:42286 — SessionStore.autoSleepClassification has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 11, if/else 6 (7 pts), ternaries 1 (2 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.normalizingDayPrimaryChoices (cognitive 20) · ×1
  • SessionStore.normalizingDayPrimaryChoices (cognitive 20) Atria/Atria/Sessions.swift:45119 — SessionStore.normalizingDayPrimaryChoices has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 4, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.motionQuiescenceRefinedBounds (cognitive 20) · ×1
  • SessionStore.motionQuiescenceRefinedBounds (cognitive 20) Atria/Atria/Sessions.swift:49726 — SessionStore.motionQuiescenceRefinedBounds has cognitive complexity 20 (threshold 15). Drivers by points: if/else 25 (49 pts), boolean chains 11, loops 8, match/switch 3 (5 pts), ternaries 1 (3 pts) (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. This shape REPEATS in the file: one other method here (SessionStore.motionQuiescenceRefinedBounds::boundaryEvents) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionStore.logDeepDailyRollupDiagnostics (cognitive 20) · ×1
  • SessionStore.logDeepDailyRollupDiagnostics (cognitive 20) Atria/Atria/Sessions.swift:53288 — SessionStore.logDeepDailyRollupDiagnostics has cognitive complexity 20 (threshold 15). Drivers by points: ternaries 9 (16 pts), loops 4 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded (cognitive 20) · ×1
  • SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded (cognitive 20) Atria/Atria/Sessions.swift:58076 — SessionStore.requalifyPersistedConfirmedSleepHRVFromSessionsIfNeeded has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, ternaries 3, loops 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaWidgetProvider.getTimeline (cognitive 20) · ×1
  • AtriaWidgetProvider.getTimeline (cognitive 20) Atria/AtriaWidget/AtriaWidget.swift:516 — AtriaWidgetProvider.getTimeline has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ActiveSessionJournal.saveLocked (cognitive 19) · ×1
  • ActiveSessionJournal.saveLocked (cognitive 19) Atria/Atria/ActiveSessionJournal.swift:694 — ActiveSessionJournal.saveLocked has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (14 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · ActiveSessionJournal.replaying (cognitive 19) · ×1
  • ActiveSessionJournal.replaying (cognitive 19) Atria/Atria/ActiveSessionJournal.swift:1050 — ActiveSessionJournal.replaying has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 3 (5 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TargetZones.restingHeartRate (cognitive 19) · ×1
  • TargetZones.restingHeartRate (cognitive 19) Atria/Atria/AtriaAnalytics.swift:306 — TargetZones.restingHeartRate has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 8, ternaries 5 (7 pts), if/else 3, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Recovery.sleepMissingEstimate (cognitive 19) · ×1
  • Recovery.sleepMissingEstimate (cognitive 19) Atria/Atria/AtriaAnalytics.swift:1756 — Recovery.sleepMissingEstimate has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9, boolean chains 6, if/else 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaAppDependencies.init (cognitive 19) · ×1
  • AtriaAppDependencies.init (cognitive 19) Atria/Atria/AtriaApp.swift:114 — AtriaAppDependencies.init has cognitive complexity 19 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 5 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.reassertHeartRateNotificationsIfConnected (cognitive 19) · ×1
  • AtriaBLEManager.reassertHeartRateNotificationsIfConnected (cognitive 19) REDACTED:9771 — AtriaBLEManager.reassertHeartRateNotificationsIfConnected has cognitive complexity 19 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded (cognitive 19) · ×1
  • AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded (cognitive 19) REDACTED:11463 — AtriaBLEManager.resumePendingForcedHistoricalSyncAfterLivePersistenceIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 4. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady (cognitive 19) · ×1
  • AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady (cognitive 19) REDACTED:15393 — AtriaBLEManager.sendMotionHandshakeR10IMUSequenceIfReady has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 12, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleHRContinuityWatchdogIfNeeded (cognitive 19) · ×1
  • AtriaBLEManager.scheduleHRContinuityWatchdogIfNeeded (cognitive 19) REDACTED:25722 — AtriaBLEManager.scheduleHRContinuityWatchdogIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 6, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.reconcileCentralUnavailableRecovery (cognitive 19) · ×1
  • AtriaBLEManager.reconcileCentralUnavailableRecovery (cognitive 19) REDACTED:29982 — AtriaBLEManager.reconcileCentralUnavailableRecovery has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateR10Liveness (cognitive 19) · ×1
  • AtriaBLEManager.evaluateR10Liveness (cognitive 19) REDACTED:34931 — AtriaBLEManager.evaluateR10Liveness has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 8, match/switch 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.startReadOnlyClockProbeIfNeeded (cognitive 19) · ×1
  • AtriaBLEManager.startReadOnlyClockProbeIfNeeded (cognitive 19) REDACTED:42460 — AtriaBLEManager.startReadOnlyClockProbeIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.finishStrapStepLedgerSave (cognitive 19) · ×1
  • AtriaBLEManager.finishStrapStepLedgerSave (cognitive 19) REDACTED:51950 — AtriaBLEManager.finishStrapStepLedgerSave has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), ternaries 2 (5 pts), match/switch 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHealthScreen.reduceStressStrip (cognitive 19) · ×1
  • AtriaHealthScreen.reduceStressStrip (cognitive 19) Atria/Atria/AtriaHealthScreen.swift:2083 — AtriaHealthScreen.reduceStressStrip has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (4 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullScanCompletionStore.validate (cognitive 19) · ×1
  • AtriaHistoricalFullScanCompletionStore.validate (cognitive 19) Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:302 — AtriaHistoricalFullScanCompletionStore.validate has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 18, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalJSONLRecentScanner.unsignedInteger (cognitive 19) · ×1
  • AtriaHistoricalJSONLRecentScanner.unsignedInteger (cognitive 19) Atria/Atria/AtriaHistoricalJSONLRecentScanner.swift:340 — AtriaHistoricalJSONLRecentScanner.unsignedInteger has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (6 pts), loops 3, ternaries 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.presentConnectionGuideIfNeeded (cognitive 19) · ×1
  • AtriaHomeView.presentConnectionGuideIfNeeded (cognitive 19) Atria/Atria/AtriaHomeView.swift:6635 — AtriaHomeView.presentConnectionGuideIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 10, if/else 4, ternaries 2 (4 pts), match/switch 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaMissedDataBannerPresentation.copy (cognitive 19) · ×1
  • AtriaMissedDataBannerPresentation.copy (cognitive 19) Atria/Atria/AtriaHomeView.swift:7754 — AtriaMissedDataBannerPresentation.copy has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded (cognitive 19) · ×1
  • AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded (cognitive 19) Atria/Atria/AtriaHomeView.swift:12584 — AtriaHomeModel.publishFrozenSceneWidgetPatchIfNeeded has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9, boolean chains 6, if/else 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaLiveActivityCoordinator.holdingLastKnownWorkoutMetrics (cognitive 19) · ×1
  • AtriaLiveActivityCoordinator.holdingLastKnownWorkoutMetrics (cognitive 19) Atria/Atria/AtriaLiveActivityCoordinator.swift:514 — AtriaLiveActivityCoordinator.holdingLastKnownWorkoutMetrics has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 7, ternaries 1 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWeeklyReportSheet.heroText (cognitive 19) · ×1
  • AtriaWeeklyReportSheet.heroText (cognitive 19) Atria/Atria/AtriaOverviewSections.swift:1910 — AtriaWeeklyReportSheet.heroText has cognitive complexity 19 (threshold 15). Drivers by points: if/else 14 (17 pts), boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaStrapGaitQualityChallenger.ingest (cognitive 19) · ×1
  • AtriaStrapGaitQualityChallenger.ingest (cognitive 19) Atria/Atria/AtriaR10Motion.swift:888 — AtriaStrapGaitQualityChallenger.ingest has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutShareSnapshot.routePreviewPoints (cognitive 19) · ×1
  • AtriaWorkoutShareSnapshot.routePreviewPoints (cognitive 19) Atria/Atria/AtriaShareCard.swift:185 — AtriaWorkoutShareSnapshot.routePreviewPoints has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 3 (6 pts), boolean chains 2 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStepCalibrationSequenceCard.stageStateHeadline (cognitive 19) · ×1
  • AtriaStepCalibrationSequenceCard.stageStateHeadline (cognitive 19) Atria/Atria/AtriaStepCalibrationPlan.swift:383 — AtriaStepCalibrationSequenceCard.stageStateHeadline has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 6 (7 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalStressReplay.snapshot (cognitive 19) · ×1
  • AtriaHistoricalStressReplay.snapshot (cognitive 19) Atria/Atria/AtriaStressMonitor.swift:1600 — AtriaHistoricalStressReplay.snapshot has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 6, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.append (cognitive 19) · ×1
  • AtriaWhoop4MotionTickCompactStore.append (cognitive 19) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:264 — AtriaWhoop4MotionTickCompactStore.append has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 15, if/else 3, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickDailyStore.saveValidated (cognitive 19) · ×1
  • AtriaWhoop4MotionTickDailyStore.saveValidated (cognitive 19) Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:230 — AtriaWhoop4MotionTickDailyStore.saveValidated has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4GravityCadenceStepModel.strapMotionContinues (cognitive 19) · ×1
  • AtriaWhoop4GravityCadenceStepModel.strapMotionContinues (cognitive 19) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1604 — AtriaWhoop4GravityCadenceStepModel.strapMotionContinues has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ContentView.body (cognitive 19) · ×1
  • ContentView.body (cognitive 19) Atria/Atria/ContentView.swift:53 — ContentView.body has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 1 (2 pts), boolean chains 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.prunedRecoveredCache (cognitive 19) · ×1
  • HistoricalArchive.prunedRecoveredCache (cognitive 19) Atria/Atria/HistoricalArchive.swift:6927 — HistoricalArchive.prunedRecoveredCache has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 4, loops 2, ternaries 1 (nesting depth added 4). Of this number, 12 points are the body's own statements and 7 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.sealedCatalogBoundIsDurablyTrusted (cognitive 19) · ×1
  • HistoricalArchive.sealedCatalogBoundIsDurablyTrusted (cognitive 19) Atria/Atria/HistoricalArchive.swift:8572 — HistoricalArchive.sealedCatalogBoundIsDurablyTrusted has cognitive complexity 19 (threshold 15). Drivers by points: boolean chains 18, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaScanRecordParser.parseIntegerExactly (cognitive 19) · ×1
  • AtriaScanRecordParser.parseIntegerExactly (cognitive 19) Atria/Atria/HistoricalArchive.swift:11262 — AtriaScanRecordParser.parseIntegerExactly has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalNotificationScheduler.add (cognitive 19) · ×1
  • LocalNotificationScheduler.add (cognitive 19) Atria/Atria/LocalNotificationScheduler.swift:2188 — LocalNotificationScheduler.add has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 5, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaConfirmedRecordWriter.write (cognitive 19) · ×1
  • AtriaConfirmedRecordWriter.write (cognitive 19) Atria/Atria/Sessions.swift:7018 — AtriaConfirmedRecordWriter.write has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), error handling 2 (4 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SessionStore.mergedAutomaticallyRecoveredHeartRatePointsCancellable (cognitive 19) · ×1
  • SessionStore.mergedAutomaticallyRecoveredHeartRatePointsCancellable (cognitive 19) Atria/Atria/Sessions.swift:16595 — SessionStore.mergedAutomaticallyRecoveredHeartRatePointsCancellable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 3 (5 pts), loops 3 (5 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.logGateETrainingDiagnostics (cognitive 19) · ×1
  • SessionStore.logGateETrainingDiagnostics (cognitive 19) Atria/Atria/Sessions.swift:31837 — SessionStore.logGateETrainingDiagnostics has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 3, boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.confirmMetadataOnlyWorkout (cognitive 19) · ×1
  • SessionStore.confirmMetadataOnlyWorkout (cognitive 19) Atria/Atria/Sessions.swift:34589 — SessionStore.confirmMetadataOnlyWorkout has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 10, if/else 5 (8 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.confirmSleepWindow (cognitive 19) · ×1
  • SessionStore.confirmSleepWindow (cognitive 19) Atria/Atria/Sessions.swift:42634 — SessionStore.confirmSleepWindow has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9, boolean chains 6, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.cooperativeSustainedAwakeSeconds (cognitive 19) · ×1
  • SessionStore.cooperativeSustainedAwakeSeconds (cognitive 19) Atria/Atria/Sessions.swift:51549 — SessionStore.cooperativeSustainedAwakeSeconds has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.verifyLatestSessionBackup (cognitive 19) · ×1
  • SessionStore.verifyLatestSessionBackup (cognitive 19) Atria/Atria/Sessions.swift:55106 — SessionStore.verifyLatestSessionBackup has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 7 (14 pts), boolean chains 3, error handling 1, if/else 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.splitShortPreludeFromDenseSleepCluster (cognitive 19) · ×1
  • SessionStore.splitShortPreludeFromDenseSleepCluster (cognitive 19) Atria/Atria/Sessions.swift:56478 — SessionStore.splitShortPreludeFromDenseSleepCluster has cognitive complexity 19 (threshold 15). Drivers by points: if/else 4 (6 pts), boolean chains 5, loops 3 (4 pts), ternaries 2 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.seedBaselineFromConfirmedSleepsCancellable (cognitive 19) · ×1
  • SessionStore.seedBaselineFromConfirmedSleepsCancellable (cognitive 19) Atria/Atria/Sessions.swift:58619 — SessionStore.seedBaselineFromConfirmedSleepsCancellable has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 4, ternaries 2 (3 pts), loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_hrv.read_reference_rr (cognitive 19) · ×1
  • validate_hrv.read_reference_rr (cognitive 19) validate_hrv.py:194 — validate_hrv.read_reference_rr has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 4 (6 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ActiveSessionJournal.applying (cognitive 18) · ×1
  • ActiveSessionJournal.applying (cognitive 18) Atria/Atria/ActiveSessionJournal.swift:885 — ActiveSessionJournal.applying has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaActivityTimelineSignalProjection.selectRealSamples (cognitive 18) · ×1
  • AtriaActivityTimelineSignalProjection.selectRealSamples (cognitive 18) Atria/Atria/AtriaActivityMonitor.swift:1426 — AtriaActivityTimelineSignalProjection.selectRealSamples has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaActivityTimelineMarkerProjection.nonOverlappingSlices (cognitive 18) · ×1
  • AtriaActivityTimelineMarkerProjection.nonOverlappingSlices (cognitive 18) Atria/Atria/AtriaActivityMonitor.swift:1481 — AtriaActivityTimelineMarkerProjection.nonOverlappingSlices has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 3 (5 pts), ternaries 1 (3 pts), boolean chains 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TargetZones.hrv (cognitive 18) · ×1
  • TargetZones.hrv (cognitive 18) Atria/Atria/AtriaAnalytics.swift:256 — TargetZones.hrv has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, ternaries 4 (6 pts), if/else 3, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEHistoryRequestAuthorityStore.loadStateLocked (cognitive 18) · ×1
  • AtriaBLEHistoryRequestAuthorityStore.loadStateLocked (cognitive 18) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:257 — AtriaBLEHistoryRequestAuthorityStore.loadStateLocked has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (8 pts), error handling 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.sendOnboardingPairingPreflightRange (cognitive 18) · ×1
  • AtriaBLEManager.sendOnboardingPairingPreflightRange (cognitive 18) REDACTED:14889 — AtriaBLEManager.sendOnboardingPairingPreflightRange has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 4 (6 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.armOfflineHistoricalSyncIdleWatchdog (cognitive 18) · ×1
  • AtriaBLEManager.armOfflineHistoricalSyncIdleWatchdog (cognitive 18) REDACTED:18404 — AtriaBLEManager.armOfflineHistoricalSyncIdleWatchdog has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.requestFreshScanReconnect (cognitive 18) · ×1
  • AtriaBLEManager.requestFreshScanReconnect (cognitive 18) REDACTED:23996 — AtriaBLEManager.requestFreshScanReconnect has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 5 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.rebuildCentralForWedgedSessionOnce (cognitive 18) · ×1
  • AtriaBLEManager.rebuildCentralForWedgedSessionOnce (cognitive 18) REDACTED:29611 — AtriaBLEManager.rebuildCentralForWedgedSessionOnce has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 5, boolean chains 2 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.workoutMotionLeaseAction (cognitive 18) · ×1
  • AtriaBLEManager.workoutMotionLeaseAction (cognitive 18) REDACTED:35149 — AtriaBLEManager.workoutMotionLeaseAction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.heartRateContinuityRecoveryDisposition (cognitive 18) · ×1
  • AtriaBLEManager.heartRateContinuityRecoveryDisposition (cognitive 18) Atria/Atria/AtriaBLEHeartRateRecoveryPolicy.swift:466 — AtriaBLEManager.heartRateContinuityRecoveryDisposition has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 6, ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.shouldFinishIdleWindowHistoryDrainAtACKBoundary (cognitive 18) · ×1
  • AtriaBLEManager.shouldFinishIdleWindowHistoryDrainAtACKBoundary (cognitive 18) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:1049 — AtriaBLEManager.shouldFinishIdleWindowHistoryDrainAtACKBoundary has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition (cognitive 18) · ×1
  • AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition (cognitive 18) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:2590 — AtriaBLEManager.connectedRawHistoryCatchUpContinuationDisposition has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 4. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaHealthScreen.sleepDetailCard (cognitive 18) · ×1
  • AtriaHealthScreen.sleepDetailCard (cognitive 18) Atria/Atria/AtriaHealthScreen.swift:1230 — AtriaHealthScreen.sleepDetailCard has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), ternaries 5 (6 pts), boolean chains 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaSleepConsistencyStrip.body (cognitive 18) · ×1
  • AtriaSleepConsistencyStrip.body (cognitive 18) Atria/Atria/AtriaHealthScreen.swift:3674 — AtriaSleepConsistencyStrip.body has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (11 pts), ternaries 3 (5 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalAggregateBuilder.buildMotionEpochs (cognitive 18) · ×1
  • AtriaHistoricalAggregateBuilder.buildMotionEpochs (cognitive 18) Atria/Atria/AtriaHistoricalAggregateBuilder.swift:389 — AtriaHistoricalAggregateBuilder.buildMotionEpochs has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 8, ternaries 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage (cognitive 18) · ×1
  • AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage (cognitive 18) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:751 — AtriaHistoricalArchiveCatalogStore.verifyCompressedStorage has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, if/else 2, error handling 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalArchiveDurableStore.compactIdentityIndexOutsideHorizonLocked (cognitive 18) · ×1
  • AtriaHistoricalArchiveDurableStore.compactIdentityIndexOutsideHorizonLocked (cognitive 18) Atria/Atria/AtriaHistoricalArchiveDurableStore.swift:1039 — AtriaHistoricalArchiveDurableStore.compactIdentityIndexOutsideHorizonLocked has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8, loops 2 (5 pts), boolean chains 3, error handling 1, ternaries 1 (nesting depth added 3). Of this number, 12 points are the body's own statements and 6 belong to 2 function items inside it that branch. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload (cognitive 18) · ×1
  • AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload (cognitive 18) Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:309 — AtriaHistoricalCanonicalConsumerDestinationStore.retireReplayPayload has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.recordMatchingACK (cognitive 18) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordMatchingACK (cognitive 18) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:370 — AtriaHistoricalFullDrainCoverageStore.recordMatchingACK has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 8 (9 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalHighVolumeStorageAccounting.measure (cognitive 18) · ×1
  • AtriaHistoricalHighVolumeStorageAccounting.measure (cognitive 18) Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:105 — AtriaHistoricalHighVolumeStorageAccounting.measure has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (13 pts), error handling 2 (3 pts), boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalLiveIdentityLookup.lookup (cognitive 18) · ×1
  • AtriaHistoricalLiveIdentityLookup.lookup (cognitive 18) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:153 — AtriaHistoricalLiveIdentityLookup.lookup has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaLearnedInsights.insights (cognitive 18) · ×1
  • AtriaLearnedInsights.insights (cognitive 18) Atria/Atria/AtriaLearnedInsights.swift:236 — AtriaLearnedInsights.insights has cognitive complexity 18 (threshold 15). Drivers by points: if/else 16, boolean chains 1, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaTodaySleepReviewProjectionState.preferredReview (cognitive 18) · ×1
  • AtriaTodaySleepReviewProjectionState.preferredReview (cognitive 18) Atria/Atria/AtriaOverviewSections.swift:695 — AtriaTodaySleepReviewProjectionState.preferredReview has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 5, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit (cognitive 18) · ×1
  • AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit (cognitive 18) Atria/Atria/AtriaPersistedWorkoutStrainRescorer.swift:46 — AtriaPersistedWorkoutStrainRescorer.matchingVerifiedAudit has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · StreamingDetector.processCandidate (cognitive 18) · ×1
  • StreamingDetector.processCandidate (cognitive 18) Atria/Atria/AtriaR10Motion.swift:281 — StreamingDetector.processCandidate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (17 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStressPresentation.make (cognitive 18) · ×1
  • AtriaStressPresentation.make (cognitive 18) Atria/Atria/AtriaStressMonitor.swift:206 — AtriaStressPresentation.make has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 5 (14 pts), if/else 2 (3 pts), match/switch 1 (nesting depth added 10). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaTodaySessionState.== (cognitive 18) · ×1
  • AtriaTodaySessionState.== (cognitive 18) Atria/Atria/AtriaTodayScreen.swift:89 — AtriaTodaySessionState.== has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 18. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaTrendActionReadout.init (cognitive 18) · ×1
  • AtriaTrendActionReadout.init (cognitive 18) Atria/Atria/AtriaTrendChart.swift:1357 — AtriaTrendActionReadout.init has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (6 pts), ternaries 2 (6 pts), match/switch 3 (5 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt (cognitive 18) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt (cognitive 18) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:427 — AtriaWhoop4HistoryAdmissionLedger.markCurrentPrefixArchiveDurableWithReceipt has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 6, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWorkoutOnset.firstSustainedElevatedOnset (cognitive 18) · ×1
  • AtriaWorkoutOnset.firstSustainedElevatedOnset (cognitive 18) Atria/Atria/AtriaWorkoutOnset.swift:13 — AtriaWorkoutOnset.firstSustainedElevatedOnset has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 3, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative (cognitive 18) · ×1
  • DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative (cognitive 18) Atria/Atria/DailyRollupStore.swift:554 — DailyRecoveryResolver.limitedFallbackMetricIsStructurallyAuthoritative has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HealthKitExporter.queryHeartRateReferenceSamples (cognitive 18) · ×1
  • HealthKitExporter.queryHeartRateReferenceSamples (cognitive 18) Atria/Atria/HealthKitExporter.swift:1875 — HealthKitExporter.queryHeartRateReferenceSamples has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), ternaries 6, boolean chains 1, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.promoteMetricUsableRows (cognitive 18) · ×1
  • HistoricalArchive.promoteMetricUsableRows (cognitive 18) Atria/Atria/HistoricalArchive.swift:3331 — HistoricalArchive.promoteMetricUsableRows has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (2 pts), error handling 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow (cognitive 18) · ×1
  • HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow (cognitive 18) Atria/Atria/HistoricalArchive.swift:8539 — HistoricalArchive.sealedCatalogBoundIsDurablyTrustedOutsideWindow has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 17, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaSleepStageIntegrity.validates (cognitive 18) · ×1
  • AtriaSleepStageIntegrity.validates (cognitive 18) Atria/Atria/Sessions.swift:4157 — AtriaSleepStageIntegrity.validates has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (6 pts), loops 2 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.appendingRecoveredExecutionDiagnosticEvent (cognitive 18) · ×1
  • SessionStore.appendingRecoveredExecutionDiagnosticEvent (cognitive 18) Atria/Atria/Sessions.swift:11009 — SessionStore.appendingRecoveredExecutionDiagnosticEvent has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 13, if/else 3, ternaries 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.makeTrainingLoadSummaryCancellable (cognitive 18) · ×1
  • SessionStore.makeTrainingLoadSummaryCancellable (cognitive 18) Atria/Atria/Sessions.swift:20728 — SessionStore.makeTrainingLoadSummaryCancellable has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (10 pts), loops 2 (3 pts), ternaries 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeWorkoutReviewCandidateForCache (cognitive 18) · ×1
  • SessionStore.makeWorkoutReviewCandidateForCache (cognitive 18) Atria/Atria/Sessions.swift:33001 — SessionStore.makeWorkoutReviewCandidateForCache has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 10, if/else 5, ternaries 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.activeWorkoutPointProjection (cognitive 18) · ×1
  • SessionStore.activeWorkoutPointProjection (cognitive 18) Atria/Atria/Sessions.swift:35669 — SessionStore.activeWorkoutPointProjection has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 2, loops 2, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.sustainedAwakeEvidenceExists (cognitive 18) · ×1
  • SessionStore.sustainedAwakeEvidenceExists (cognitive 18) Atria/Atria/Sessions.swift:37758 — SessionStore.sustainedAwakeEvidenceExists has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 3, loops 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.prepareWakeBoundarySleep (cognitive 18) · ×1
  • SessionStore.prepareWakeBoundarySleep (cognitive 18) Atria/Atria/Sessions.swift:41626 — SessionStore.prepareWakeBoundarySleep has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 7, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.shouldSplitPostWakeNap (cognitive 18) · ×1
  • SessionStore.shouldSplitPostWakeNap (cognitive 18) Atria/Atria/Sessions.swift:56608 — SessionStore.shouldSplitPostWakeNap has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 11, if/else 6, loops 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoryView.debugFixtureHistorySnapshot (cognitive 18) · ×1
  • HistoryView.debugFixtureHistorySnapshot (cognitive 18) Atria/Atria/Sessions.swift:59138 — HistoryView.debugFixtureHistorySnapshot has cognitive complexity 18 (threshold 15). Drivers by points: ternaries 12, boolean chains 4, if/else 2. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.resolvedPresentedWidgetStrain (cognitive 18) · ×1
  • WidgetSnapshotPublisher.resolvedPresentedWidgetStrain (cognitive 18) Atria/Atria/WidgetSnapshot.swift:1379 — WidgetSnapshotPublisher.resolvedPresentedWidgetStrain has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 9, if/else 7 (9 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaActivityMonitorTab.debugWorkoutDetailFixture (cognitive 17) · ×1
  • AtriaActivityMonitorTab.debugWorkoutDetailFixture (cognitive 17) Atria/Atria/AtriaActivityMonitor.swift:1854 — AtriaActivityMonitorTab.debugWorkoutDetailFixture has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 13, if/else 3, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.discoveryServicesForCurrentMode (cognitive 17) · ×1
  • AtriaBLEManager.discoveryServicesForCurrentMode (cognitive 17) REDACTED:5565 — AtriaBLEManager.discoveryServicesForCurrentMode has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch (cognitive 17) · ×1
  • AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch (cognitive 17) REDACTED:6132 — AtriaBLEManager.beginProtectedR10BringUpForCurrentEpoch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10, boolean chains 7. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded (cognitive 17) · ×1
  • AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded (cognitive 17) REDACTED:18259 — AtriaBLEManager.releaseConnectedHistoricalSliceIfNeeded has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, if/else 6, ternaries 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.observeIdleWindowPostACKRangeProbe (cognitive 17) · ×1
  • AtriaBLEManager.observeIdleWindowPostACKRangeProbe (cognitive 17) REDACTED:18731 — AtriaBLEManager.observeIdleWindowPostACKRangeProbe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 1 (2 pts), ternaries 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.preserveLongWearRangeLossRecovery (cognitive 17) · ×1
  • AtriaBLEManager.preserveLongWearRangeLossRecovery (cognitive 17) REDACTED:20934 — AtriaBLEManager.preserveLongWearRangeLossRecovery has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 5, boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue (cognitive 17) · ×1
  • AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue (cognitive 17) REDACTED:21418 — AtriaBLEManager.maintenanceTickRangeLossBackfillReArmIfDue has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 5 (6 pts), 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.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateAdaptiveAutoCapture (cognitive 17) · ×1
  • AtriaBLEManager.evaluateAdaptiveAutoCapture (cognitive 17) REDACTED:27047 — AtriaBLEManager.evaluateAdaptiveAutoCapture has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 6, ternaries 2 (4 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.endAcceptedHeartRateBatch (cognitive 17) · ×1
  • AtriaBLEManager.endAcceptedHeartRateBatch (cognitive 17) REDACTED:31351 — AtriaBLEManager.endAcceptedHeartRateBatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14 (16 pts), boolean chains 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded (cognitive 17) · ×1
  • AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded (cognitive 17) REDACTED:33772 — AtriaBLEManager.scheduleProprietaryArmFallbackIfNeeded has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, boolean chains 2, ternaries 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.sendSacrificialFastDrainCommand (cognitive 17) · ×1
  • AtriaBLEManager.sendSacrificialFastDrainCommand (cognitive 17) REDACTED:41392 — AtriaBLEManager.sendSacrificialFastDrainCommand has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.maybeRequestProprietaryBatteryRefresh (cognitive 17) · ×1
  • AtriaBLEManager.maybeRequestProprietaryBatteryRefresh (cognitive 17) REDACTED:44191 — AtriaBLEManager.maybeRequestProprietaryBatteryRefresh has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.processOrderedHistoryMetadata (cognitive 17) · ×1
  • AtriaBLEManager.processOrderedHistoryMetadata (cognitive 17) REDACTED:44803 — AtriaBLEManager.processOrderedHistoryMetadata has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 4 (9 pts), if/else 3 (5 pts), boolean chains 1, error handling 1, match/switch 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.completeSessionBoundary (cognitive 17) · ×1
  • AtriaBLEManager.completeSessionBoundary (cognitive 17) REDACTED:50517 — AtriaBLEManager.completeSessionBoundary has cognitive complexity 17 (threshold 15). Drivers by points: if/else 14, ternaries 1 (2 pts), boolean chains 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff (cognitive 17) · ×1
  • AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff (cognitive 17) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:3062 — AtriaBLEManager.shouldAttemptAutomaticConnectedHistoricalHandoff has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 12, if/else 4 (5 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.parseFastRealtimeProprietaryPacket (cognitive 17) · ×1
  • AtriaBLEManager.parseFastRealtimeProprietaryPacket (cognitive 17) REDACTED:57744 — AtriaBLEManager.parseFastRealtimeProprietaryPacket has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 4, loops 1 (2 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.batteryLevelAcceptanceDecision (cognitive 17) · ×1
  • AtriaBLEManager.batteryLevelAcceptanceDecision (cognitive 17) Atria/Atria/AtriaStrapPowerPolicy.swift:70 — AtriaBLEManager.batteryLevelAcceptanceDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (11 pts), boolean chains 6 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHistoricalAggregateReader.loadCommittedChunkIDs (cognitive 17) · ×1
  • AtriaHistoricalAggregateReader.loadCommittedChunkIDs (cognitive 17) Atria/Atria/AtriaHistoricalAggregateReader.swift:683 — AtriaHistoricalAggregateReader.loadCommittedChunkIDs has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalArchiveCatalogStore.recordSealedMetadata (cognitive 17) · ×1
  • AtriaHistoricalArchiveCatalogStore.recordSealedMetadata (cognitive 17) Atria/Atria/AtriaHistoricalArchiveCatalog.swift:617 — AtriaHistoricalArchiveCatalogStore.recordSealedMetadata has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalCanonicalConsumerApplicationStore.publishCompleteSet (cognitive 17) · ×1
  • AtriaHistoricalCanonicalConsumerApplicationStore.publishCompleteSet (cognitive 17) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:137 — AtriaHistoricalCanonicalConsumerApplicationStore.publishCompleteSet has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 2, loops 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHistoricalDailyConsumerProjection.validCommon (cognitive 17) · ×1
  • AtriaHistoricalDailyConsumerProjection.validCommon (cognitive 17) Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:767 — AtriaHistoricalDailyConsumerProjection.validCommon has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · DurableStorePair.isValid (cognitive 17) · ×1
  • DurableStorePair.isValid (cognitive 17) Atria/Atria/AtriaHistoricalFullDrainCoveragePolicy.swift:225 — DurableStorePair.isValid has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 17. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.arm (cognitive 17) · ×1
  • AtriaHistoricalFullDrainCoverageStore.arm (cognitive 17) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:243 — AtriaHistoricalFullDrainCoverageStore.arm has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 6 (8 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.migrateLegacyCoalescedWindow (cognitive 17) · ×1
  • AtriaHistoricalGapLedger.migrateLegacyCoalescedWindow (cognitive 17) Atria/Atria/AtriaHistoricalGapLedger.swift:805 — AtriaHistoricalGapLedger.migrateLegacyCoalescedWindow has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 9, if/else 4 (6 pts), loops 1 (2 pts) (nesting depth added 3). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalGapLedger.continuity (cognitive 17) · ×1
  • AtriaHistoricalGapLedger.continuity (cognitive 17) Atria/Atria/AtriaHistoricalGapLedger.swift:853 — AtriaHistoricalGapLedger.continuity has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (8 pts), loops 1 (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalHighVolumeStoragePlanner.plan (cognitive 17) · ×1
  • AtriaHistoricalHighVolumeStoragePlanner.plan (cognitive 17) Atria/Atria/AtriaHistoricalHighVolumeStoragePlanner.swift:336 — AtriaHistoricalHighVolumeStoragePlanner.plan has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), loops 1 (2 pts), boolean chains 1, ternaries 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHistoricalRawRetirementExecutor.loadAuthority (cognitive 17) · ×1
  • AtriaHistoricalRawRetirementExecutor.loadAuthority (cognitive 17) Atria/Atria/AtriaHistoricalRawRetirementExecutor.swift:283 — AtriaHistoricalRawRetirementExecutor.loadAuthority has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.setLiveWorkoutPaused (cognitive 17) · ×1
  • AtriaHomeView.setLiveWorkoutPaused (cognitive 17) Atria/Atria/AtriaHomeView.swift:2593 — AtriaHomeView.setLiveWorkoutPaused has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, ternaries 1 (2 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutEndRecapSheet.metrics (cognitive 17) · ×1
  • AtriaWorkoutEndRecapSheet.metrics (cognitive 17) Atria/Atria/AtriaHomeView.swift:716 — AtriaWorkoutEndRecapSheet.metrics has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 4, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaIMUDecoder.decodeBody (cognitive 17) · ×1
  • AtriaIMUDecoder.decodeBody (cognitive 17) Atria/Atria/AtriaIMUDecoder.swift:58 — AtriaIMUDecoder.decodeBody has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (11 pts), loops 3 (6 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.helloThen6AWriteDecision (cognitive 17) · ×1
  • AtriaIMUDiagnosticTransport.helloThen6AWriteDecision (cognitive 17) Atria/Atria/AtriaIMUDiagnosticTransport.swift:807 — AtriaIMUDiagnosticTransport.helloThen6AWriteDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 1, ternaries 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. This shape REPEATS in the file: 3 other methods here (AtriaIMUDiagnosticTransport.stopR10WriteDecision, AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision, AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.stopR10WriteDecision (cognitive 17) · ×1
  • AtriaIMUDiagnosticTransport.stopR10WriteDecision (cognitive 17) Atria/Atria/AtriaIMUDiagnosticTransport.swift:837 — AtriaIMUDiagnosticTransport.stopR10WriteDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 1, ternaries 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. This shape REPEATS in the file: 3 other methods here (AtriaIMUDiagnosticTransport.helloThen6AWriteDecision, AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision, AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision (cognitive 17) · ×1
  • AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision (cognitive 17) Atria/Atria/AtriaIMUDiagnosticTransport.swift:898 — AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 1, ternaries 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. This shape REPEATS in the file: 3 other methods here (AtriaIMUDiagnosticTransport.helloThen6AWriteDecision, AtriaIMUDiagnosticTransport.stopR10WriteDecision, AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision (cognitive 17) · ×1
  • AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision (cognitive 17) Atria/Atria/AtriaIMUDiagnosticTransport.swift:929 — AtriaIMUDiagnosticTransport.allDayRecoveryWriteDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 3, match/switch 1, ternaries 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. This shape REPEATS in the file: 3 other methods here (AtriaIMUDiagnosticTransport.helloThen6AWriteDecision, AtriaIMUDiagnosticTransport.stopR10WriteDecision, AtriaIMUDiagnosticTransport.releaseHistoricalWriteDecision) have the same decision points, in the same order, at the same nesting depths — so this is one pattern written 4 times rather than 4 independent problems. Splitting this body alone leaves the other 3 exactly as they are. Where these are variations on one operation, the change that clears all 4 is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.classifyAssembledFrame (cognitive 17) · ×1
  • AtriaIMUDiagnosticTransport.classifyAssembledFrame (cognitive 17) Atria/Atria/AtriaIMUDiagnosticTransport.swift:1549 — AtriaIMUDiagnosticTransport.classifyAssembledFrame has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), ternaries 3 (5 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaLiveWorkoutActionStore.consumeClaimedFiles (cognitive 17) · ×1
  • AtriaLiveWorkoutActionStore.consumeClaimedFiles (cognitive 17) Atria/Atria/AtriaLiveActivityCoordinator.swift:97 — AtriaLiveWorkoutActionStore.consumeClaimedFiles has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, error handling 1 (2 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.
D2 · Cognitive Complexity · AtriaManagedStorageInventory.sweepOrphanedArtifacts (cognitive 17) · ×1
  • AtriaManagedStorageInventory.sweepOrphanedArtifacts (cognitive 17) Atria/Atria/AtriaManagedStorageInventory.swift:223 — AtriaManagedStorageInventory.sweepOrphanedArtifacts has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRecoveredHeartRateProjection.coverage (cognitive 17) · ×1
  • AtriaRecoveredHeartRateProjection.coverage (cognitive 17) Atria/Atria/AtriaRecoveredHeartRateProjection.swift:386 — AtriaRecoveredHeartRateProjection.coverage has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 3, loops 2, ternaries 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaResearchProbe.modelGeneration (cognitive 17) · ×1
  • AtriaResearchProbe.modelGeneration (cognitive 17) Atria/Atria/AtriaResearchProbe.swift:346 — AtriaResearchProbe.modelGeneration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaRestoreTransactionCoordinator.apply (cognitive 17) · ×1
  • AtriaRestoreTransactionCoordinator.apply (cognitive 17) Atria/Atria/AtriaRestoreTransaction.swift:180 — AtriaRestoreTransactionCoordinator.apply has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Point.isValid (cognitive 17) · ×1
  • Point.isValid (cognitive 17) Atria/Atria/AtriaStressMonitor.swift:661 — Point.isValid has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 15, if/else 1, match/switch 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaTodayScreen.todaySection (cognitive 17) · ×1
  • AtriaTodayScreen.todaySection (cognitive 17) Atria/Atria/AtriaTodayScreen.swift:909 — AtriaTodayScreen.todaySection has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), boolean chains 1, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaWhoop4FrameReassembler.feed (cognitive 17) · ×1
  • AtriaWhoop4FrameReassembler.feed (cognitive 17) Atria/Atria/AtriaWhoop4FrameReassembler.swift:46 — AtriaWhoop4FrameReassembler.feed has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), loops 2 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.decodedPrefixPoints (cognitive 17) · ×1
  • AtriaWhoop4MotionTickCompactStore.decodedPrefixPoints (cognitive 17) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2622 — AtriaWhoop4MotionTickCompactStore.decodedPrefixPoints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, ternaries 2 (4 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWorkoutOnset.lastSustainedElevatedBoutEnd (cognitive 17) · ×1
  • AtriaWorkoutOnset.lastSustainedElevatedBoutEnd (cognitive 17) Atria/Atria/AtriaWorkoutOnset.swift:72 — AtriaWorkoutOnset.lastSustainedElevatedBoutEnd has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.sidecarHeartRatePoints (cognitive 17) · ×1
  • HistoricalArchive.sidecarHeartRatePoints (cognitive 17) Atria/Atria/HistoricalArchive.swift:8202 — HistoricalArchive.sidecarHeartRatePoints has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 5, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LocalNotificationScheduler.healthDeviationDecision (cognitive 17) · ×1
  • LocalNotificationScheduler.healthDeviationDecision (cognitive 17) Atria/Atria/LocalNotificationScheduler.swift:1421 — LocalNotificationScheduler.healthDeviationDecision has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (7 pts), boolean chains 5, 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.
D2 · Cognitive Complexity · SessionStore.recomputeRestingTrend (cognitive 17) · ×1
  • SessionStore.recomputeRestingTrend (cognitive 17) Atria/Atria/Sessions.swift:11442 — SessionStore.recomputeRestingTrend has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.boundedRecoveredCurrentCheckpointSessionsCancellable (cognitive 17) · ×1
  • SessionStore.boundedRecoveredCurrentCheckpointSessionsCancellable (cognitive 17) Atria/Atria/Sessions.swift:16487 — SessionStore.boundedRecoveredCurrentCheckpointSessionsCancellable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.archiveOnlyTRIMPCancellable (cognitive 17) · ×1
  • SessionStore.archiveOnlyTRIMPCancellable (cognitive 17) Atria/Atria/Sessions.swift:27330 — SessionStore.archiveOnlyTRIMPCancellable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 2 (3 pts), ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.beginArchiveCompactionBGProcessingLeaseIfSafe (cognitive 17) · ×1
  • SessionStore.beginArchiveCompactionBGProcessingLeaseIfSafe (cognitive 17) Atria/Atria/Sessions.swift:28285 — SessionStore.beginArchiveCompactionBGProcessingLeaseIfSafe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (13 pts), boolean chains 3, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.makeActiveJournalSessionCore (cognitive 17) · ×1
  • SessionStore.makeActiveJournalSessionCore (cognitive 17) Atria/Atria/Sessions.swift:29966 — SessionStore.makeActiveJournalSessionCore has cognitive complexity 17 (threshold 15). Drivers by points: if/else 5 (9 pts), boolean chains 3, loops 3, ternaries 2 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.makeWorkoutReviewCandidatesForCache (cognitive 17) · ×1
  • SessionStore.makeWorkoutReviewCandidatesForCache (cognitive 17) Atria/Atria/Sessions.swift:33105 — SessionStore.makeWorkoutReviewCandidatesForCache has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 4 (7 pts), loops 2 (3 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.rescoredConfirmedWorkoutsForCurrentStrainCalibration (cognitive 17) · ×1
  • SessionStore.rescoredConfirmedWorkoutsForCurrentStrainCalibration (cognitive 17) Atria/Atria/Sessions.swift:35115 — SessionStore.rescoredConfirmedWorkoutsForCurrentStrainCalibration has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 5, loops 2 (3 pts) (nesting depth added 3). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.isDegradedHROnlyOvernightSleepCandidate (cognitive 17) · ×1
  • SessionStore.isDegradedHROnlyOvernightSleepCandidate (cognitive 17) Atria/Atria/Sessions.swift:42126 — SessionStore.isDegradedHROnlyOvernightSleepCandidate has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 11, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.recoveredDutyCycleSleepWindowCancellable (cognitive 17) · ×1
  • SessionStore.recoveredDutyCycleSleepWindowCancellable (cognitive 17) Atria/Atria/Sessions.swift:45457 — SessionStore.recoveredDutyCycleSleepWindowCancellable has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.confirmedWorkoutZone2PlusMinutes (cognitive 17) · ×1
  • SessionStore.confirmedWorkoutZone2PlusMinutes (cognitive 17) Atria/Atria/Sessions.swift:53129 — SessionStore.confirmedWorkoutZone2PlusMinutes has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.loadPersistedSessionsDeferred (cognitive 17) · ×1
  • SessionStore.loadPersistedSessionsDeferred (cognitive 17) Atria/Atria/Sessions.swift:56797 — SessionStore.loadPersistedSessionsDeferred has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 5 (9 pts), if/else 3 (5 pts), boolean chains 2, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.scheduleLiveWorkoutPatch (cognitive 17) · ×1
  • WidgetSnapshotPublisher.scheduleLiveWorkoutPatch (cognitive 17) Atria/Atria/WidgetSnapshot.swift:292 — WidgetSnapshotPublisher.scheduleLiveWorkoutPatch has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (14 pts), boolean chains 3 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaWidget.swift.liveActivityDailyStepGoalPresentation (cognitive 17) · ×1
  • AtriaWidget.swift.liveActivityDailyStepGoalPresentation (cognitive 17) Atria/AtriaWidget/AtriaWidget.swift:2697 — AtriaWidget.swift.liveActivityDailyStepGoalPresentation has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 6, ternaries 6, if/else 4 (5 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaCoachPayload.auditLines (cognitive 16) · ×1
  • AtriaCoachPayload.auditLines (cognitive 16) Atria/Atria/AtriaAICoach.swift:200 — AtriaCoachPayload.auditLines has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 1, loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SurfaceCoverage.isComplete (cognitive 16) · ×1
  • SurfaceCoverage.isComplete (cognitive 16) Atria/Atria/AtriaAppReviewDemo.swift:332 — SurfaceCoverage.isComplete has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 16. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateR10Live (cognitive 16) · ×1
  • AtriaBLEManager.evaluateR10Live (cognitive 16) REDACTED:5844 — AtriaBLEManager.evaluateR10Live has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 5 (6 pts), ternaries 4 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.r10IdlePausedNow (cognitive 16) · ×1
  • AtriaBLEManager.r10IdlePausedNow (cognitive 16) REDACTED:5916 — AtriaBLEManager.r10IdlePausedNow has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), ternaries 2 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.requestOfflineHistoricalSyncAwaitingCompletion (cognitive 16) · ×1
  • AtriaBLEManager.requestOfflineHistoricalSyncAwaitingCompletion (cognitive 16) REDACTED:14997 — AtriaBLEManager.requestOfflineHistoricalSyncAwaitingCompletion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 5, loops 2, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.scheduleSessionCheckpoint (cognitive 16) · ×1
  • AtriaBLEManager.scheduleSessionCheckpoint (cognitive 16) REDACTED:26829 — AtriaBLEManager.scheduleSessionCheckpoint has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), ternaries 4 (7 pts), loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.checkpointFromLiveEventIfNeeded (cognitive 16) · ×1
  • AtriaBLEManager.checkpointFromLiveEventIfNeeded (cognitive 16) REDACTED:30679 — AtriaBLEManager.checkpointFromLiveEventIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8, ternaries 6, boolean chains 1, match/switch 1. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.handleHistoricalIMUCommandResponse (cognitive 16) · ×1
  • AtriaBLEManager.handleHistoricalIMUCommandResponse (cognitive 16) REDACTED:32035 — AtriaBLEManager.handleHistoricalIMUCommandResponse has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 7 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded (cognitive 16) · ×1
  • AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded (cognitive 16) REDACTED:34206 — AtriaBLEManager.sendCoverLiveBoundedRawCaptureIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaBLEManager.evaluateAllDayMotionGovernor (cognitive 16) · ×1
  • AtriaBLEManager.evaluateAllDayMotionGovernor (cognitive 16) REDACTED:35314 — AtriaBLEManager.evaluateAllDayMotionGovernor has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 3 (6 pts), if/else 3 (5 pts), boolean chains 4, match/switch 1 (nesting depth added 5). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaBLEManager.maintainPendingWorkoutMotionBankTickets (cognitive 16) · ×1
  • AtriaBLEManager.maintainPendingWorkoutMotionBankTickets (cognitive 16) REDACTED:37897 — AtriaBLEManager.maintainPendingWorkoutMotionBankTickets has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaBLEManager.maybeRestartRealtimeAfterZeroRR (cognitive 16) · ×1
  • AtriaBLEManager.maybeRestartRealtimeAfterZeroRR (cognitive 16) REDACTED:42942 — AtriaBLEManager.maybeRestartRealtimeAfterZeroRR has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 3, error handling 1 (2 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaBLEManager.reackDurableHistoricalReplay (cognitive 16) · ×1
  • AtriaBLEManager.reackDurableHistoricalReplay (cognitive 16) REDACTED:49596 — AtriaBLEManager.reackDurableHistoricalReplay has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), boolean chains 6, loops 1, ternaries 1 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaBLEManager.selectedIdleWindowHistoryDrain (cognitive 16) · ×1
  • AtriaBLEManager.selectedIdleWindowHistoryDrain (cognitive 16) Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift:786 — AtriaBLEManager.selectedIdleWindowHistoryDrain has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 7, if/else 7, ternaries 1 (2 pts) (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaHeldDailyStepFloor.persistLiveCoordinate (cognitive 16) · ×1
  • AtriaHeldDailyStepFloor.persistLiveCoordinate (cognitive 16) Atria/Atria/AtriaDailyStepPresentation.swift:974 — AtriaHeldDailyStepFloor.persistLiveCoordinate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (13 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaFullFidelityColdSessionStore.pruneAbandonedTemporaryFiles (cognitive 16) · ×1
  • AtriaFullFidelityColdSessionStore.pruneAbandonedTemporaryFiles (cognitive 16) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:722 — AtriaFullFidelityColdSessionStore.pruneAbandonedTemporaryFiles has cognitive complexity 16 (threshold 15). Drivers by points: if/else 3 (8 pts), boolean chains 4, loops 3 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHealthScreen.body (cognitive 16) · ×1
  • AtriaHealthScreen.body (cognitive 16) Atria/Atria/AtriaHealthScreen.swift:996 — AtriaHealthScreen.body has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 4, match/switch 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalDrainCompletionGenerationStore.publish (cognitive 16) · ×1
  • AtriaHistoricalDrainCompletionGenerationStore.publish (cognitive 16) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:141 — AtriaHistoricalDrainCompletionGenerationStore.publish has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalAggregateBuilder.buildHeartRateMinutes (cognitive 16) · ×1
  • AtriaHistoricalAggregateBuilder.buildHeartRateMinutes (cognitive 16) Atria/Atria/AtriaHistoricalAggregateBuilder.swift:282 — AtriaHistoricalAggregateBuilder.buildHeartRateMinutes has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 5, loops 2 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalCanonicalConsumerApplicationStore.valid (cognitive 16) · ×1
  • AtriaHistoricalCanonicalConsumerApplicationStore.valid (cognitive 16) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:326 — AtriaHistoricalCanonicalConsumerApplicationStore.valid has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 16. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalConsumerReceiptLedger.activateCurrentSet (cognitive 16) · ×1
  • AtriaHistoricalConsumerReceiptLedger.activateCurrentSet (cognitive 16) Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:233 — AtriaHistoricalConsumerReceiptLedger.activateCurrentSet has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 4, loops 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalFullDrainCoverageStore.recordHistoryComplete (cognitive 16) · ×1
  • AtriaHistoricalFullDrainCoverageStore.recordHistoryComplete (cognitive 16) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:421 — AtriaHistoricalFullDrainCoverageStore.recordHistoryComplete has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · AtriaHistoricalFullScanCompletionStore.recordCompletion (cognitive 16) · ×1
  • AtriaHistoricalFullScanCompletionStore.recordCompletion (cognitive 16) Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:88 — AtriaHistoricalFullScanCompletionStore.recordCompletion has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), error handling 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalRetiredReplayIndex.maintainStorage (cognitive 16) · ×1
  • AtriaHistoricalRetiredReplayIndex.maintainStorage (cognitive 16) Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:368 — AtriaHistoricalRetiredReplayIndex.maintainStorage has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 4, error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalSealedCatalogMaterializer.quarantineDivergentCommittedArtifacts (cognitive 16) · ×1
  • AtriaHistoricalSealedCatalogMaterializer.quarantineDivergentCommittedArtifacts (cognitive 16) Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:342 — AtriaHistoricalSealedCatalogMaterializer.quarantineDivergentCommittedArtifacts has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 4 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted (cognitive 16) · ×1
  • AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted (cognitive 16) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:278 — AtriaHistoricalSealedJSONLCompression.loadAndVerifyCommitted has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 4 (5 pts), error handling 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHistoricalSealedJSONLCompression.encode (cognitive 16) · ×1
  • AtriaHistoricalSealedJSONLCompression.encode (cognitive 16) Atria/Atria/AtriaHistoricalSealedJSONLCompression.swift:360 — AtriaHistoricalSealedJSONLCompression.encode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (7 pts), boolean chains 5, loops 2, ternaries 1 (2 pts) (nesting depth added 3). Of this number, 8 points are the body's own statements and 8 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent (cognitive 16) · ×1
  • AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent (cognitive 16) Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:295 — AtriaHistoricalVerifiedActivityConsumerApplicationStore.loadCurrent has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6, error handling 2. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaHomeView.beginWorkoutSession (cognitive 16) · ×1
  • AtriaHomeView.beginWorkoutSession (cognitive 16) Atria/Atria/AtriaHomeView.swift:2443 — AtriaHomeView.beginWorkoutSession has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (16 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHomeView.handleHomeAppear (cognitive 16) · ×1
  • AtriaHomeView.handleHomeAppear (cognitive 16) Atria/Atria/AtriaHomeView.swift:4855 — AtriaHomeView.handleHomeAppear has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 2, ternaries 1 (2 pts) (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHomeModel.publishDiagnosisReport (cognitive 16) · ×1
  • AtriaHomeModel.publishDiagnosisReport (cognitive 16) Atria/Atria/AtriaHomeView.swift:10952 — AtriaHomeModel.publishDiagnosisReport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9, ternaries 6, boolean chains 1. Of this number, 14 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaIMUDiagnosticTransport.recordAssembledFrame (cognitive 16) · ×1
  • AtriaIMUDiagnosticTransport.recordAssembledFrame (cognitive 16) Atria/Atria/AtriaIMUDiagnosticTransport.swift:1449 — AtriaIMUDiagnosticTransport.recordAssembledFrame has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (14 pts), boolean chains 1, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaLearnedInsights.dayRead (cognitive 16) · ×1
  • AtriaLearnedInsights.dayRead (cognitive 16) Atria/Atria/AtriaLearnedInsights.swift:922 — AtriaLearnedInsights.dayRead has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10, boolean chains 6. To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · AtriaLiveWorkoutView.routeWorkoutActions (cognitive 16) · ×1
  • AtriaLiveWorkoutView.routeWorkoutActions (cognitive 16) Atria/Atria/AtriaLiveWorkoutView.swift:2698 — AtriaLiveWorkoutView.routeWorkoutActions has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 7 (10 pts), if/else 5 (6 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaNightTimelineAnalyzer.classify (cognitive 16) · ×1
  • AtriaNightTimelineAnalyzer.classify (cognitive 16) Atria/Atria/AtriaNightTimelineAnalyzer.swift:168 — AtriaNightTimelineAnalyzer.classify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (6 pts), loops 3 (6 pts), boolean chains 3, ternaries 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaNightTimelineStore.ensureLoaded (cognitive 16) · ×1
  • AtriaNightTimelineStore.ensureLoaded (cognitive 16) Atria/Atria/AtriaNightTimelineLoader.swift:247 — AtriaNightTimelineStore.ensureLoaded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (10 pts), boolean chains 3, loops 3 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaSettingsView.handleBackupImport (cognitive 16) · ×1
  • AtriaSettingsView.handleBackupImport (cognitive 16) Atria/Atria/AtriaSettingsView.swift:1425 — AtriaSettingsView.handleBackupImport has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (7 pts), ternaries 2 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 7). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaSleepHypnogramCard.displayState (cognitive 16) · ×1
  • AtriaSleepHypnogramCard.displayState (cognitive 16) Atria/Atria/AtriaSleepHypnogram.swift:435 — AtriaSleepHypnogramCard.displayState has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 5 (7 pts) (nesting depth added 2). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaStepCalibrationPlanStore.isValid (cognitive 16) · ×1
  • AtriaStepCalibrationPlanStore.isValid (cognitive 16) Atria/Atria/AtriaStepCalibrationPlan.swift:235 — AtriaStepCalibrationPlanStore.isValid has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (8 pts), boolean chains 6, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaStrainLoadModel.evaluateInterval (cognitive 16) · ×1
  • AtriaStrainLoadModel.evaluateInterval (cognitive 16) Atria/Atria/AtriaStrainLoadModel.swift:237 — AtriaStrainLoadModel.evaluateInterval has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaStressHistoryPersistence.loadSynchronously (cognitive 16) · ×1
  • AtriaStressHistoryPersistence.loadSynchronously (cognitive 16) Atria/Atria/AtriaStressMonitor.swift:895 — AtriaStressHistoryPersistence.loadSynchronously has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), boolean chains 4, loops 1 (2 pts), error handling 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaTodayScreen.centerDeltaText (cognitive 16) · ×1
  • AtriaTodayScreen.centerDeltaText (cognitive 16) Atria/Atria/AtriaTodayScreen.swift:2595 — AtriaTodayScreen.centerDeltaText has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, ternaries 1 (2 pts), match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · AtriaVitalsLiveSignalCard.stressMonitor (cognitive 16) · ×1
  • AtriaVitalsLiveSignalCard.stressMonitor (cognitive 16) Atria/Atria/AtriaVitalsCollectionSections.swift:2898 — AtriaVitalsLiveSignalCard.stressMonitor has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 4 (7 pts), if/else 5 (6 pts), boolean chains 2, match/switch 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaHeartRateExplorer.selectionSummary (cognitive 16) · ×1
  • AtriaHeartRateExplorer.selectionSummary (cognitive 16) Atria/Atria/AtriaVitalsCollectionSections.swift:4130 — AtriaHeartRateExplorer.selectionSummary has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 4 (5 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWalkBoutDetector.latestBout (cognitive 16) · ×1
  • AtriaWalkBoutDetector.latestBout (cognitive 16) Atria/Atria/AtriaWalkBoutDetector.swift:93 — AtriaWalkBoutDetector.latestBout has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 2, boolean chains 1 (nesting depth added 6). Of this number, 12 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4FrameReassembler.alignToPlausibleHeader (cognitive 16) · ×1
  • AtriaWhoop4FrameReassembler.alignToPlausibleHeader (cognitive 16) Atria/Atria/AtriaWhoop4FrameReassembler.swift:125 — AtriaWhoop4FrameReassembler.alignToPlausibleHeader has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 2, loops 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout (cognitive 16) · ×1
  • AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout (cognitive 16) Atria/Atria/AtriaWhoop4HistoricalRecordDecoder.swift:39 — AtriaWhoop4HistoricalRecordDecoder.decodeFixedLayout has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 6, ternaries 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary (cognitive 16) · ×1
  • AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary (cognitive 16) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:582 — AtriaWhoop4HistoryAdmissionLedger.recordEmptyArchiveDurabilityBoundary has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWhoop4MotionTickCompactStore.motionTickWindowRead (cognitive 16) · ×1
  • AtriaWhoop4MotionTickCompactStore.motionTickWindowRead (cognitive 16) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1911 — AtriaWhoop4MotionTickCompactStore.motionTickWindowRead has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 8, if/else 6 (7 pts), ternaries 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWorkoutRouteRecorder.previewSegments (cognitive 16) · ×1
  • AtriaWorkoutRouteRecorder.previewSegments (cognitive 16) Atria/Atria/AtriaWorkoutRoute.swift:613 — AtriaWorkoutRouteRecorder.previewSegments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (10 pts), loops 2 (4 pts), boolean chains 2 (nesting depth added 4). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight (cognitive 16) · ×1
  • DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight (cognitive 16) Atria/Atria/DailyRollupStore.swift:632 — DailyRecoveryResolver.metricMatchesCurrentPhysiologicalNight has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.recordDrainedThroughCompletionIfNeeded (cognitive 16) · ×1
  • HistoricalArchive.recordDrainedThroughCompletionIfNeeded (cognitive 16) Atria/Atria/HistoricalArchive.swift:2619 — HistoricalArchive.recordDrainedThroughCompletionIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 6. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible (cognitive 16) · ×1
  • HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible (cognitive 16) Atria/Atria/HistoricalArchive.swift:4678 — HistoricalArchive.automaticRecoveredDataBootstrapDescriptorsAreAdmissible has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, if/else 2 (3 pts), loops 1 (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · HistoricalArchive.updateAutomaticRecoveredDataBootstrapSources (cognitive 16) · ×1
  • HistoricalArchive.updateAutomaticRecoveredDataBootstrapSources (cognitive 16) Atria/Atria/HistoricalArchive.swift:5140 — HistoricalArchive.updateAutomaticRecoveredDataBootstrapSources has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 2, loops 2 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.loadRecentHeartRateSamples (cognitive 16) · ×1
  • HistoricalArchive.loadRecentHeartRateSamples (cognitive 16) Atria/Atria/HistoricalArchive.swift:9428 — HistoricalArchive.loadRecentHeartRateSamples has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · HistoricalArchive.fastHeartRatePoint (cognitive 16) · ×1
  • HistoricalArchive.fastHeartRatePoint (cognitive 16) Atria/Atria/HistoricalArchive.swift:9466 — HistoricalArchive.fastHeartRatePoint has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 9, if/else 7. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · LocalNotificationScheduler.makeMetricDecisions (cognitive 16) · ×1
  • LocalNotificationScheduler.makeMetricDecisions (cognitive 16) Atria/Atria/LocalNotificationScheduler.swift:1282 — LocalNotificationScheduler.makeMetricDecisions has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7, ternaries 3 (5 pts), boolean chains 4 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · AtriaHistoricalPhysiologicalCycle.noSleepFallback (cognitive 16) · ×1
  • AtriaHistoricalPhysiologicalCycle.noSleepFallback (cognitive 16) Atria/Atria/Sessions.swift:893 — AtriaHistoricalPhysiologicalCycle.noSleepFallback has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, ternaries 1 (2 pts), loops 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkoutReadiness.gappedStrengthReviewCandidate (cognitive 16) · ×1
  • WorkoutReadiness.gappedStrengthReviewCandidate (cognitive 16) Atria/Atria/Sessions.swift:3042 — WorkoutReadiness.gappedStrengthReviewCandidate has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (WorkoutReplaySummary.gappedStrengthReviewCandidate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SleepStageSegment.overlayingConfirmedWake (cognitive 16) · ×1
  • SleepStageSegment.overlayingConfirmedWake (cognitive 16) Atria/Atria/Sessions.swift:3674 — SleepStageSegment.overlayingConfirmedWake has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WorkoutReplaySummary.gappedStrengthReviewCandidate (cognitive 16) · ×1
  • WorkoutReplaySummary.gappedStrengthReviewCandidate (cognitive 16) Atria/Atria/Sessions.swift:6548 — WorkoutReplaySummary.gappedStrengthReviewCandidate has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 13, if/else 3. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators. This shape REPEATS in the file: one other method here (WorkoutReadiness.gappedStrengthReviewCandidate) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionStore.isReviewWorthySleepCandidate (cognitive 16) · ×1
  • SessionStore.isReviewWorthySleepCandidate (cognitive 16) Atria/Atria/Sessions.swift:22618 — SessionStore.isReviewWorthySleepCandidate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (9 pts), boolean chains 7 (nesting depth added 2). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · SessionStore.makeDailyRespiratoryRatePreparationCancellable (cognitive 16) · ×1
  • SessionStore.makeDailyRespiratoryRatePreparationCancellable (cognitive 16) Atria/Atria/Sessions.swift:24217 — SessionStore.makeDailyRespiratoryRatePreparationCancellable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 2, boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.latestLocalRMSSDSourceCancellable (cognitive 16) · ×1
  • SessionStore.latestLocalRMSSDSourceCancellable (cognitive 16) Atria/Atria/Sessions.swift:26501 — SessionStore.latestLocalRMSSDSourceCancellable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), ternaries 1 (3 pts), boolean chains 2, loops 1 (nesting depth added 6). Most of this is not in the body itself: 2 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (firstSource). Those helpers are already separate functions, so extracting the branching again is not available. To reduce it, move them out of the body to the enclosing scope, where each is measured, reviewed and tested on its own, and reduce whichever one then reads as the largest.
D2 · Cognitive Complexity · SessionStore.preservingMonotonicResearchAggregates (cognitive 16) · ×1
  • SessionStore.preservingMonotonicResearchAggregates (cognitive 16) Atria/Atria/Sessions.swift:29265 — SessionStore.preservingMonotonicResearchAggregates has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (8 pts), if/else 4, boolean chains 3, 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, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · SessionStore.maybeScheduleDaytimeQuiescenceReview (cognitive 16) · ×1
  • SessionStore.maybeScheduleDaytimeQuiescenceReview (cognitive 16) Atria/Atria/Sessions.swift:39774 — SessionStore.maybeScheduleDaytimeQuiescenceReview has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (11 pts), boolean chains 2, ternaries 2, loops 1 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.scheduleCompactLatestNightSettlementRetry (cognitive 16) · ×1
  • SessionStore.scheduleCompactLatestNightSettlementRetry (cognitive 16) Atria/Atria/Sessions.swift:40410 — SessionStore.scheduleCompactLatestNightSettlementRetry has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, match/switch 1 (nesting depth added 6). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate (cognitive 16) · ×1
  • SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate (cognitive 16) Atria/Atria/Sessions.swift:42064 — SessionStore.isHighSpecificityFragmentedHROnlyMainSleepCandidate has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 15, if/else 1. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · SessionStore.confirmedSleepRespiratoryRateCore · ×1
  • SessionStore.confirmedSleepRespiratoryRateCore::finishRun::checkedEstimate (cognitive 16) Atria/Atria/Sessions.swift:43544 — SessionStore.confirmedSleepRespiratoryRateCore::finishRun::checkedEstimate has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 3 (4 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body. This shape REPEATS in the file: one other method here (SessionStore.confirmedSleepRespiratoryRateCore) has the same decision points, in the same order, at the same nesting depths — so this is one pattern written twice rather than two separate problems. Splitting this body alone leaves the other exactly as it is. Where these are variations on one operation, the change that clears both is the shared one: lift the common shape into a single routine the variants call, parameterised by whatever genuinely differs between them, and keep in each method only the part that is not shared.
D2 · Cognitive Complexity · SessionStore.confirmedSleepMutationDeltaCancellable (cognitive 16) · ×1
  • SessionStore.confirmedSleepMutationDeltaCancellable (cognitive 16) Atria/Atria/Sessions.swift:45046 — SessionStore.confirmedSleepMutationDeltaCancellable has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 3, loops 3 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.refreshedUserAdjustedSleepEvidenceIfNeeded (cognitive 16) · ×1
  • SessionStore.refreshedUserAdjustedSleepEvidenceIfNeeded (cognitive 16) Atria/Atria/Sessions.swift:46169 — SessionStore.refreshedUserAdjustedSleepEvidenceIfNeeded has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (9 pts), ternaries 4, boolean chains 3 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · SessionStore.splitShortPreludeFromDenseSleepCluster (cognitive 16) · ×1
  • SessionStore.splitShortPreludeFromDenseSleepCluster (cognitive 16) Atria/Atria/Sessions.swift:56434 — SessionStore.splitShortPreludeFromDenseSleepCluster has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 6, if/else 3 (5 pts), ternaries 2 (4 pts), loops 1 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SessionStore.shouldSplitPostWakeNap (cognitive 16) · ×1
  • SessionStore.shouldSplitPostWakeNap (cognitive 16) Atria/Atria/Sessions.swift:56559 — SessionStore.shouldSplitPostWakeNap has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 11, if/else 5. To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · WidgetSnapshotPublisher.timelineReloadDelay (cognitive 16) · ×1
  • WidgetSnapshotPublisher.timelineReloadDelay (cognitive 16) Atria/Atria/WidgetSnapshot.swift:2504 — WidgetSnapshotPublisher.timelineReloadDelay has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 10, if/else 3, ternaries 2 (3 pts) (nesting depth added 1). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D2 · Cognitive Complexity · AtriaWidgetEntryView.dailyDetail (cognitive 16) · ×1
  • AtriaWidgetEntryView.dailyDetail (cognitive 16) Atria/AtriaWidget/AtriaWidget.swift:1015 — AtriaWidgetEntryView.dailyDetail has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AtriaWidgetEntryView.dailyRingPresentation (cognitive 16) · ×1
  • AtriaWidgetEntryView.dailyRingPresentation (cognitive 16) Atria/AtriaWidget/AtriaWidget.swift:1059 — AtriaWidgetEntryView.dailyRingPresentation has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 2, 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.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member pair (70 shared lines) · ×1
  • Near-duplicate member pair (70 shared lines) Atria/Atria/Sessions.swift:52084 — Atria/Atria/Sessions.swift:52084-52166 | Atria/Atria/Sessions.swift:52168-52246 — These two members are variants of one another: 70 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (60 shared lines) · ×1
  • Near-duplicate member pair (60 shared lines) Atria/Atria/Sessions.swift:22768 — Atria/Atria/Sessions.swift:22768-22916 | Atria/Atria/Sessions.swift:23037-23170 — These two members are variants of one another: 60 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (59 shared lines) · ×1
  • Near-duplicate member pair (59 shared lines) Atria/Atria/Sessions.swift:22366 — Atria/Atria/Sessions.swift:22366-22454 | Atria/Atria/Sessions.swift:22456-22594 — These two members are variants of one another: 59 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (53 shared lines) · ×1
  • Near-duplicate member pair (53 shared lines) Atria/Atria/Sessions.swift:14000 — Atria/Atria/Sessions.swift:14000-14103 | Atria/Atria/Sessions.swift:14105-14267 — These two members are variants of one another: 53 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (30 shared lines) · ×1
  • Near-duplicate member pair (30 shared lines) REDACTED:57667 — REDACTED:57667-57742 | REDACTED:57744-57799 — These two members are variants of one another: 30 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (26 shared lines) · ×1
  • Near-duplicate member pair (26 shared lines) Atria/Atria/AtriaAnalytics.swift:5 — Atria/Atria/AtriaAnalytics.swift:5-55 | Atria/Atria/AtriaAnalytics.swift:57-135 — These two members are variants of one another: 26 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (24 shared lines) · ×1
  • Near-duplicate member pair (24 shared lines) Atria/Atria/Sessions.swift:21351 — Atria/Atria/Sessions.swift:21351-21389 | Atria/Atria/Sessions.swift:21391-21467 — These two members are variants of one another: 24 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Near-duplicate member pair (18 shared lines) · ×1
  • Near-duplicate member pair (18 shared lines) REDACTED:25399 — REDACTED:25399-25441 | REDACTED:26829-26912 — These two members are variants of one another: 18 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Members sharing a duplicated core (7 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (7 members, 50+ identical tokens) Atria/Atria/AtriaEventNotificationScheduler.swift:317 — Atria/Atria/AtriaEventNotificationScheduler.swift:317-323 | Atria/Atria/AtriaStrainPacing.swift:18-21 | Atria/Atria/LocalNotificationScheduler.swift:2388-2394 | Atria/Atria/Sessions.swift:3395-3401 | Atria/Atria/Sessions.swift:14523-14529 | Atria/Atria/WidgetSnapshot.swift:1465-1476 | Atria/AtriaWidget/AtriaWidget.swift:111-119 — These 7 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 7 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 7 times.
D4 · Code Duplication · Edited copy of a member (112 corresponding lines) · ×1
  • Edited copy of a member (112 corresponding lines) Atria/Atria/Sessions.swift:23194 — Atria/Atria/Sessions.swift:23194-23331 | Atria/Atria/Sessions.swift:23333-23444 — These two members are one piece of code written twice and then edited apart: 112 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 (118 corresponding lines) · ×1
  • Edited copy of a member (118 corresponding lines) Atria/Atria/HistoricalArchive.swift:2306 — Atria/Atria/HistoricalArchive.swift:2306-2435 | Atria/Atria/HistoricalArchive.swift:2437-2554 — These two members are one piece of code written twice and then edited apart: 118 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 (95 corresponding lines) · ×1
  • Edited copy of a member (95 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:2764 — Atria/Atria/AtriaActivityMonitor.swift:2764-2858 | Atria/Atria/AtriaActivityMonitor.swift:2860-2958 — These two members are one piece of code written twice and then edited apart: 95 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 (108 corresponding lines) · ×1
  • Edited copy of a member (108 corresponding lines) Atria/Atria/AtriaRecoveredMotionAnalytics.swift:214 — Atria/Atria/AtriaRecoveredMotionAnalytics.swift:214-339 | Atria/Atria/Sessions.swift:51405-51512 — These two members are one piece of code written twice and then edited apart: 108 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (71 corresponding lines) · ×1
  • Edited copy of a member (71 corresponding lines) Atria/Atria/Sessions.swift:33001 — Atria/Atria/Sessions.swift:33001-33094 | Atria/Atria/Sessions.swift:33170-33240 — These two members are one piece of code written twice and then edited apart: 71 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (69 corresponding lines) · ×1
  • Edited copy of a member (69 corresponding lines) Atria/Atria/LocalNotificationScheduler.swift:357 — Atria/Atria/LocalNotificationScheduler.swift:357-425 | Atria/Atria/LocalNotificationScheduler.swift:464-556 — These two members are one piece of code written twice and then edited apart: 69 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 (84 corresponding lines) · ×1
  • Edited copy of a member (84 corresponding lines) Atria/Atria/Sessions.swift:41541 — Atria/Atria/Sessions.swift:41541-41624 | Atria/Atria/Sessions.swift:41626-41730 — These two members are one piece of code written twice and then edited apart: 84 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (52 corresponding lines) · ×1
  • Edited copy of a member (52 corresponding lines) Atria/Atria/Sessions.swift:44908 — Atria/Atria/Sessions.swift:44908-44963 | Atria/Atria/Sessions.swift:44982-45033 — These two members are one piece of code written twice and then edited apart: 52 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (45 corresponding lines) · ×1
  • Edited copy of a member (45 corresponding lines) Atria/Atria/Sessions.swift:4157 — Atria/Atria/Sessions.swift:4157-4201 | Atria/Atria/Sessions.swift:4203-4264 — These two members are one piece of code written twice and then edited apart: 45 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (72 corresponding lines) · ×1
  • Edited copy of a member (72 corresponding lines) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:198 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:198-277 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:288-359 — These two members are one piece of code written twice and then edited apart: 72 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (51 corresponding lines) · ×1
  • Edited copy of a member (51 corresponding lines) Atria/Atria/AtriaHistoricalGapLedger.swift:527 — Atria/Atria/AtriaHistoricalGapLedger.swift:527-577 | Atria/Atria/AtriaHistoricalGapLedger.swift:579-637 — These two members are one piece of code written twice and then edited apart: 51 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (73 corresponding lines) · ×1
  • Edited copy of a member (73 corresponding lines) REDACTED:41392 — REDACTED:41392-41464 | REDACTED:41754-41831 — These two members are one piece of code written twice and then edited apart: 73 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 (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) Atria/Atria/Sessions.swift:44654 — Atria/Atria/Sessions.swift:44654-44713 | Atria/Atria/Sessions.swift:44715-44798 — These two members are one piece of code written twice and then edited apart: 60 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 (54 corresponding lines) · ×1
  • Edited copy of a member (54 corresponding lines) Atria/Atria/Sessions.swift:13873 — Atria/Atria/Sessions.swift:13873-13926 | Atria/Atria/Sessions.swift:13928-13998 — These two members are one piece of code written twice and then edited apart: 54 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 (47 corresponding lines) · ×1
  • Edited copy of a member (47 corresponding lines) Atria/Atria/AtriaWorkoutOnset.swift:13 — Atria/Atria/AtriaWorkoutOnset.swift:13-59 | Atria/Atria/AtriaWorkoutOnset.swift:72-119 — These two members are one piece of code written twice and then edited apart: 47 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 (63 corresponding lines) · ×1
  • Edited copy of a member (63 corresponding lines) REDACTED:52159 — REDACTED:52159-52221 | REDACTED:52226-52295 — These two members are one piece of code written twice and then edited apart: 63 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 47+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 47+ corresponding lines) Atria/Atria/AtriaHistoricalActivityProjection.swift:417 — Atria/Atria/AtriaHistoricalActivityProjection.swift:417-474 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:682-728 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:60-111 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 47 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (85 corresponding lines) · ×1
  • Edited copy of a member (85 corresponding lines) REDACTED:7586 — REDACTED:7586-7670 | REDACTED:7676-7770 — These two members are one piece of code written twice and then edited apart: 85 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (49 corresponding lines) · ×1
  • Edited copy of a member (49 corresponding lines) Atria/Atria/AtriaStrapStepLedger.swift:234 — Atria/Atria/AtriaStrapStepLedger.swift:234-282 | Atria/Atria/AtriaStrapStepLedger.swift:288-349 — These two members are one piece of code written twice and then edited apart: 49 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 51+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 51+ corresponding lines) Atria/Atria/Sessions.swift:14531 — Atria/Atria/Sessions.swift:14531-14590 | Atria/Atria/Sessions.swift:14592-14642 | Atria/Atria/Sessions.swift:14647-14709 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 51 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (37 corresponding lines) · ×1
  • Edited copy of a member (37 corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:1259 — Atria/Atria/AtriaActivityMonitor.swift:1259-1295 | Atria/Atria/AtriaActivityMonitor.swift:1297-1334 — These two members are one piece of code written twice and then edited apart: 37 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (67 corresponding lines) · ×1
  • Edited copy of a member (67 corresponding lines) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:74 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:74-145 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:54-120 — These two members are one piece of code written twice and then edited apart: 67 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 27+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 27+ corresponding lines) Atria/Atria/AtriaAnalytics.swift:225 — Atria/Atria/AtriaAnalytics.swift:225-254 | Atria/Atria/AtriaAnalytics.swift:553-582 | Atria/Atria/AtriaAnalytics.swift:584-610 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 27 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 32+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 32+ corresponding lines) Atria/Atria/AtriaShareCard.swift:1699 — Atria/Atria/AtriaShareCard.swift:1699-1730 | Atria/Atria/AtriaShareCard.swift:2106-2138 | Atria/Atria/AtriaShareCard.swift:2482-2514 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 32 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 34+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 34+ corresponding lines) Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:400 — Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:400-436 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:438-471 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:473-506 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:508-545 | Atria/Atria/AtriaHistoricalVerifiedConsumerReader.swift:547-584 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 34 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 24+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 24+ corresponding lines) Atria/Atria/AtriaShareCard.swift:1670 — Atria/Atria/AtriaShareCard.swift:1670-1697 | Atria/Atria/AtriaShareCard.swift:2079-2104 | Atria/Atria/AtriaShareCard.swift:2431-2454 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 24 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 29+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 29+ corresponding lines) Atria/Atria/AtriaIMUDiagnosticTransport.swift:807 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:807-835 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:837-866 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:898-927 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:929-958 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 29 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 19+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 19+ corresponding lines) Atria/Atria/AtriaHistoricalGapLedger.swift:641 — Atria/Atria/AtriaHistoricalGapLedger.swift:641-659 | Atria/Atria/AtriaHistoricalGapLedger.swift:665-683 | Atria/Atria/AtriaHistoricalGapLedger.swift:685-707 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 19 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (30 corresponding lines) · ×1
  • Edited copy of a member (30 corresponding lines) Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:218 — Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:218-247 | Atria/Atria/AtriaHistoricalSealedCatalogMaterializer.swift:256-289 — These two members are one piece of code written twice and then edited apart: 30 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 23+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 23+ corresponding lines) Atria/Atria/AtriaActivityMonitor.swift:1537 — Atria/Atria/AtriaActivityMonitor.swift:1537-1559 | Atria/Atria/AtriaDeviceUseJournal.swift:165-187 | Atria/Atria/HistoricalArchive.swift:4249-4272 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 23 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 20+ corresponding lines) Atria/Atria/AtriaIMUDiagnosticTransport.swift:276 — Atria/Atria/AtriaIMUDiagnosticTransport.swift:276-295 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:297-316 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:318-337 | Atria/Atria/AtriaIMUDiagnosticTransport.swift:381-400 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 20+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 20+ corresponding lines) Atria/Atria/Sessions.swift:3063 — Atria/Atria/Sessions.swift:3063-3088 | Atria/Atria/Sessions.swift:5468-5487 | Atria/Atria/Sessions.swift:6565-6590 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 20 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 21+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 21+ corresponding lines) Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:284 — Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:284-310 | Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:319-339 | Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:348-372 | Atria/Atria/AtriaBLEBatteryTransportPolicy.swift:399-426 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 21 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 13+ corresponding lines) Atria/Atria/Sessions.swift:48009 — Atria/Atria/Sessions.swift:48009-48022 | Atria/Atria/Sessions.swift:55844-55856 | Atria/Atria/Sessions.swift:55858-55870 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 8+ corresponding lines) Atria/Atria/AtriaActiveSessionRestorePreparer.swift:397 — Atria/Atria/AtriaActiveSessionRestorePreparer.swift:397-404 | Atria/Atria/AtriaHistorySection.swift:55-63 | Atria/Atria/AtriaWhoop4CompactIMUCoverageGate.swift:152-160 | Atria/Atria/HealthKitExporter.swift:2045-2053 | Atria/Atria/Sessions.swift:54930-54938 | tools/replay_step_calibration.swift:484-491 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 10+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 10+ corresponding lines) Atria/Atria/AtriaVitalsCollectionSections.swift:1771 — Atria/Atria/AtriaVitalsCollectionSections.swift:1771-1784 | Atria/Atria/AtriaVitalsCollectionSections.swift:4310-4319 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1707-1722 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:1724-1739 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 10 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 8+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 8+ corresponding lines) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:258 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:258-265 | Atria/Atria/Sessions.swift:7238-7245 | Atria/Atria/Sessions.swift:56062-56069 | Atria/Atria/Sessions.swift:56221-56228 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 8 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 13+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 13+ corresponding lines) Atria/Atria/AtriaOverviewSections.swift:5488 — Atria/Atria/AtriaOverviewSections.swift:5488-5502 | Atria/Atria/AtriaOverviewSections.swift:5547-5559 | Atria/Atria/AtriaOverviewSections.swift:5561-5573 | Atria/Atria/AtriaOverviewSections.swift:5599-5611 | Atria/Atria/AtriaOverviewSections.swift:5613-5625 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 13 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (3 members, 15+ corresponding lines) · ×1
  • Edited copies of one member (3 members, 15+ corresponding lines) Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:184 — Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:184-198 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:202-218 | Atria/Atria/AtriaHistoricalConsumerProjectionCoordinator.swift:227-244 — These 3 members are one piece of code written 3 times and then edited apart: every two of them correspond over at least 15 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 3 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 4+ corresponding lines) Atria/Atria/AtriaAnalytics.swift:2378 — Atria/Atria/AtriaAnalytics.swift:2378-2381 | Atria/Atria/AtriaMonthlyReport.swift:200-203 | Atria/Atria/AtriaSleepWakeResearch.swift:1329-1332 | Atria/Atria/AtriaTrendChart.swift:462-465 | Atria/Atria/Sessions.swift:47529-47532 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (6 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 4+ corresponding lines) Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:287 — Atria/Atria/AtriaHistoricalActivityInspectionProofFactory.swift:287-290 | Atria/Atria/AtriaHistoricalActivityProjection.swift:804-808 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:639-643 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:988-991 | Atria/Atria/AtriaHistoricalFullScanCompletionStore.swift:367-370 | Atria/Atria/AtriaHistoricalLongTermRollup.swift:1013-1016 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 3+ corresponding lines) Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:375 — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:375-377 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:426-428 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:600-602 | Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.swift:450-452 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (61–62 lines × 2) · ×1
  • Duplicated block (61–62 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:4054 — Atria/Atria/AtriaActivityMonitor.swift:4054-4114 | Atria/Atria/AtriaActivityMonitor.swift:5091-5152 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaActivityMonitor.swift:4054` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (47–49 lines × 2) · ×1
  • Duplicated block (47–49 lines × 2) Atria/Atria/Sessions.swift:2056 — Atria/Atria/Sessions.swift:2056-2104 | Atria/Atria/Sessions.swift:56702-56748 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:2056` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (45–48 lines × 2) · ×1
  • Duplicated block (45–48 lines × 2) REDACTED:7609 — REDACTED:7609-7656 | REDACTED:7714-7758 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:7609` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (43–44 lines × 2) · ×1
  • Duplicated block (43–44 lines × 2) Atria/Atria/Sessions.swift:23659 — Atria/Atria/Sessions.swift:23659-23701 | Atria/Atria/Sessions.swift:23853-23896 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:23659` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (35–45 lines × 2) · ×1
  • Duplicated block (35–45 lines × 2) Atria/Atria/Sessions.swift:33020 — Atria/Atria/Sessions.swift:33020-33064 | Atria/Atria/Sessions.swift:33181-33215 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–41 lines × 5) · ×1
  • Duplicated block (10–41 lines × 5) Atria/Atria/AtriaAboutMetricSheet.swift:57 — Atria/Atria/AtriaAboutMetricSheet.swift:57-66 | Atria/Atria/AtriaAboutMetricSheet.swift:88-97 | Atria/Atria/AtriaAboutMetricSheet.swift:122-140 | Atria/Atria/AtriaAboutMetricSheet.swift:164-204 | Atria/Atria/AtriaAboutMetricSheet.swift:211-235 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaAboutMetricSheet.swift:57` 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.
D4 · Code Duplication · Duplicated block (36–41 lines × 2) · ×1
  • Duplicated block (36–41 lines × 2) Atria/Atria/AtriaOverviewSections.swift:3277 — Atria/Atria/AtriaOverviewSections.swift:3277-3312 | Atria/Atria/AtriaSettingsView.swift:2254-2294 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (32–40 lines × 2) · ×1
  • Duplicated block (32–40 lines × 2) REDACTED:47036 — REDACTED:47036-47075 | REDACTED:47243-47274 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (39 lines × 2) · ×1
  • Duplicated block (39 lines × 2) Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:356 — Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:356-394 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:756-794 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (30–36 lines × 2) · ×1
  • Duplicated block (30–36 lines × 2) Atria/Atria/Sessions.swift:56565 — Atria/Atria/Sessions.swift:56565-56600 | Atria/Atria/Sessions.swift:56624-56653 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (27–35 lines × 2) · ×1
  • Duplicated block (27–35 lines × 2) Atria/Atria/Sessions.swift:22426 — Atria/Atria/Sessions.swift:22426-22452 | Atria/Atria/Sessions.swift:22556-22590 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:22426` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (34–35 lines × 2) · ×1
  • Duplicated block (34–35 lines × 2) Atria/Atria/Sessions.swift:33803 — Atria/Atria/Sessions.swift:33803-33836 | Atria/Atria/Sessions.swift:34549-34583 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:33803` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (24–32 lines × 3) · ×1
  • Duplicated block (24–32 lines × 3) Atria/Atria/ActiveSessionJournal.swift:527 — Atria/Atria/ActiveSessionJournal.swift:527-550 | Atria/Atria/ActiveSessionJournal.swift:750-781 | Atria/Atria/ActiveSessionJournal.swift:903-934 — 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 `Atria/Atria/ActiveSessionJournal.swift:527` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (28–32 lines × 2) · ×1
  • Duplicated block (28–32 lines × 2) Atria/Atria/Sessions.swift:986 — Atria/Atria/Sessions.swift:986-1013 | Atria/Atria/Sessions.swift:1049-1080 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:986` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (26–31 lines × 2) · ×1
  • Duplicated block (26–31 lines × 2) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:639 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:639-669 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:248-273 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) Atria/Atria/AtriaFullFidelityColdSessionStore.swift:412 — Atria/Atria/AtriaFullFidelityColdSessionStore.swift:412-438 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:593-620 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24–28 lines × 2) · ×1
  • Duplicated block (24–28 lines × 2) Atria/Atria/AtriaOverviewSections.swift:1620 — Atria/Atria/AtriaOverviewSections.swift:1620-1643 | Atria/Atria/AtriaTodayScreen.swift:4712-4739 — 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 `Atria/Atria/AtriaOverviewSections.swift:1620` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `spacing` to `6` in one and `4` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (26–28 lines × 2) · ×1
  • Duplicated block (26–28 lines × 2) Atria/Atria/Sessions.swift:23722 — Atria/Atria/Sessions.swift:23722-23747 | Atria/Atria/Sessions.swift:23922-23949 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:23722` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (23–27 lines × 2) · ×1
  • Duplicated block (23–27 lines × 2) Atria/Atria/Dashboard.swift:500 — Atria/Atria/Dashboard.swift:500-526 | Atria/Atria/Dashboard.swift:599-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 `Atria/Atria/Dashboard.swift:500` 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 first that the copies are not typed on the same thing: the declarations holding them bind `recovery` to `Int?` in one and `Int` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (21–27 lines × 2) · ×1
  • Duplicated block (21–27 lines × 2) Atria/Atria/HistoricalArchive.swift:8744 — Atria/Atria/HistoricalArchive.swift:8744-8764 | Atria/Atria/HistoricalArchive.swift:8795-8821 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:8744` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–27 lines × 2) · ×1
  • Duplicated block (22–27 lines × 2) Atria/Atria/Sessions.swift:34769 — Atria/Atria/Sessions.swift:34769-34795 | Atria/Atria/Sessions.swift:35594-35615 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:34769` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (25 lines × 2) · ×1
  • Duplicated block (25 lines × 2) REDACTED:25082 — REDACTED:25082-25106 | REDACTED:25122-25146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (23–25 lines × 2) · ×1
  • Duplicated block (23–25 lines × 2) Atria/Atria/Sessions.swift:19113 — Atria/Atria/Sessions.swift:19113-19137 | Atria/Atria/Sessions.swift:19421-19443 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:19113` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (24–25 lines × 2) · ×1
  • Duplicated block (24–25 lines × 2) Atria/Atria/Sessions.swift:22774 — Atria/Atria/Sessions.swift:22774-22798 | Atria/Atria/Sessions.swift:23044-23067 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (24 lines × 2) · ×1
  • Duplicated block (24 lines × 2) Atria/Atria/AtriaShareCard.swift:1635 — Atria/Atria/AtriaShareCard.swift:1635-1658 | Atria/Atria/AtriaShareCard.swift:2054-2077 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaShareCard.swift:1635` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaShareCard.swift:1633` calls `UUID` and `Atria/Atria/AtriaShareCard.swift:2052` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (20–24 lines × 2) · ×1
  • Duplicated block (20–24 lines × 2) Atria/Atria/HistoricalArchive.swift:2364 — Atria/Atria/HistoricalArchive.swift:2364-2387 | Atria/Atria/HistoricalArchive.swift:2490-2509 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:2364` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (22–24 lines × 2) · ×1
  • Duplicated block (22–24 lines × 2) Atria/Atria/Sessions.swift:44690 — Atria/Atria/Sessions.swift:44690-44711 | Atria/Atria/Sessions.swift:44767-44790 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:44690` 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (22–23 lines × 2) · ×1
  • Duplicated block (22–23 lines × 2) REDACTED:41435 — REDACTED:41435-41457 | REDACTED:41803-41824 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41435` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (20–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) REDACTED:54289 — REDACTED:54289-54311 | REDACTED:55106-55125 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) Atria/Atria/Sessions.swift:17246 — Atria/Atria/Sessions.swift:17246-17268 | Atria/Atria/Sessions.swift:17348-17368 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:17246` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `budgetSeconds` to `TimeInterval = 240` in one and `TimeInterval` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (16–22 lines × 4) · ×1
  • Duplicated block (16–22 lines × 4) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:292 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:292-307 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:266-281 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1040-1055 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1045-1066 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (16–22 lines × 2) · ×1
  • Duplicated block (16–22 lines × 2) Atria/Atria/AtriaActivityMonitor.swift:2810 — Atria/Atria/AtriaActivityMonitor.swift:2810-2831 | Atria/Atria/AtriaActivityMonitor.swift:2916-2931 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaActivityMonitor.swift:2810` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (20–22 lines × 2) · ×1
  • Duplicated block (20–22 lines × 2) Atria/Atria/WidgetSnapshot.swift:293 — Atria/Atria/WidgetSnapshot.swift:293-312 | Atria/Atria/WidgetSnapshot.swift:1105-1126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (21 lines × 3) · ×1
  • Duplicated block (21 lines × 3) Atria/Atria/HistoricalArchive.swift:10153 — Atria/Atria/HistoricalArchive.swift:10153-10173 | Atria/Atria/HistoricalArchive.swift:10299-10319 | Atria/Atria/HistoricalArchive.swift:10462-10482 — 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 `Atria/Atria/HistoricalArchive.swift:10153` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (19–21 lines × 3) · ×1
  • Duplicated block (19–21 lines × 3) Atria/Atria/Sessions.swift:34758 — Atria/Atria/Sessions.swift:34758-34777 | Atria/Atria/Sessions.swift:34839-34859 | Atria/Atria/Sessions.swift:35583-35601 — 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 `Atria/Atria/Sessions.swift:34758` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (19–21 lines × 2) · ×1
  • Duplicated block (19–21 lines × 2) REDACTED:24302 — REDACTED:24302-24320 | REDACTED:24332-24352 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:24302` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–21 lines × 2) · ×1
  • Duplicated block (18–21 lines × 2) Atria/Atria/Sessions.swift:16572 — Atria/Atria/Sessions.swift:16572-16592 | Atria/Atria/Sessions.swift:16610-16627 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:16572` 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 `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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (16–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) Atria/Atria/AtriaHomeView.swift:3892 — Atria/Atria/AtriaHomeView.swift:3892-3911 | Atria/Atria/AtriaHomeView.swift:12612-12627 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (15–18 lines × 3) · ×1
  • Duplicated block (15–18 lines × 3) Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:581 — Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:581-598 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:193-207 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:210-224 — before extracting anything, compare `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift` and `Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 140 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:581` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (14–18 lines × 2) · ×1
  • Duplicated block (14–18 lines × 2) Atria/Atria/AtriaOverviewSections.swift:1691 — Atria/Atria/AtriaOverviewSections.swift:1691-1708 | Atria/Atria/AtriaOverviewSections.swift:2366-2379 — both copies are in the same file, so extract the 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 `Atria/Atria/AtriaOverviewSections.swift:1691` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) Atria/Atria/AtriaHistoricalActivityProjection.swift:420 — Atria/Atria/AtriaHistoricalActivityProjection.swift:420-436 | Atria/Atria/AtriaHistoricalDailyConsumerProjection.swift:686-698 — 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 `Atria/Atria/AtriaHistoricalActivityProjection.swift:420` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–17 lines × 2) · ×1
  • Duplicated block (14–17 lines × 2) Atria/Atria/Sessions.swift:36055 — Atria/Atria/Sessions.swift:36055-36071 | Atria/Atria/Sessions.swift:36139-36152 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (9–16 lines × 4) · ×1
  • Duplicated block (9–16 lines × 4) Atria/Atria/AtriaActivityMonitor.swift:5399 — Atria/Atria/AtriaActivityMonitor.swift:5399-5414 | Atria/Atria/AtriaStressDetailView.swift:1528-1536 | Atria/Atria/AtriaStressDetailView.swift:1803-1811 | Atria/Atria/AtriaVitalsCollectionSections.swift:3308-3316 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaActivityMonitor.swift:5399` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaVitalsCollectionSections.swift:3325` calls `atriaGraphPlotSurface` and `Atria/Atria/AtriaStressDetailView.swift:1814` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (15–16 lines × 3) · ×1
  • Duplicated block (15–16 lines × 3) Atria/Atria/HistoricalArchive.swift:5831 — Atria/Atria/HistoricalArchive.swift:5831-5845 | Atria/Atria/HistoricalArchive.swift:5922-5937 | Atria/Atria/HistoricalArchive.swift:5954-5969 — 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 `Atria/Atria/HistoricalArchive.swift:5831` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (16 lines × 3) · ×1
  • Duplicated block (16 lines × 3) Atria/Atria/Sessions.swift:18637 — Atria/Atria/Sessions.swift:18637-18652 | Atria/Atria/Sessions.swift:18676-18691 | Atria/Atria/Sessions.swift:18825-18840 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–16 lines × 4) · ×1
  • Duplicated block (7–16 lines × 4) Atria/Atria/AtriaHomeView.swift:10749 — Atria/Atria/AtriaHomeView.swift:10749-10764 | Atria/Atria/AtriaHomeView.swift:10766-10782 | Atria/Atria/AtriaHomeView.swift:10784-10790 | Atria/Atria/AtriaHomeView.swift:10801-10807 — 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 `Atria/Atria/AtriaHomeView.swift:10749` 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.
D4 · Code Duplication · Duplicated block (13–16 lines × 2) · ×1
  • Duplicated block (13–16 lines × 2) Atria/Atria/AtriaTodayScreen.swift:149 — Atria/Atria/AtriaTodayScreen.swift:149-164 | Atria/Atria/AtriaVitalsCollectionSections.swift:116-128 — 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 `Atria/Atria/AtriaTodayScreen.swift:149` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–16 lines × 2) · ×1
  • Duplicated block (12–16 lines × 2) Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2967 — Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:2967-2982 | tools/replay_whoop4_compact_steps.swift:45-56 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–15 lines × 3) · ×1
  • Duplicated block (13–15 lines × 3) Atria/Atria/AtriaMetricTargets.swift:454 — Atria/Atria/AtriaMetricTargets.swift:454-468 | Atria/Atria/AtriaOverviewSections.swift:3160-3172 | Atria/Atria/AtriaVitalsCollectionSections.swift:2379-2393 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaMetricTargets.swift:454` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:937 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:937-951 | Atria/Atria/AtriaWhoop4MotionTickCompactStore.swift:3160-3174 | Atria/Atria/HistoricalArchive.swift:4258-4272 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:937` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–15 lines × 3) · ×1
  • Duplicated block (3–15 lines × 3) Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1493 — Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1493-1506 | Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1516-1530 | Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1628-1630 — 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 `Atria/Atria/AtriaWhoop4MotionTickStepModel.swift:1493` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (13–15 lines × 2) · ×1
  • Duplicated block (13–15 lines × 2) Atria/Atria/HistoricalArchive.swift:3924 — Atria/Atria/HistoricalArchive.swift:3924-3936 | Atria/Atria/HistoricalArchive.swift:6652-6666 — both copies are in the same file, so extract the 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 `Atria/Atria/HistoricalArchive.swift:3924` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (12–15 lines × 2) · ×1
  • Duplicated block (12–15 lines × 2) Atria/Atria/Sessions.swift:14023 — Atria/Atria/Sessions.swift:14023-14037 | Atria/Atria/Sessions.swift:14144-14155 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–15 lines × 2) · ×1
  • Duplicated block (8–15 lines × 2) Atria/Atria/Sessions.swift:23264 — Atria/Atria/Sessions.swift:23264-23278 | Atria/Atria/Sessions.swift:23388-23395 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11–14 lines × 4) · ×1
  • Duplicated block (11–14 lines × 4) Atria/Atria/AtriaActivityMonitor.swift:5374 — Atria/Atria/AtriaActivityMonitor.swift:5374-5384 | Atria/Atria/AtriaStressDetailView.swift:1476-1489 | Atria/Atria/AtriaStressDetailView.swift:1789-1799 | Atria/Atria/AtriaVitalsCollectionSections.swift:3270-3283 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (13–14 lines × 4) · ×1
  • Duplicated block (13–14 lines × 4) Atria/Atria/HistoricalArchive.swift:5833 — Atria/Atria/HistoricalArchive.swift:5833-5846 | Atria/Atria/HistoricalArchive.swift:5897-5909 | Atria/Atria/HistoricalArchive.swift:5925-5938 | Atria/Atria/HistoricalArchive.swift:5957-5970 — 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 `Atria/Atria/HistoricalArchive.swift:5833` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–14 lines × 3) · ×1
  • Duplicated block (8–14 lines × 3) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:77 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:77-84 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:228-239 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:269-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 all 3 call sites, so a change lands once.
D4 · Code Duplication · Duplicated block (11–14 lines × 3) · ×1
  • Duplicated block (11–14 lines × 3) Atria/Atria/Sessions.swift:23288 — Atria/Atria/Sessions.swift:23288-23301 | Atria/Atria/Sessions.swift:23402-23412 | Atria/Atria/Sessions.swift:24688-24699 — 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 `Atria/Atria/Sessions.swift:23288` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–14 lines × 2) · ×1
  • Duplicated block (11–14 lines × 2) REDACTED:41482 — REDACTED:41482-41492 | REDACTED:42341-42354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:41482` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–14 lines × 2) · ×1
  • Duplicated block (6–14 lines × 2) Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:160 — Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:160-165 | Atria/Atria/AtriaWhoop4MotionBankCoverageLedger.swift:381-394 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (12–14 lines × 2) · ×1
  • Duplicated block (12–14 lines × 2) Atria/Atria/Sessions.swift:24049 — Atria/Atria/Sessions.swift:24049-24060 | Atria/Atria/Sessions.swift:24155-24168 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (13 lines × 4) · ×1
  • Duplicated block (13 lines × 4) REDACTED:26759 — REDACTED:26759-26771 | REDACTED:26804-26816 | REDACTED:26879-26891 | REDACTED:26945-26957 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:26759` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:26876` calls `set` and `REDACTED:26942` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×1
  • Duplicated block (13 lines × 3) Atria/Atria/AtriaHomeView.swift:13323 — Atria/Atria/AtriaHomeView.swift:13323-13335 | Atria/Atria/AtriaHomeView.swift:13513-13525 | Atria/Atria/AtriaTodayScreen.swift:1768-1780 — 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 `Atria/Atria/AtriaHomeView.swift:13323` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) Atria/Atria/AtriaShareCard.swift:2986 — Atria/Atria/AtriaShareCard.swift:2986-2998 | Atria/Atria/AtriaShareCard.swift:3023-3034 | Atria/Atria/AtriaShareCard.swift:3062-3074 — 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 `Atria/Atria/AtriaShareCard.swift:2986` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×1
  • Duplicated block (9–13 lines × 2) Atria/Atria/ActiveSessionJournal.swift:982 — Atria/Atria/ActiveSessionJournal.swift:982-990 | Atria/Atria/Sessions.swift:38878-38890 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×1
  • Duplicated block (11–13 lines × 2) Atria/Atria/LocalNotificationScheduler.swift:288 — Atria/Atria/LocalNotificationScheduler.swift:288-300 | Atria/Atria/LocalNotificationScheduler.swift:943-953 — both copies are in the same file, so extract the 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 `Atria/Atria/LocalNotificationScheduler.swift:288` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (9–12 lines × 9) · ×1
  • Duplicated block (9–12 lines × 9) Atria/Atria/LocalNotificationScheduler.swift:248 — Atria/Atria/LocalNotificationScheduler.swift:248-256 | Atria/Atria/LocalNotificationScheduler.swift:294-302 | Atria/Atria/LocalNotificationScheduler.swift:393-401 | Atria/Atria/LocalNotificationScheduler.swift:511-519 | Atria/Atria/LocalNotificationScheduler.swift:571-579 | Atria/Atria/LocalNotificationScheduler.swift:831-839 | Atria/Atria/LocalNotificationScheduler.swift:947-955 | Atria/Atria/LocalNotificationScheduler.swift:1001-1012 | Atria/Atria/LocalNotificationScheduler.swift:1075-1083 — all 9 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 `Atria/Atria/LocalNotificationScheduler.swift:248` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–12 lines × 6) · ×1
  • Duplicated block (8–12 lines × 6) Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:298 — Atria/Atria/AtriaBLEHistoryRequestAuthorityStore.swift:298-305 | Atria/Atria/AtriaBLEHistoryTerminalPublicationStore.swift:272-279 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1046-1053 | Atria/Atria/AtriaWhoop4ExactRangeTrialHarness.swift:1054-1064 | Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:80-88 | Atria/Atria/AtriaWhoop4MotionTickDailyStore.swift:593-604 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaWhoop4HistorySequenceContinuityStore.swift:80` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–12 lines × 3) · ×1
  • Duplicated block (6–12 lines × 3) Atria/Atria/AtriaActivityMonitor.swift:5395 — Atria/Atria/AtriaActivityMonitor.swift:5395-5406 | Atria/Atria/AtriaHealthScreen.swift:3327-3332 | Atria/Atria/AtriaVitalsCollectionSections.swift:3305-3310 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaActivityMonitor.swift:5395` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (8–12 lines × 3) · ×1
  • Duplicated block (8–12 lines × 3) Atria/Atria/AtriaAnalytics.swift:33 — Atria/Atria/AtriaAnalytics.swift:33-41 | Atria/Atria/AtriaAnalytics.swift:110-117 | Atria/Atria/Sessions.swift:43376-43387 — 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 `Atria/Atria/AtriaAnalytics.swift:33` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) Atria/Atria/AtriaHistoricalAggregateReader.swift:197 — Atria/Atria/AtriaHistoricalAggregateReader.swift:197-208 | Atria/Atria/AtriaHistoricalAggregateReader.swift:373-384 | Atria/Atria/AtriaHistoricalAggregateReader.swift:634-644 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (6–12 lines × 4) · ×1
  • Duplicated block (6–12 lines × 4) Atria/Atria/HistoricalArchive.swift:4659 — Atria/Atria/HistoricalArchive.swift:4659-4664 | Atria/Atria/HistoricalArchive.swift:8045-8056 | Atria/Atria/HistoricalArchive.swift:8554-8562 | Atria/Atria/HistoricalArchive.swift:8588-8596 — 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 `Atria/Atria/HistoricalArchive.swift:4659` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–11 lines × 6) · ×1
  • Duplicated block (9–11 lines × 6) REDACTED:31822 — REDACTED:31822-31830 | Atria/Atria/AtriaRecoveredRRProjection.swift:659-667 | Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:719-729 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:310-320 | Atria/Atria/HistoricalArchive.swift:9612-9620 | tools/verify_whoop4_autonomous_step_corpus.swift:480-490 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:31822` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (11 lines × 4) · ×1
  • Duplicated block (11 lines × 4) Atria/Atria/AtriaTrendChart.swift:1736 — Atria/Atria/AtriaTrendChart.swift:1736-1746 | Atria/Atria/AtriaTrendChart.swift:1748-1758 | Atria/Atria/AtriaTrendChart.swift:1760-1770 | Atria/Atria/AtriaTrendChart.swift:1792-1802 — all 4 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (7–11 lines × 2) · ×1
  • Duplicated block (7–11 lines × 2) Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:484 — Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:484-494 | Atria/Atria/AtriaHistoricalRetiredReplayIndex.swift:668-674 — 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 `Atria/Atria/AtriaHistoricalLiveIdentityLookup.swift:484` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (3–11 lines × 3) · ×1
  • Duplicated block (3–11 lines × 3) Atria/Atria/AtriaShareCard.swift:1687 — Atria/Atria/AtriaShareCard.swift:1687-1697 | Atria/Atria/AtriaShareCard.swift:2094-2104 | Atria/Atria/AtriaShareCard.swift:2443-2445 — 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 `Atria/Atria/AtriaShareCard.swift:1687` 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 before the matched lines, `Atria/Atria/AtriaShareCard.swift:1686` calls `previewSize`, `clipShape`, `RoundedRectangle` and `Atria/Atria/AtriaShareCard.swift:2443` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) Atria/Atria/Sessions.swift:22850 — Atria/Atria/Sessions.swift:22850-22860 | Atria/Atria/Sessions.swift:23114-23121 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:22850` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (8–10 lines × 6) · ×1
  • Duplicated block (8–10 lines × 6) Atria/Atria/AtriaRecoveredRRProjection.swift:658 — Atria/Atria/AtriaRecoveredRRProjection.swift:658-665 | Atria/Atria/AtriaStrapCalibrationArchive.swift:701-708 | Atria/Atria/AtriaWhoop4SacrificialFastDrainReceiptVerifier.swift:718-727 | Atria/Atria/AtriaWhoop4SacrificialHistoryTrimReceiptVerifier.swift:309-318 | Atria/Atria/HistoricalArchive.swift:9611-9618 | tools/verify_whoop4_autonomous_step_corpus.swift:479-488 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 6 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 6 times. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (9–10 lines × 4) · ×1
  • Duplicated block (9–10 lines × 4) Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:488 — Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:488-497 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1111-1119 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1134-1143 | Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:1215-1224 — 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 `Atria/Atria/AtriaHistoricalFullDrainCoverageStore.swift:488` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–10 lines × 3) · ×1
  • Duplicated block (7–10 lines × 3) Atria/Atria/AtriaHealthScreen.swift:862 — Atria/Atria/AtriaHealthScreen.swift:862-871 | Atria/Atria/AtriaWidgetOvernightBoard.swift:106-112 | Atria/AtriaWidget/AtriaWidget.swift:304-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `calendar` to `Calendar` in one and `Calendar = .current` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) Atria/Atria/Sessions.swift:13625 — Atria/Atria/Sessions.swift:13625-13634 | Atria/Atria/Sessions.swift:14176-14185 | Atria/Atria/Sessions.swift:23524-23532 | Atria/Atria/Sessions.swift:23729-23737 | Atria/Atria/Sessions.swift:23928-23936 — all 5 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) Atria/Atria/ActiveSessionJournal.swift:1327 — Atria/Atria/ActiveSessionJournal.swift:1327-1335 | Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:724-732 | Atria/Atria/AtriaStrapStepLedger.swift:539-547 | Atria/Atria/Sessions.swift:7224-7232 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 4 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/Sessions.swift:7224` 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 register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/ActiveSessionJournal.swift:1323` calls `synchronizeDirectory`, `deletingLastPathComponent` and `Atria/Atria/AtriaHistoricalConsumerReceiptLedger.swift:720` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8–9 lines × 3) · ×1
  • Duplicated block (8–9 lines × 3) Atria/Atria/AtriaActiveSessionRestorePreparer.swift:166 — Atria/Atria/AtriaActiveSessionRestorePreparer.swift:166-174 | Atria/Atria/AtriaActiveSessionRestorePreparer.swift:177-185 | Atria/Atria/AtriaActiveSessionRestorePreparer.swift:187-194 — 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 `Atria/Atria/AtriaActiveSessionRestorePreparer.swift:166` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) Atria/Atria/AtriaSharedUIComponents.swift:790 — Atria/Atria/AtriaSharedUIComponents.swift:790-796 | Atria/Atria/Sessions.swift:61210-61218 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×1
  • Duplicated block (8 lines × 4) Atria/Atria/AtriaSleepWakeResearch.swift:25 — Atria/Atria/AtriaSleepWakeResearch.swift:25-32 | Atria/Atria/AtriaSleepWakeResearch.swift:70-77 | Atria/Atria/Sessions.swift:2075-2082 | Atria/Atria/Sessions.swift:56719-56726 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaSleepWakeResearch.swift:25` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (3–8 lines × 6) · ×1
  • Duplicated block (3–8 lines × 6) Atria/Atria/AtriaOverviewSections.swift:9192 — Atria/Atria/AtriaOverviewSections.swift:9192-9199 | Atria/Atria/AtriaOverviewSections.swift:9216-9223 | Atria/Atria/AtriaOverviewSections.swift:9238-9240 | Atria/Atria/AtriaOverviewSections.swift:9252-9259 | Atria/Atria/AtriaOverviewSections.swift:9276-9278 | Atria/Atria/AtriaOverviewSections.swift:9323-9325 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaOverviewSections.swift:9192` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Atria/Atria/AtriaOverviewSections.swift:9191` calls `ghostSeries`, `AtriaDetailPeriodSummary` and `Atria/Atria/AtriaOverviewSections.swift:9238` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (7–8 lines × 3) · ×1
  • Duplicated block (7–8 lines × 3) Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1272 — Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1272-1279 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1361-1367 | Atria/Atria/AtriaWhoop4HistoryAdmissionLedger.swift:1380-1386 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
D4 · Code Duplication · Duplicated block (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) Atria/Atria/AtriaActivityMonitor.swift:5376 — Atria/Atria/AtriaActivityMonitor.swift:5376-5382 | Atria/Atria/AtriaStressDetailView.swift:1478-1484 | Atria/Atria/AtriaStressDetailView.swift:1493-1499 | Atria/Atria/AtriaStressDetailView.swift:1791-1797 | Atria/Atria/AtriaVitalsCollectionSections.swift:3272-3278 | Atria/Atria/AtriaVitalsCollectionSections.swift:3287-3293 — there are 6 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 6 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaActivityMonitor.swift:5376` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×1
  • Duplicated block (6–7 lines × 3) Atria/Atria/HistoricalArchive.swift:3531 — Atria/Atria/HistoricalArchive.swift:3531-3536 | Atria/Atria/HistoricalArchive.swift:3814-3819 | Atria/Atria/HistoricalArchive.swift:4197-4203 — 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. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (5–6 lines × 2) · ×1
  • Duplicated block (5–6 lines × 2) Atria/Atria/Sessions.swift:51349 — Atria/Atria/Sessions.swift:51349-51353 | Atria/Atria/Sessions.swift:51361-51366 — both copies are in the same file, so extract the 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 `Atria/Atria/Sessions.swift:51361` 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.
D4 · Code Duplication · Duplicated block (6 lines × 6) · ×1
  • Duplicated block (6 lines × 6) REDACTED:25429 — REDACTED:25429-25434 | REDACTED:25652-25657 | REDACTED:26537-26542 | REDACTED:26877-26882 | REDACTED:26943-26948 | REDACTED:30744-30749 — all 6 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `REDACTED:25429` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `REDACTED:25428` calls `set` and `REDACTED:25651` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–5 lines × 7) · ×1
  • Duplicated block (3–5 lines × 7) Atria/Atria/AtriaEventNotificationScheduler.swift:318 — Atria/Atria/AtriaEventNotificationScheduler.swift:318-323 | Atria/Atria/AtriaStrainPacing.swift:19-21 | Atria/Atria/LocalNotificationScheduler.swift:2388-2392 | Atria/Atria/Sessions.swift:3396-3401 | Atria/Atria/Sessions.swift:14523-14527 | Atria/Atria/WidgetSnapshot.swift:1466-1474 | Atria/AtriaWidget/AtriaWidget.swift:112-119 — there are 7 copies across 6 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 7 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/LocalNotificationScheduler.swift:2388` 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.
D4 · Code Duplication · Duplicated block (70 lines × 2) · ×1
  • Duplicated block (70 lines × 2) Atria/Atria/AtriaGlanceSettings.swift:24 — Atria/Atria/AtriaGlanceSettings.swift:24-93 | Atria/AtriaWidget/AtriaGlanceSettings.swift:24-93 — `Atria/Atria/AtriaGlanceSettings.swift` and `Atria/AtriaWidget/AtriaGlanceSettings.swift` are one unit implemented once per sibling directory, so they are most likely parallel implementations of one contract rather than a copy of each other — this scan matched 1 separate duplicated blocks between them, totalling at least 70 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own. Read the line range as the matched WINDOW rather than a finished unit: at `Atria/Atria/AtriaGlanceSettings.swift:24` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (5 lines × 6) · ×1
  • Duplicated block (5 lines × 6) Atria/Atria/AtriaColdSessionFacts.swift:354 — Atria/Atria/AtriaColdSessionFacts.swift:354-358 | Atria/Atria/AtriaColdSessionStore.swift:383-387 | Atria/Atria/AtriaFullFidelityColdSessionStore.swift:925-929 | Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:425-430 | Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:462-466 | Atria/Atria/AtriaHistoricalSleepWorkoutProjections.swift:117-121 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 6 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Atria/Atria/AtriaHistoricalCanonicalConsumerDestinationStore.swift:470` calls `contains` and `Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:434` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Near-duplicate member pair (72 shared lines) · ×1
  • Near-duplicate member pair (72 shared lines) tools/replay_whoop4_day_steps.swift:17 — tools/replay_whoop4_day_steps.swift:17-147 | tools/verify_whoop4_autonomous_step_corpus.swift:309-413 — These two members are variants of one another: 72 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copies of one member (6 members, 3+ corresponding lines) · ×1
  • Edited copies of one member (6 members, 3+ corresponding lines) tools/strap-mac/ff_sweep.py:82 — tools/strap-mac/ff_sweep.py:82-84 | tools/strap-mac/flush_probe.py:62-64 | tools/strap-mac/night_capture.py:71-73 | tools/strap-mac/pairing_6a.py:55-57 | tools/strap-mac/r10_capture.py:89-91 | tools/strap-mac/r10r11_probe.py:73-75 — These 6 members are one piece of code written 6 times and then edited apart: every two of them correspond over at least 3 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 6 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (7 members, 2+ corresponding lines) · ×1
  • Edited copies of one member (7 members, 2+ corresponding lines) tools/strap-mac/ff_sweep.py:68 — tools/strap-mac/ff_sweep.py:68-69 | tools/strap-mac/flush_probe.py:48-49 | tools/strap-mac/night_capture.py:57-58 | tools/strap-mac/pairing_6a.py:41-42 | tools/strap-mac/pairing_window.py:40-41 | tools/strap-mac/r10_capture.py:75-76 | tools/strap-mac/r10r11_probe.py:59-60 — These 7 members are one piece of code written 7 times and then edited apart: every two of them correspond over at least 2 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 7 times and the copies will drift further apart.
D4 · Code Duplication · Edited copies of one member (4 members, 4+ corresponding lines) · ×1
  • Edited copies of one member (4 members, 4+ corresponding lines) tools/evaluate_activity_classifier.py:67 — tools/evaluate_activity_classifier.py:67-70 | tools/evaluate_overnight_load_model.py:43-46 | tools/evaluate_recovery_model.py:40-43 | tools/evaluate_sensor_decoder.py:41-44 — These 4 members are one piece of code written 4 times and then edited apart: every two of them correspond over at least 4 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 4 times and the copies will drift further apart.
D4 · Code Duplication · Edited copy of a member (1 corresponding lines) · ×1
  • Edited copy of a member (1 corresponding lines) tools/analyze_historical_archive.py:57 — tools/analyze_historical_archive.py:57-57 | tools/analyze_historical_usability.py:56-56 — These two members are one piece of code written twice and then edited apart: 1 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copies of one member (5 members, 1+ corresponding lines) · ×1
  • Edited copies of one member (5 members, 1+ corresponding lines) tools/strap-mac/overnight_watch.py:44 — tools/strap-mac/overnight_watch.py:44-46 | tools/strap-mac/pairing_6a.py:37-37 | tools/strap-mac/pairing_window.py:36-36 | tools/strap-mac/r10r11_probe.py:55-55 | tools/strap-mac/session.py:72-74 — These 5 members are one piece of code written 5 times and then edited apart: every two of them correspond over at least 1 lines, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below: the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain. Factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Left alone, the next edit has to be made 5 times and the copies will drift further apart.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) tools/replay_whoop4_day_steps.swift:92 — tools/replay_whoop4_day_steps.swift:92-108 | tools/verify_whoop4_autonomous_step_corpus.swift:381-400 — before extracting anything, compare `tools/replay_whoop4_day_steps.swift` and `tools/verify_whoop4_autonomous_step_corpus.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 91 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/replay_whoop4_day_steps.swift:92` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35–37 lines × 2) · ×1
  • Duplicated block (35–37 lines × 2) tools/analyze_historical_archive.py:97 — tools/analyze_historical_archive.py:97-133 | tools/analyze_historical_usability.py:193-227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (35 lines × 2) · ×1
  • Duplicated block (35 lines × 2) tools/analyze_historical_2f.py:648 — tools/analyze_historical_2f.py:648-682 | tools/analyze_historical_usability.py:239-273 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) tools/analyze_whoop4_gravity_walk.py:666 — tools/analyze_whoop4_gravity_walk.py:666-695 | tools/analyze_whoop4_gravity_walk.py:743-771 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (11 lines × 5) · ×1
  • Duplicated block (11 lines × 5) tools/strap-mac/ff_sweep.py:230 — tools/strap-mac/ff_sweep.py:230-240 | tools/strap-mac/flush_probe.py:242-252 | tools/strap-mac/night_capture.py:302-312 | tools/strap-mac/r10_capture.py:219-229 | tools/strap-mac/r10r11_probe.py:217-227 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (8–9 lines × 4) · ×1
  • Duplicated block (8–9 lines × 4) tools/evaluate_activity_classifier.py:133 — tools/evaluate_activity_classifier.py:133-141 | tools/evaluate_overnight_load_model.py:114-122 | tools/evaluate_recovery_model.py:137-145 | tools/evaluate_sensor_decoder.py:137-144 — before extracting anything, compare `tools/evaluate_activity_classifier.py` and `tools/evaluate_overnight_load_model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/evaluate_activity_classifier.py:133` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/evaluate_activity_classifier.py:142` calls `text` and `tools/evaluate_overnight_load_model.py:123` does not — after which the two agree again for 4 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) tools/evaluate_activity_classifier.py:237 — tools/evaluate_activity_classifier.py:237-244 | tools/evaluate_overnight_load_model.py:205-212 | tools/evaluate_recovery_model.py:223-230 | tools/evaluate_sensor_decoder.py:246-253 | tools/validate_research_corpus.py:295-302 — before extracting anything, compare `tools/evaluate_activity_classifier.py` and `tools/evaluate_overnight_load_model.py` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 31 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (3–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) tools/evaluate_overnight_load_model.py:122 — tools/evaluate_overnight_load_model.py:122-128 | tools/evaluate_recovery_model.py:148-153 | tools/evaluate_sensor_decoder.py:151-153 — before extracting anything, compare `tools/evaluate_overnight_load_model.py` and `tools/evaluate_recovery_model.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/evaluate_sensor_decoder.py:151` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `tools/evaluate_recovery_model.py:145` calls `EvaluationError`, `integer` and `tools/evaluate_overnight_load_model.py:121` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (3–5 lines × 3) · ×1
  • Duplicated block (3–5 lines × 3) tools/evaluate_overnight_load_model.py:131 — tools/evaluate_overnight_load_model.py:131-135 | tools/evaluate_recovery_model.py:156-160 | tools/evaluate_sensor_decoder.py:152-154 — before extracting anything, compare `tools/evaluate_overnight_load_model.py` and `tools/evaluate_recovery_model.py` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 43 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `tools/evaluate_overnight_load_model.py:131` 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 before the matched lines, `tools/evaluate_overnight_load_model.py:130` calls `key`, `text`, `time` and `tools/evaluate_sensor_decoder.py:152` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (6 lines × 7) · ×1
  • Duplicated block (6 lines × 7) tools/strap-mac/ff_sweep.py:73 — tools/strap-mac/ff_sweep.py:73-78 | tools/strap-mac/flush_probe.py:53-58 | tools/strap-mac/night_capture.py:62-67 | tools/strap-mac/pairing_6a.py:46-51 | tools/strap-mac/r10_capture.py:80-85 | tools/strap-mac/r10r11_probe.py:64-69 | tools/strap-mac/session.py:48-53 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 7 call sites, so a change lands once. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×1
  • Duplicated block (5 lines × 5) tools/strap-mac/ff_sweep.py:60 — tools/strap-mac/ff_sweep.py:60-64 | tools/strap-mac/pairing_6a.py:29-33 | tools/strap-mac/pairing_window.py:28-32 | tools/strap-mac/r10_capture.py:67-71 | tools/strap-mac/r10r11_probe.py:47-51 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from all 5 call sites, so a change lands once. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `tools/strap-mac/pairing_6a.py:36` calls `err_text` and `tools/strap-mac/ff_sweep.py:67` 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.
P2 · Observability · No structured logging · ×1
  • No structured logging — No logging or diagnostics emission found. This repository ships a binary its users launch rather than a service you operate, so there is no operator to page — but when a run fails on a user's machine, neither they nor you have anything to read.
X3 · Exception handling · Swallowed exception (empty catch) · ×1
  • Swallowed exception (empty catch) listen.py:59 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
Minor — 72 finding(s)
X10 · Duplicated predicate · Duplicated predicate · ×40
  • Duplicated predicate tools/analyze_historical_archive.py:113 — `best is None or ( current["overlap"], -current["separation"], current["end"], ) > ( best["overlap"], -best["separation"], best["end"], )` appears character-identically in 2 files — tools/analyze_historical_archive.py, tools/analyze_historical_usability.py. 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 tools/analyze_historical_archive.py:72 — `isinstance(data, dict) and isinstance(data.get("sessions"), list)` appears character-identically in 3 files — tools/analyze_historical_archive.py, tools/analyze_historical_usability.py, tools/analyze_sleep_store.py. 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 tools/analyze_historical_archive.py:206 — `isinstance(row.get("clockCorrectedUnix7"), int) and int(row["clockCorrectedUnix7"]) > 0` appears character-identically in 2 files — tools/analyze_historical_archive.py, tools/analyze_sleep_store.py. 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 tools/analyze_historical_archive.py:196 — `isinstance(row.get("unix7"), int) and int(row["unix7"]) > 0` appears character-identically in 2 files — tools/analyze_historical_archive.py, tools/analyze_sleep_store.py. 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 tools/verify_gate2_release_artifacts.py:60 — `isinstance(value, bool) or not isinstance(value, (int, float))` appears character-identically in 3 files — tools/verify_gate2_release_artifacts.py, tools/verify_hist1_acceptance.py, tools/verify_hist1_resumable_recovery.py. 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 tools/build_physical_window_manifests.py:102 — `isinstance(value, bool) or not isinstance(value, int)` appears character-identically in 3 files — tools/build_physical_window_manifests.py, tools/evaluate_activity_detection.py, tools/validate_research_corpus.py. 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 tools/strap-mac/ff_sweep.py:191 — `len(self.ready) == 5 and self.tx is not None and not self.started` appears character-identically in 2 files — tools/strap-mac/ff_sweep.py, tools/strap-mac/r10r11_probe.py. 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 tools/strap-mac/pairing_6a.py:155 — `len(value) == 152 and value[:5].hex() == "aa9400b533"` appears character-identically in 2 files — tools/strap-mac/pairing_6a.py, tools/strap-mac/pairing_window.py. 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 tools/preflight_reference_csv.py:205 — `lower.endswith("_ms") or "elapsed_ms" in lower or "timestamp_ms" in lower` appears character-identically in 3 files — tools/preflight_reference_csv.py, tools/validate_hr_reference.py, tools/validate_hrv_reference.py. 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 tools/analyze_historical_2f.py:649 — `not historical_times or not realtime_unix` appears character-identically in 2 files — tools/analyze_historical_2f.py, tools/analyze_historical_usability.py. 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 tools/build_physical_window_manifests.py:210 — `not isinstance(activity, str) or activity not in SUPPORTED_ACTIVITIES` appears character-identically in 2 files — tools/build_physical_window_manifests.py, tools/evaluate_activity_detection.py. 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 tools/verify_hist1_acceptance.py:329 — `not isinstance(row, dict) or not is_validated_metric_row(row, layouts)` appears character-identically in 2 files — tools/verify_hist1_acceptance.py, tools/verify_hist1_resumable_recovery.py. 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 tools/audit_handoff_status.py:159 — `not isinstance(value, str) or not value.endswith("Z")` appears character-identically in 2 files — tools/audit_handoff_status.py, tools/verify_physical_qualification.py. 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 tools/analyze_historical_2f.py:186 — `previous is not None and abs(value - previous) / previous > 0.20` appears character-identically in 2 files — tools/analyze_historical_2f.py, tools/analyze_live_rr_windows.py. 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 tools/build_physical_window_manifests.py:331 — `previous_end is not None and start_ms < previous_end` appears character-identically in 2 files — tools/build_physical_window_manifests.py, tools/evaluate_activity_detection.py. 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 tools/evaluate_activity_classifier.py:61 — `result < 0 or abs(result * 10 - round(result * 10)) > 0.000_001` appears character-identically in 4 files — tools/evaluate_activity_classifier.py, tools/evaluate_overnight_load_model.py, tools/evaluate_recovery_model.py, tools/evaluate_sensor_decoder.py. 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 tools/validate_hr_reference.py:212 — `same_file and not args.allow_self_compare` appears character-identically in 2 files — tools/validate_hr_reference.py, tools/validate_hrv_reference.py. 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 tools/verify_hist1_acceptance.py:333 — `timestamp is None or not isinstance(identity, str) or not identity` appears character-identically in 2 files — tools/verify_hist1_acceptance.py, tools/verify_hist1_resumable_recovery.py. 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 tools/analyze_historical_archive.py:51 — `value is None or not math.isfinite(value)` appears character-identically in 2 files — tools/analyze_historical_archive.py, tools/analyze_historical_usability.py. 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 Atria/Atria/AtriaHistoricalAggregateReader.swift:835 — `!value.isEmpty && URL(fileURLWithPath: value).lastPathComponent == value && value != "." && value != ".."` appears character-identically in 2 files — Atria/Atria/AtriaHistoricalAggregateReader.swift, Atria/Atria/AtriaHistoricalConsumerReceiptLedger.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 Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift:433 — `!value.isEmpty && value == URL(fileURLWithPath: value).lastPathComponent` appears character-identically in 2 files — Atria/Atria/AtriaHistoricalCanonicalConsumerApplicationStore.swift, Atria/Atria/AtriaHistoricalVerifiedActivityConsumerStore.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 Atria/Atria/AtriaClosedCycleStrainStore.swift:38 — `$0.end > interval.start && $0.start < interval.end` appears character-identically in 2 files — Atria/Atria/AtriaClosedCycleStrainStore.swift, Atria/Atria/AtriaHomeView.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 Atria/Atria/AtriaActivityMonitor.swift:364 — `$0.end > window.start && $0.start < window.end` appears character-identically in 3 files — Atria/Atria/AtriaActivityMonitor.swift, Atria/Atria/AtriaHealthScreen.swift, Atria/Atria/AtriaTodayScreen.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 Atria/Atria/AtriaStressDetailView.swift:1492 — `$0.motionContext.qualified && $0.motionContext.kind == .activity` appears character-identically in 2 files — Atria/Atria/AtriaStressDetailView.swift, Atria/Atria/AtriaVitalsCollectionSections.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 Atria/Atria/AtriaDailyStepPresentation.swift:671 — `$0.state == .missing && $0.knownCoverageSeconds > 0` appears character-identically in 2 files — Atria/Atria/AtriaDailyStepPresentation.swift, Atria/Atria/AtriaWhoop4MotionTickDailyStore.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.
  • + 15 more in this group — see findings.md.
X7 · Silent fallback defaults · Silent fallback default in catch · ×16
  • Silent fallback default in catch Atria/Atria/AtriaAICoach.swift:336 — `numberTokens` turns every thrown error into `[]` — 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 in catch Atria/Atria/AtriaLiveActivityCoordinator.swift:101 — `consumeClaimedFiles` turns every thrown error into `[]` — 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 in catch Atria/Atria/AtriaReconnectLeaseTrail.swift:59 — `contents` turns every thrown error into `""` — 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 in catch Atria/Atria/AtriaSettingsView.swift:1254 — `size` (in `storageFootprint`) 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 in catch Atria/Atria/AtriaSleepWakeResearch.swift:293 — `stageSegments` turns every thrown error into `[]` — 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 in catch Atria/Atria/AtriaStrapCalibrationArchive.swift:286 — `importArchivedCompactIMUJSONL` 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 in catch Atria/Atria/AtriaStrapCalibrationArchive.swift:335 — `materializeDecodedCompactIMUSamplesFromArchive` 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 in catch Atria/Atria/AtriaStrapCalibrationArchive.swift:386 — `lastNotifyCompactIMUDeviceTimestamps` turns every thrown error into `[]` — 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 in catch Atria/Atria/DailyRollupStore.swift:1169 — `loadRecoverySummaries` turns every thrown error into `[:]` — 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 in catch Atria/Atria/HistoricalArchive.swift:7855 — `legacyRotatedSegmentFileURLs` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:13852 — `coldSessionIndexForClosedCycles` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:13857 — `coldSessionsForClosedCycle` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:37525 — `makeNapReviewNightsForCache` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:43740 — `sleepStageResearchSegments` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:49992 — `aggregateSleepCandidates` turns every thrown error into `[]` — 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 in catch Atria/Atria/Sessions.swift:51612 — `resumedSleepReviewCandidates` turns every thrown error into `[]` — a data error becomes a silent behavior change with no trail. Log the error or let it propagate (`throws`). If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment at the `catch`, `guard` or `??`, or in the doc comment, and the row stops firing.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×5
  • Silent fallback default on parse failure tools/analyze_sensor_research_probe.py:29 — `parse_hex` returns `b''` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure tools/analyze_whoop4_gravity_walk.py:531 — `decoded_history_identity` returns `''` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure tools/audit_handoff_status.py:358 — `load_running_metadata` returns `{}` when `(OSError, ValueError, json.JSONDecodeError)` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure tools/audit_realtime_ble_validation.py:107 — `numeric` returns `0.0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
  • Silent fallback default on parse failure tools/verify_hist1_acceptance.py:58 — `positive_int` returns `0` when `ValueError` is raised, with no log or raise — a malformed value silently becomes that default. Log the input or fail validation. If that constant is the correct answer rather than a stand-in for a value that could not be read, say so in a comment on the handler or in the docstring, and the row stops firing.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×2
  • Projects may be oversized for their cohesion Atria/Atria.xcodeproj/project.pbxproj:1 — `Atria` (321023 LoC, 2311 module-visible types across 3 directories) overshoots its size bounds. 2 of 3 build unit(s) (SwiftPM, Xcode, checkout) overshoot their size bounds, lowering Project Cohesion to 0.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
  • Projects may be oversized for their cohesion — `(repository root)` (24422 LoC, 130 module-visible types across 4 directories) overshoots its size bounds. 2 of 3 build unit(s) (SwiftPM, Xcode, checkout) overshoot their size bounds, lowering Project Cohesion to 0.0/10. Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found Atria/Atria.xcodeproj/project.pbxproj:1 — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`. ADRs are expected here because `Atria/Atria.xcodeproj/project.pbxproj` makes this repository a deployable product (line 1).
D21 · Naming Consistency · `fallbackHrv` spells `Hrv` where 154 names in the project spell it `HRV` · ×1
  • `fallbackHrv` spells `Hrv` where 154 names in the project spell it `HRV` Atria/Atria/AtriaHomeView.swift:13429 — 154 of 155 names in project repository spell the token `HRV` (154 of 155; unit: names in project repository containing `HRV`). Peers: Estimate.usesHRV (Atria/Atria/AtriaAnalytics.swift:1348); Recovery.limitedEvidenceEstimateWithoutSleepOrHRV (Atria/Atria/AtriaAnalytics.swift:1616); Recovery.limitedEvidenceEstimateWithoutHRV (Atria/Atria/AtriaAnalytics.swift:1672); CalibrationExamples.recoveryHRV (Atria/Atria/AtriaAnalytics.swift:2417); CalibrationExamples.overnightPreferredHRVBaseline (Atria/Atria/AtriaAnalytics.swift:2559). Rename to `fallbackHRV`. [rule N6]
D21 · Naming Consistency · `lastGyroCsvKey` spells `Csv` where 36 names in the project spell it `CSV` · ×1
  • `lastGyroCsvKey` spells `Csv` where 36 names in the project spell it `CSV` Atria/Atria/AtriaWhoop4CompactIMU.swift:387 — 36 of 37 names in project repository spell the token `CSV` (36 of 37; unit: names in project repository containing `CSV`). Peers: AtriaBLEManager.exportCSV (REDACTED:30770); AtriaBLEManager.saveCaptureCSV (REDACTED:30782); AtriaBLEManager.saveCaptureCSV (REDACTED:30789); AtriaTodayMetric.glanceGridSize(sizeOverridesCSV) (Atria/Atria/AtriaOverviewSections.swift:1126); AtriaTodayMetric.glanceColumnSpan(sizeOverridesCSV) (Atria/Atria/AtriaOverviewSections.swift:1136). Rename to `lastGyroCSVKey`. [rule N6]
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
M2 · Architecture documentation · No ADRs · ×1
  • No ADRs — No Architecture Decision Records found — no conventional ADR directory, no numbered `NNNN-title` documents in any markup this check reads, and nothing ADR-shaped by content. Design rationale recorded elsewhere (a design-notes tree, a mailing list, pull-request discussion) is not visible to this check and is not re-findable per decision, so a future maintainer cannot ask why one choice was made and get an answer.
M3 · Folder & project structure · No src/ separation · ×1
  • No src/ separation — Most of the production code is in directories of its own, but 35 application file(s) sit at the repository root beside the build and tooling files (`enumerate.py`, `listen.py`, `prepare_reference_rr.py`, `probe.py`, `scan.py` and 30 more).
P1 · CI/CD gates · CI build step not evidenced · ×1
  • CI build step not evidenced — A CI pipeline exists but no build step was matched — changes may merge without the build ever running. A build step may be invoked directly as a command, or declared as a task that a runner named in the pipeline resolves.
P3 · Security & performance tooling · No SAST · ×1
  • No SAST REDACTED:6 — 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 1 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.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=0 --max-count=200" --report-format json --report-path /tmp/watchdog-gitleaks-96244c4c6d7a4a4d99fc95594ed9a28e/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=200 --max-count=800" --report-format json --report-path /tmp/watchdog-gitleaks-96244c4c6d7a4a4d99fc95594ed9a28e/history-1.json --exit-code 0 --source .9artifacts/raw/gitleaks-history-1.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --log-opts "--full-history --all --skip=1000 --max-count=1938" --report-format json --report-path /tmp/watchdog-gitleaks-96244c4c6d7a4a4d99fc95594ed9a28e/history-2.json --exit-code 0 --source .17artifacts/raw/gitleaks-history-2.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/canine-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-96244c4c6d7a4a4d99fc95594ed9a28e/tree.json --exit-code 0 --source .20artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/canine-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --exclude *.arrow --exclude *.avro --exclude *.csv --exclude *.dat --exclude *.db --exclude *.feather --exclude *.geojson --exclude *.h5 --exclude *.hdf5 --exclude *.jsonl --exclude *.log --exclude *.ndjson --exclude *.npy --exclude *.npz --exclude *.orc --exclude *.parquet --exclude *.pickle --exclude *.pkl --exclude *.psv --exclude *.sqlite --exclude *.sqlite3 --exclude *.tfrecord --exclude *.tsv --exclude *.txt .2artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesnone (no readable dependency manifest)—none (no readable dependency manifest): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).0—
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 39 file(s) — `Atria/Atria/AtriaAICoach.swift`, `Atria/Atria/AtriaActivityMonitor.swift`, `Atria/Atria/AtriaBLEHistoricalRecoveryPolicy.swift`, `Atria/Atria/AtriaBreathworkSession.swift`, `Atria/Atria/AtriaDaytimeQuiescentSleepDetector.swift`, … (+34 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesnone (no readable dependency manifest)—none (no readable dependency manifest): not applicable — Not scored — no dependency manifest in a supported ecosystem was read for this repository. A gap in the analyzer's language coverage, NOT a finding that the repository is free of vulnerable dependencies (a Python pyproject.toml/requirements.txt (pip/uv/Poetry), a Swift Package.swift/Package.resolved, a Cargo manifest, a Go module (go.mod/go.sum), a Gradle version catalogue, a Maven POM, an sbt build (build.sbt), composer.json, package.json, a Dart pubspec.yaml, an Elixir mix.exs/mix.lock (Hex), a rebar.config / erlang.mk DEPS (Hex), a Ruby Gemfile/Gemfile.lock or .gemspec (Bundler/RubyGems) — not scanned yet).0—

Run 01a1eae0-a20e-79d8-8266-2e34a96c9ce6 · every finding is also locatable in findings.md, and the complete scoring record (with exit codes + durations) in sidecar.json.

Downloadable artifacts

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

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