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

soniqo/speech-swift

Measured 29 October 2026, 14:05 UTC, at code version 9ce78ea

Regression: 1 dimension fell since the last survey

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

CAI score 61out of 100 At risk Up 2 since the last survey

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

A large codebase: 157,673 lines of product code in 70 projects, tests not counted · Estimated rebuild effort: about 1.7 person-years · Weakest lens: Production Readiness, 46

Findings by how serious they are

19 critical 1691 serious 211 minor

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

This survey was produced by

Watchdog
Producer
Canine Development
Analyzer
Watchdog engine 1.0.0
Measured
29 October 2026, 14:05 UTC

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

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

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

61of 61 dimensions measured by tools.
1852of 1921 findings point to an exact file and line, so you can open each one in the code. The other 69 concern the repository as a whole, such as missing documentation.
61dimensions across 6 lenses, read from 157,673 lines of product code in 70 projects.
Chapters

Executive summary

soniqo/speech-swift is rated At risk because critical security findings are open. Its score is held back in part because we found no automated security scanning of the code, its secrets or its dependencies. It scores 61 out of 100, which the At risk rating leaves unchanged. We judged it as a preview release, against a lower bar.

Production Readiness, at 46, is the weakest lens and counts most in the score. The best first step is protecting outgoing calls with timeouts, worth about 4 points. Adding a release approval comes next, worth about 3 points. Raising Production Readiness to 62 would lift the score to about 69.

Seven pipeline tools are referenced by a changeable name, so the build pipeline can be tampered with. Six known security holes in the packages the code depends on can be used by attackers, and five parts of the code are no longer understood by anyone working on it. Pinning each tool to an exact version, updating the vulnerable packages and having someone learn the forgotten files would close these risks. The password or key in the code's history needs replacing, with the old one switched off.

The product code is 157,673 lines, about €240,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 46 · counts for 46%Security and Compliance 71 · counts for 25%Code Health 77 · counts for 14%Performance 77 · counts for 8%Architecture 78 · counts for 4%Maturity 80 · counts for 2%

If Production Readiness rose from 46 to 62, the lowest score rated Strong, the score would rise from 61 to about 69.

Code composition: what the lines of code are
Product code 72%Tests 28%
New since the last survey: 215 findings

These 215 critical or serious findings weren't in the previous survey, on 15 October 2026. The first 100 are listed here, and the findings file in the download package lists them all.

  • Cyclomatic Complexity · GermanPhonemizer.normalizeNumbers (cyclomatic 91) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · GermanPhonemizer.mapConsonants (cyclomatic 71) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · FishAudioDrama3Config.parse (cyclomatic 59) Sources/FishAudioTTS/FishAudioDrama3Config.swift
  • Cyclomatic Complexity · BreezeTTSConfig.validate (cyclomatic 53) Sources/BreezeTTS/Options.swift
  • Cyclomatic Complexity · GermanPhonemizer.vowelPhoneme (cyclomatic 46) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · NativeInferenceRequest.validate (cyclomatic 35) Sources/AudioServer/NativeInference.swift
  • Cyclomatic Complexity · GermanPhonemizer.g2pLower (cyclomatic 31) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · Parser.parseValue (cyclomatic 29) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cyclomatic Complexity · FishDrama3Benchmark.run (cyclomatic 28) scripts/profiling/FishDrama3Benchmark.swift
  • Cyclomatic Complexity · PocketBenchmark.run (cyclomatic 27) Sources/PocketTTSBenchmark/main.swift
  • Cyclomatic Complexity · Gemma4ToolCodec.prompt (cyclomatic 27) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cyclomatic Complexity · MossTTSNanoTokenizer.encode (cyclomatic 26) Sources/MossTTSNano/MossTTSNanoTokenizer.swift
  • Cyclomatic Complexity · KyutaiSTTConfig.init (cyclomatic 24) Sources/KyutaiSTT/Configuration.swift
  • Cyclomatic Complexity · Gemma4UnifiedChat.generateResponse (cyclomatic 24) Sources/Qwen3Chat/Gemma4UnifiedChat.swift
  • Cyclomatic Complexity · export_breeze_mlx.export (cyclomatic 23) scripts/export_breeze_mlx.py
  • Cyclomatic Complexity · GermanPhonemizer.normalize (cyclomatic 22) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · MossTTSNanoSampler.sample (cyclomatic 22) Sources/MossTTSNano/MossTTSNanoSampling.swift
  • Cyclomatic Complexity · GermanPhonemizer.phonemize (cyclomatic 21) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · fish_drama3_reference.main (cyclomatic 21) scripts/fish_drama3_reference.py
  • Cyclomatic Complexity · BreezeTTSModel.generateStreaming (cyclomatic 20) Sources/BreezeTTS/BreezeTTSModel.swift
  • Cyclomatic Complexity · GermanPhonemizer.compound (cyclomatic 19) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · MossTTSNanoTokenizer.init (cyclomatic 19) Sources/MossTTSNano/MossTTSNanoTokenizer.swift
  • Cyclomatic Complexity · PocketTtsMimiKeys.discover (cyclomatic 19) Sources/PocketTTS/PocketTtsMimiKeys.swift
  • Cyclomatic Complexity · OpenAISpeech.swift.handleOpenAISpeech (cyclomatic 18) Sources/AudioServer/OpenAISpeech.swift
  • Cyclomatic Complexity · FishAudioDrama3Prompt.build (cyclomatic 18) Sources/FishAudioTTS/FishAudioDrama3Prompt.swift
  • Cyclomatic Complexity · GermanPhonemizer.findNuclei (cyclomatic 18) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · PocketSession.frame (cyclomatic 18) Sources/PocketTTS/PocketTTSModel.swift
  • Cyclomatic Complexity · BreezeTTSBenchmark.run (cyclomatic 18) scripts/profiling/BreezeTTSBenchmark.swift
  • Cyclomatic Complexity · profile_fish_drama3.main (cyclomatic 18) scripts/profiling/profile_fish_drama3.py
  • Cyclomatic Complexity · SpeakCommand.runFishDrama3 (cyclomatic 17) Sources/AudioCLILib/SpeakCommand.swift
  • Cyclomatic Complexity · GermanPhonemizer.expandAbbreviations (cyclomatic 17) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · MossTTSNanoModel.encodeReference (cyclomatic 17) Sources/MossTTSNano/MossTTSNanoModel.swift
  • Cyclomatic Complexity · Mimi.sanitizeWeights (cyclomatic 17) Sources/PersonaPlex/MimiCodec.swift
  • Cyclomatic Complexity · GermanPhonemizer.intToDe (cyclomatic 16) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cyclomatic Complexity · PocketTTSTokenizer.encode (cyclomatic 16) Sources/PocketTTS/PocketTTSTokenizer.swift
  • Cyclomatic Complexity · Gemma4ToolCodec.response (cyclomatic 16) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cyclomatic Complexity · RuntimeOwnershipStress.main (cyclomatic 16) scripts/profiling/RuntimeOwnershipStress.swift
  • Cognitive Complexity · GermanPhonemizer.normalizeNumbers (cognitive 168) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · GermanPhonemizer.mapConsonants (cognitive 110) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · BreezeTTSConfig.validate (cognitive 59) Sources/BreezeTTS/Options.swift
  • Cognitive Complexity · FishAudioDrama3Config.parse (cognitive 58) Sources/FishAudioTTS/FishAudioDrama3Config.swift
  • Cognitive Complexity · GermanPhonemizer.vowelPhoneme (cognitive 56) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · Gemma4ToolCodec.prompt (cognitive 53) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cognitive Complexity · GermanPhonemizer.g2pLower (cognitive 44) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · Parser.parseValue (cognitive 44) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cognitive Complexity · FishDrama3Benchmark.run (cognitive 43) scripts/profiling/FishDrama3Benchmark.swift
  • Cognitive Complexity · PocketBenchmark.run (cognitive 41) Sources/PocketTTSBenchmark/main.swift
  • Cognitive Complexity · Gemma4UnifiedChat.generateResponse (cognitive 41) Sources/Qwen3Chat/Gemma4UnifiedChat.swift
  • Cognitive Complexity · GermanPhonemizer.phonemize (cognitive 39) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · fish_drama3_reference.main (cognitive 37) scripts/fish_drama3_reference.py
  • Cognitive Complexity · NativeInferenceRequest.validate (cognitive 36) Sources/AudioServer/NativeInference.swift
  • Cognitive Complexity · GermanPhonemizer.compound (cognitive 36) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · export_breeze_mlx.export (cognitive 35) scripts/export_breeze_mlx.py
  • Cognitive Complexity · OpenAISpeech.swift.handleOpenAISpeech (cognitive 34) Sources/AudioServer/OpenAISpeech.swift
  • Cognitive Complexity · Mimi.sanitizeWeights (cognitive 34) Sources/PersonaPlex/MimiCodec.swift
  • Cognitive Complexity · GermanPhonemizer.expandAbbreviations (cognitive 32) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · GermanPhonemizer.normalize (cognitive 31) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · MossTTSNanoTokenizer.encode (cognitive 31) Sources/MossTTSNano/MossTTSNanoTokenizer.swift
  • Cognitive Complexity · Gemma4ToolCodec.schema::resolve (cognitive 31) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cognitive Complexity · PocketTTSTokenizer.encode (cognitive 30) Sources/PocketTTS/PocketTTSTokenizer.swift
  • Cognitive Complexity · BreezeTTSModel.generateStreaming (cognitive 28) Sources/BreezeTTS/BreezeTTSModel.swift
  • Cognitive Complexity · SpeakCommand.runFishDrama3 (cognitive 27) Sources/AudioCLILib/SpeakCommand.swift
  • Cognitive Complexity · PocketSession.frame (cognitive 27) Sources/PocketTTS/PocketTTSModel.swift
  • Cognitive Complexity · Gemma4ToolCodec.response (cognitive 27) Sources/Qwen3Chat/Gemma4Tools.swift
  • Cognitive Complexity · PocketTtsMimiKeys.discover (cognitive 26) Sources/PocketTTS/PocketTtsMimiKeys.swift
  • Cognitive Complexity · BreezeTTSBenchmark.run (cognitive 26) scripts/profiling/BreezeTTSBenchmark.swift
  • Cognitive Complexity · SpeakCommand.runVoxtral (cognitive 24) Sources/AudioCLILib/SpeakCommand.swift
  • Cognitive Complexity · SpeakCommand.runMossNano (cognitive 24) Sources/AudioCLILib/SpeakCommand+MossNano.swift
  • Cognitive Complexity · GermanPhonemizer.findNuclei (cognitive 24) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · KyutaiSTTConfig.init (cognitive 23) Sources/KyutaiSTT/Configuration.swift
  • Cognitive Complexity · MossTTSNanoSampler.sample (cognitive 23) Sources/MossTTSNano/MossTTSNanoSampling.swift
  • Cognitive Complexity · RuntimeOwnershipStress.main (cognitive 23) scripts/profiling/RuntimeOwnershipStress.swift
  • Cognitive Complexity · SpeakCommand.runPocket (cognitive 22) Sources/AudioCLILib/SpeakCommand.swift
  • Cognitive Complexity · GermanPhonemizer.intToDe (cognitive 22) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · profile_fish_drama3.main (cognitive 22) scripts/profiling/profile_fish_drama3.py
  • Cognitive Complexity · NativeInferenceService.perform (cognitive 21) Sources/AudioServer/NativeInference.swift
  • Cognitive Complexity · NativeInferenceService.registerRoutes (cognitive 21) Sources/AudioServer/NativeInference.swift
  • Cognitive Complexity · KokoroTTSModel.runModel (cognitive 21) Sources/KokoroTTS/KokoroTTS.swift
  • Cognitive Complexity · MossTTSNanoModel.synthesizeImpl (cognitive 21) Sources/MossTTSNano/MossTTSNanoModel.swift
  • Cognitive Complexity · KokoroTextChunker.pack (cognitive 20) Sources/KokoroTTS/TextChunker.swift
  • Cognitive Complexity · MossTTSNanoTokenizer.init (cognitive 20) Sources/MossTTSNano/MossTTSNanoTokenizer.swift
  • Cognitive Complexity · MossTTSNanoTokenizer.normalize (cognitive 20) Sources/MossTTSNano/MossTTSNanoTokenizer.swift
  • Cognitive Complexity · SpeakCommand.runBreeze (cognitive 19) Sources/AudioCLILib/SpeakCommand.swift
  • Cognitive Complexity · GermanPhonemizer.splitPrefix (cognitive 19) Sources/KokoroTTS/GermanPhonemizer.swift
  • Cognitive Complexity · RuntimeOwnershipProfile.micro (cognitive 19) scripts/profiling/RuntimeOwnershipProfile.swift
  • Cognitive Complexity · AsrBench.runIsolated (cognitive 18) Sources/AsrBenchmark/AsrBench.swift
  • Cognitive Complexity · FishAudioDrama3Prompt.build (cognitive 18) Sources/FishAudioTTS/FishAudioDrama3Prompt.swift
  • Cognitive Complexity · KokoroTextChunker.boundaryRank (cognitive 18) Sources/KokoroTTS/TextChunker.swift
  • Cognitive Complexity · VoxCPM2TTSModel.fromPretrained (cognitive 18) Sources/VoxCPM2TTS/VoxCPM2TTS.swift
  • Cognitive Complexity · profile_fish_drama3.summarize (cognitive 18) scripts/profiling/profile_fish_drama3.py
  • Cognitive Complexity · MossTTSNanoModel.encodeReference (cognitive 17) Sources/MossTTSNano/MossTTSNanoModel.swift
  • Cognitive Complexity · HuggingFaceDownloader.withDownloadRetries (cognitive 16) Sources/AudioCommon/HuggingFaceDownloader.swift
  • Cognitive Complexity · PocketTtsLayerKeys.discover (cognitive 16) Sources/PocketTTS/PocketTtsLayerKeys.swift
  • Cognitive Complexity · Parser.parseString (cognitive 16) Sources/Qwen3Chat/Gemma4Tools.swift
  • God Classes · ClassTooLong: GermanPhonemizer Sources/KokoroTTS/GermanPhonemizer.swift
  • God Classes · TooManyMethods: GermanPhonemizer Sources/KokoroTTS/GermanPhonemizer.swift
  • God Classes · FileTooLong: KokoroTTS/GermanPhonemizer.swift Sources/KokoroTTS/GermanPhonemizer.swift
  • God Classes · MethodTooLong: GermanPhonemizer.normalizeNumbers Sources/KokoroTTS/GermanPhonemizer.swift
  • God Classes · TooManyMethods: SpeakCommand Sources/AudioCLILib/SpeakCommand.swift
  • God Classes · ClassTooLong: HuggingFaceDownloader Sources/AudioCommon/HuggingFaceDownloader.swift

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

Fixed since the last survey: 37 findings

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

  • Cyclomatic Complexity · Mimi.sanitize (cyclomatic 17) Sources/PersonaPlex/MimiCodec.swift
  • Cyclomatic Complexity · KokoroTTSModel.synthesize (cyclomatic 16) Sources/KokoroTTS/KokoroTTS.swift
  • Cognitive Complexity · Mimi.sanitize (cognitive 34) Sources/PersonaPlex/MimiCodec.swift
  • Cognitive Complexity · KokoroTTSModel.synthesize (cognitive 22) Sources/KokoroTTS/KokoroTTS.swift
  • Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) Sources/AudioCLILib/TranscribeCommand.swift
  • Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) Sources/CanaryASR/CanaryASR+Loading.swift
  • Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/AudioServer/AudioServer.swift
  • Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/NemotronStreamingASR/NemotronStreamingASR.swift
  • Code Duplication · Duplicated block (39 lines × 2) Sources/MossTranscribe/MossMLXRuntime.swift
  • Code Duplication · Duplicated block (32–35 lines × 2) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift
  • Code Duplication · Duplicated block (23–24 lines × 2) Sources/KokoroTTS/KokoroTTS.swift
  • Code Duplication · Duplicated block (9–20 lines × 4) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift
  • Code Duplication · Duplicated block (17–19 lines × 3) Sources/SpeechVAD/FireRedVAD.swift
  • Code Duplication · Duplicated block (15–18 lines × 3) Sources/CanaryASR/CanaryASR+Loading.swift
  • Code Duplication · Duplicated block (13–18 lines × 2) Sources/CosyVoiceTTS/CosyVoiceTTS.swift
  • Code Duplication · Duplicated block (18 lines × 2) Sources/SpeechVAD/SileroVAD.swift
  • Code Duplication · Duplicated block (13–17 lines × 2) Sources/CanaryASR/CanaryASR+Loading.swift
  • Code Duplication · Duplicated block (11–16 lines × 3) Sources/CanaryASR/CanaryASR+Loading.swift
  • Code Duplication · Duplicated block (8–14 lines × 3) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift
  • Code Duplication · Duplicated block (7–13 lines × 5) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift
  • Code Duplication · Duplicated block (13 lines × 3) Sources/NemotronStreamingASR/NemotronStreamingASR.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/VoxtralASR/VoxtralASR.swift
  • Code Duplication · Duplicated block (10 lines × 2) Sources/SpeechVAD/ReDimNet2Speaker.swift
  • Code Duplication · Duplicated block (8 lines × 2) Sources/AsrBenchmark/Memory.swift
  • Code Duplication · Duplicated block (7 lines × 6) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/AudioServer/AudioServer.swift
  • Code Duplication · Duplicated block (7 lines × 2) Sources/FlashSR/Downloader.swift
  • Code Duplication · Duplicated block (5 lines × 2) Sources/KokoroTTS/KokoroModel.swift
  • Code Duplication · Duplicated block (15 lines × 2) Sources/SpeechVAD/SileroVAD+Memory.swift
  • Code Duplication · Duplicated block (5 lines × 2) Sources/Qwen3Chat/Gemma4Model.swift
  • Cohesion (LCOM4) · Low cohesion: ModelState (LCOM4 19) Sources/AudioServer/AudioServer.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/AsrBenchmark/Engine.swift Sources/AsrBenchmark/Engine.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/AudioCLILib/TranscribeCommand.swift Sources/AudioCLILib/TranscribeCommand.swift
  • Churn × Complexity Hotspots · Hotspot: Sources/AudioCommon/AudioIO.swift Sources/AudioCommon/AudioIO.swift
  • Supply-chain Provenance & Signing · REDACTED
  • Supply-chain Provenance & Signing · REDACTED
Rebuild cost: about €240,000 · Estimate
Cost to rebuild€81,000 to €410,000, for 1,344 to 4,264 hours of work, about 1.7 person-years for 1 to 4 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.8 at a score of 61. 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: 157,673 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: Watchdog prices the hours a team would need to write this code again, at €60 to €95 an hour. Declarations and boilerplate are priced at a fast rate and logic at a slower one, and the logic is then multiplied by the difficulty of the problem and by the quality factor. The estimate can be about 30% off either way, and it moves most with the hourly rate and the difficulty. For this code, every line is priced as straight logic, which keeps the estimate on the low side.

Top priorities

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

1
Bound every outbound call: pass `timeout:` to AsyncHTTPClient's `execute`, set `app.http.client.configuration.timeout` (with a `read` bound) or each `ClientRequest.timeout` for Vapor's client, and a `timeoutIntervalForRequest` on any `URLSessionConfiguration`; add retries with back-off around dependencies that fail.
Raises the score by about 4 points · Medium effort · Outbound HTTP resilience
2
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
Raises the score by about 3 points · Medium effort · Deployment & Rollback
3
Resolve the 259 Skipped test finding(s) in Test Quality — start with WeSpeakerTests.swift (14), PersonaPlexTests.swift (11), E2EFishAudioTTSTests.swift (10).
Raises the score by about 4 points · High effort · Test Quality

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 €240,000 to build again, about 1.7 person-years of work. Its weakest lens is Production Readiness, at 46 (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
Bound every outbound call: pass `timeout:` to AsyncHTTPClient's `execute`, set `app.http.client.configuration.timeout` (with a `read` bound) or each `ClientRequest.timeout` for Vapor's client, and a `timeoutIntervalForRequest` on any `URLSessionConfiguration`; add retries with back-off around dependencies that fail. Of all the actions in this report, it raises the score most for the work it takes: about 4 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 6.4 out of 10. Code at that level is slower to change than clean code, and Watchdog estimates the extra work at 4% to 9% on every change. The history of the code shows how much it changes: about 83,360 lines over the last 90 days, which is about 338,071 lines a year. At that pace, the extra work comes to an estimated 34.4 to 206.1 engineer-days a year, and it grows as more code changes.
How this is estimated: The number of changed lines is measured from the history of the code. The rest rests on two assumptions of Watchdog's own: code scoring 8 out of 10 or more adds no extra work, and each point below 8 adds 2.5% to 5.6% to every change, 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 AsrBenchmark AsrBenchmark AudioCommon AudioCommon AsrBenchmark->AudioCommon KyutaiSTT KyutaiSTT AsrBenchmark->KyutaiSTT MossTranscribe MossTranscribe AsrBenchmark->MossTranscribe NemotronStreamingASR NemotronStreamingASR AsrBenchmark->NemotronStreamingASR OmnilingualASR OmnilingualASR AsrBenchmark->OmnilingualASR Qwen3ASR Qwen3ASR AsrBenchmark->Qwen3ASR AudioCLILib AudioCLILib AudioCLILib->AudioCommon Clef Clef AudioCLILib->Clef HibikiTranslate HibikiTranslate AudioCLILib->HibikiTranslate IndexTTS2TTS IndexTTS2TTS AudioCLILib->IndexTTS2TTS AudioCLILib->KyutaiSTT MLXCommon MLXCommon AudioCLILib->MLXCommon MagpieTTS MagpieTTS AudioCLILib->MagpieTTS AudioCLILib->MossTranscribe AudioCLILib->NemotronStreamingASR AudioCLILib->OmnilingualASR PersonaPlex PersonaPlex AudioCLILib->PersonaPlex PocketTTS PocketTTS AudioCLILib->PocketTTS AudioCLILib->Qwen3ASR Qwen3ASRRuntime Qwen3ASRRuntime AudioCLILib->Qwen3ASRRuntime SpeechRuntime SpeechRuntime AudioCLILib->SpeechRuntime SpeechVAD SpeechVAD AudioCLILib->SpeechVAD AudioServer AudioServer AudioServer->AudioCommon AudioServer->HibikiTranslate AudioServer->MagpieTTS AudioServer->NemotronStreamingASR AudioServer->OmnilingualASR AudioServer->PersonaPlex AudioServer->PocketTTS AudioServer->Qwen3ASR AudioServer->Qwen3ASRRuntime Qwen3Chat Qwen3Chat AudioServer->Qwen3Chat AudioServer->SpeechRuntime AudioServer->SpeechVAD Clef->AudioCommon Clef->MLXCommon Clef->Qwen3Chat HibikiTranslate->AudioCommon HibikiTranslate->MLXCommon HibikiTranslate->PersonaPlex IndexTTS2TTS->AudioCommon IndexTTS2TTS->MLXCommon KyutaiSTT->AudioCommon KyutaiSTT->MLXCommon KyutaiSTT->PersonaPlex MLXCommon->AudioCommon MagpieTTS->AudioCommon MagpieTTS->MLXCommon MossTranscribe->AudioCommon MossTranscribe->MLXCommon NemotronStreamingASR->AudioCommon NemotronStreamingASR->MLXCommon OmnilingualASR->AudioCommon OmnilingualASR->MLXCommon PersonaPlex->AudioCommon PersonaPlex->MLXCommon PocketTTS->AudioCommon PocketTTS->SpeechRuntime Qwen3ASR->AudioCommon Qwen3ASR->MLXCommon Qwen3ASR->SpeechVAD Qwen3ASRRuntime->AudioCommon Qwen3ASRRuntime->Qwen3ASR Qwen3ASRRuntime->SpeechRuntime Qwen3Chat->AudioCommon Qwen3Chat->MLXCommon SpeechVAD->AudioCommon SpeechVAD->MLXCommon __more__ +50 more projects

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.

76 modules, with 383 dependencies between them. One loop runs through 43 of the modules, marked above the diagonal.

The table shows the 40 modules with the most connections; 36 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 AudioCommon2 Audio2Face3D3 CanaryASR4 FlashSR5 GLiNER6 MagpieTTS7 NemotronStreamingASR8 OmnilingualASR9 Qwen3TTS10 MossTranscribe11 ChatterboxTTS12 CohereTranscribeASR13 SpeechRuntime14 SpeechWakeWord15 VoiceChat16 VoxCPM2TTS17 CosyVoiceTTS18 HiggsTTS19 Qwen3ASR20 VibeVoiceTTS21 VoxtralTTS22 IndicMioTTS23 Qwen3Chat24 AudioServer25 MagpieTTSCoreML26 FishAudioTTS27 SpeechVAD28 HibikiTranslate29 PersonaPlex30 MLXCommon31 BreezeTTS32 IndexTTS2TTS33 SourceSeparation34 AudioCLILib35 KyutaiSTT36 MADLADTranslation37 MAGNeTMusicGen38 OmniVoiceTTS39 VoxtralASR40 AsrBenchmark
1 AudioCommon45
2 Audio2Face3D210
3 CanaryASR24
4 FlashSR23316
5 GLiNER119
6 MagpieTTS2231815
7 NemotronStreamingASR14341111328
8 OmnilingualASR3212108
9 Qwen3TTS22814164013
10 MossTranscribe51331241218
11 ChatterboxTTS22324125715
12 CohereTranscribeASR411111413
13 SpeechRuntime127
14 SpeechWakeWord211216
15 VoiceChat114212121922
16 VoxCPM2TTS21217311113211
17 CosyVoiceTTS32253111
18 HiggsTTS313259
19 Qwen3ASR146631523
20 VibeVoiceTTS425512103121
21 VoxtralTTS31226122013
22 IndicMioTTS31331212824
23 Qwen3Chat7221071222745
24 AudioServer6333384336337343431
25 MagpieTTSCoreML26141112
26 FishAudioTTS51261624329
27 SpeechVAD265131730
28 HibikiTranslate1211108
29 PersonaPlex4213910
30 MLXCommon1113
31 BreezeTTS2165421510
32 IndexTTS2TTS511211242135
33 SourceSeparation2114167
34 AudioCLILib313212913121
35 KyutaiSTT81119211
36 MADLADTranslation11411137
37 MAGNeTMusicGen2112312010
38 OmniVoiceTTS11321327
39 VoxtralASR3132211010
40 AsrBenchmark1324222722
Uses a module listed above itPart of a loopThe module itself
1 AudioCommon2 Audio2Face3D3 CanaryASR4 FlashSR5 GLiNER6 MagpieTTS7 NemotronStreamingASR8 OmnilingualASR9 Qwen3TTS10 MossTranscribe11 ChatterboxTTS12 CohereTranscribeASR13 SpeechRuntime14 SpeechWakeWord15 VoiceChat16 VoxCPM2TTS17 CosyVoiceTTS18 HiggsTTS19 Qwen3ASR20 VibeVoiceTTS21 VoxtralTTS22 IndicMioTTS23 Qwen3Chat24 AudioServer25 MagpieTTSCoreML26 FishAudioTTS27 SpeechVAD28 HibikiTranslate29 PersonaPlex30 MLXCommon31 BreezeTTS32 IndexTTS2TTS33 SourceSeparation34 AudioCLILib35 KyutaiSTT36 MADLADTranslation37 MAGNeTMusicGen38 OmniVoiceTTS39 VoxtralASR40 AsrBenchmarkAudioCommon1Audio2Face3D2CanaryASR3FlashSR4GLiNER5MagpieTTS6NemotronStreamingASR7OmnilingualASR8Qwen3TTS9MossTranscribe10ChatterboxTTS11CohereTranscribeASR12SpeechRuntime13SpeechWakeWord14VoiceChat15VoxCPM2TTS16CosyVoiceTTS17HiggsTTS18Qwen3ASR19VibeVoiceTTS20VoxtralTTS21IndicMioTTS22Qwen3Chat23AudioServer24MagpieTTSCoreML25FishAudioTTS26SpeechVAD27HibikiTranslate28PersonaPlex29MLXCommon30BreezeTTS31IndexTTS2TTS32SourceSeparation33AudioCLILib34KyutaiSTT35MADLADTranslation36MAGNeTMusicGen37OmniVoiceTTS38VoxtralASR39AsrBenchmark4045210242331611922318151434111132832121082281416401351331241218223241257154111114131272112161142121219222121731111321132253111313259146631523425512103121312261220133133121282472210712227456333384336337343431261411125126162432926513173012111084213910111321654215105112112421352114167313212913121811192111141113721123120101132132731322110101324222722+36 more modules (most-connected shown)

At a glance — Code Health · 77% · Adequate · gated by D2 ·

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

At a glance — Maturity · 80% · Strong ·

At a glance — Readiness · 46% · Adequate · gated by P3, P7 ·

At a glance — Security · 71% · Adequate · gated by D30, D36 ·

At a glance — Performance · 77% · Strong ·

Security & Compliance — OWASP Top-10 mapping

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

OWASP categoryFindingsSeverity
A03:2025 — Software Supply Chain Failures17High / Critical
A05:2025 — Injection7High / Critical
A07:2025 — Authentication Failures2High / Critical

Roadmap

First, harden outbound HTTP calls by enforcing strict timeouts and adding retry logic to prevent cascading failures. Next, immediately address the three high-severity dependency vulnerabilities to secure the codebase. Then, improve test reliability by resolving the skipped tests and adding assertions to the identified test files. Finally, implement a draft release or manual gate to ensure bad builds cannot be accidentally published to users.

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

Do thisHelpsEffortDimension
Bound every outbound call: pass `timeout:` to AsyncHTTPClient's `execute`, set `app.http.client.configuration.timeout` (with a `read` bound) or each `ClientRequest.timeout` for Vapor's client, and a `timeoutIntervalForRequest` on any `URLSessionConfiguration`; add retries with back-off around dependencies that fail.+4.4 ptsMediumOutbound HTTP resilience
Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.+2.6 ptsMediumDeployment & Rollback
Resolve the 259 Skipped test finding(s) in Test Quality — start with WeSpeakerTests.swift (14), PersonaPlexTests.swift (11), E2EFishAudioTTSTests.swift (10).+3.6 ptsHighTest Quality
Resolve the 3 High CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2), REDACTED.+0.9 ptsLowDependency Vulnerabilities
Resolve the 1 REDACTED finding(s) in Secrets (history) — start with REDACTED.+0.8 ptsLowSecrets (history)
Resolve the 1 Critical vulnerability finding(s) in Dependency Vulnerabilities — start with REDACTED.+0.8 ptsLowDependency Vulnerabilities
Resolve the 2 Critical CVE finding(s) in Dependency Vulnerabilities — start with REDACTED (2).+0.8 ptsLowDependency Vulnerabilities
Resolve the 1 Projects may be oversized for their cohesion finding(s) in Project Cohesion.+0.5 ptsLowProject Cohesion

File quality

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

FileScoreBandWorst signal
REDACTED2.5SlopDependency Vulnerabilities: Critical CVE: REDACTED
REDACTED3.7MixedStatic Analysis (SAST): High: REDACTED
REDACTED3.7MixedStatic Analysis (SAST): High: REDACTED
REDACTED4.1MixedDependency Vulnerabilities: High CVE: REDACTED
REDACTED5.1MixedStatic Analysis (SAST): High: REDACTED
Sources/Qwen3ASR/CoreMLTextDecoder.swift5.7MixedCognitive Complexity: CoreMLTextDecoder.argmaxImpl (cognitive 26)
Sources/VoxCPM2TTS/AudioVAE.swift5.9MixedCognitive Complexity: AudioVAE.sanitize (cognitive 18)
Sources/AudioCLILib/SpeakCommand.swift7.0Near-cleanCyclomatic Complexity: SpeakCommand.validate (cyclomatic 128)
Sources/AudioServer/AudioServer.swift7.0Near-cleanCyclomatic Complexity: AudioServer.swift.handleRealtimeWS (cyclomatic 105)
Sources/KokoroTTS/GermanPhonemizer.swift7.0Near-cleanCyclomatic Complexity: GermanPhonemizer.normalizeNumbers (cyclomatic 91)
Sources/PersonaPlex/PersonaPlex.swift7.0Near-cleanCyclomatic Complexity: PersonaPlexModel.respond (cyclomatic 69)
Sources/VoiceChat/VoiceChatSession.swift7.0Near-cleanCyclomatic Complexity: VoiceChatSession.advance (cyclomatic 68)
Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift7.0Near-cleanCyclomatic Complexity: JSONSchemaMatcher.feedString (cyclomatic 55)
Sources/VoiceChatBenchmark/FullDuplexToolBench.swift7.0Near-cleanCyclomatic Complexity: VoiceChatBench.runFullDuplexToolScenario (cyclomatic 55)
Sources/AudioCLILib/VoiceChatCommand.swift7.0Near-cleanCyclomatic Complexity: VoiceChatCommand.validate (cyclomatic 42)
Sources/VoxCPM2TTS/VoxCPM2TTS.swift7.0Near-cleanCyclomatic Complexity: VoxCPM2TTSModel.generateVoxCPM2 (cyclomatic 38)
Sources/KokoroTTS/Phonemizer.swift7.0Near-cleanCyclomatic Complexity: KokoroPhonemizer.bartG2P (cyclomatic 30)
Sources/AudioCLILib/TranscribeCommand.swift7.0Near-cleanCyclomatic Complexity: TranscribeCommand.validate (cyclomatic 29)
scripts/qwen3_tts_coreml/convert_coreml.py7.0Near-cleanCyclomatic Complexity: convert_coreml.main (cyclomatic 26)
Sources/AudioCLILib/VoiceChatMCP.swift7.0Near-cleanCyclomatic Complexity: VoiceChatMCPRuntime.callProvider (cyclomatic 23)

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

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

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

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

Could not be resolved — 20

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

Methodology & how to trust this report

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

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

What we checked — 61 dimensions across the health lenses
D1D2D3D4D5D6D9D10D12D13D14D15D16D17D20D26D28D29D30D34D35D36D43D44AX10AX2AX3AX4AX8AX9M1M2M3M4P1P10P2P3P4P6P7PF1PF2PF3X1X12X13X14X15X17X19X21X22X23X24X25X26X27X28X3X30

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

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

Tools & methods

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

MethodBacksVersionEvaluator
Roslyn static analysisComplexity, cohesion, coupling, dead code, API surface, layering5.3.0✓ deterministic
Native secret scannerHardcoded secrets / credentials1.0.0✓ deterministic
Watchdog duplication detector (in-process)Code duplication1.0.0✓ deterministic
Coverage (coverlet / dotnet-coverage)Line & branch coverage10.0.400✓ deterministic
NuGet / dotnetOutdated, vulnerable & deprecated dependencies10.0.400✓ deterministic
git / LibGit2SharpChurn hotspots, knowledge concentration, history2.43.0 · 0.31.0✓ deterministic
gitleaks · semgrep · trivySecrets in history, SAST, CVEs, IaC & container, PII / GDPR1.86.0 · 0.69.3✓ deterministic
LLM (sampled · advisory)Documentation quality, ADR conformance, naming — sampled over a bounded sample; advisory, never a deterministic measurement—◐ LLM · sampled · advisory

Every finding is locatable in findings.md. Run 01a187fa-bddd-71a0-85ac-3e95d289811a.

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 — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Coverage NOT MEASURED: the Swift half could not be measured — the Swift suite in . produced no coverage export. Coverage is excluded from the score rather than counted as a near-zero. This is OUR limitation, not a defect in the repo. In the meantime, commit (or publish into the working tree) the lcov/Cobertura report your CI produces and the real number is read on the next scan. You can widen what we reach: optional: commit the lcov/Cobertura report your CI produces, and the real number is read on the next scan.
  • D11 Test Reliability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Test source is present (.swift) and this repository declares a SwiftPM test suite (4 packages), but it was not re-run: no test result was produced. Not scored — this is a gap in the analyzer's language coverage, not a finding about this repository.
  • D14 License Compliance — measured, with a gap in what it reached — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. This repository declares a Swift Package.swift/Package.resolved, but the licence verdict published here was taken over its Python distribution dependencies. Nothing was read about its SwiftPM dependencies' licensing in either direction, and a clean score on this card must not be read as covering them.
  • D21 Naming Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D21's deterministic naming rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. Until then its declarations carry no naming verdict this run — this says nothing about whether its names are consistent.
  • D22 Internal API Consistency — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. D22's deterministic call-shape rules are gated on C# first (docs/plans/deterministic-engine.md, P5): each other language is switched on only after its own concept suite and A/B gate pass. This says nothing about whether that surface is consistent.
  • D24 Comment Value — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check's reader does not cover the language this repository's product is written in, so it had nothing of the product to read. That is a gap in this analyzer's language reach — not a finding about this repository.
  • D27 Navigability — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. Navigability is taken over call sites whose callee resolved. For C# that population includes calls into referenced assemblies; for this language only calls declared inside the repository count, so the abstention threshold reads the repository's use of its standard library as a resolution failure. That is a limit of this analyzer, not a build problem in this repository.
  • D32 Data Compliance (PII/GDPR) — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. `Examples/DictateDemo/DictateDemo/DictateViewModel.swift`, `Sources/AsrBenchmark/Normalizer.swift`, `Sources/AudioCLILib/VoiceChatCommand.swift`, `Sources/AudioCLILib/VoiceChatDemoSupport.swift`, `Sources/AudioCLILib/VoiceChatMCP.swift`, … (+43 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.
  • AX6 Interface segregation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check is computed over the public interfaces this run's compilations declare, and none was loaded, so it had nothing to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • C1 Data Protection — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These personal data controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks personal data controls.
  • C2 Access Controls — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These authorization controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks authorization controls.
  • C3 Audit Trail — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These audit controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks audit controls.
  • GD1 Unfinished & placeholder code — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, F#, JavaScript/TypeScript, Dart, Ruby and Scala source only, and no C#, F#, JavaScript/TypeScript, Dart, Ruby or Scala was found, and this repository's Python, Swift, c, cpp is not read yet, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • IC1 Incompleteness & stubs — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, JavaScript/TypeScript, Java, Dart, Ruby and Scala source only, and no C#, JavaScript/TypeScript, Java, Dart, Ruby or Scala was found, and this repository's Python, Swift, c, cpp 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 — Watchdog measured this, but not all of it. What it did not reach is a gap on our side — a collector, parser or image we have not built yet — so the numbers on that dimension cover less than the repository, and the part left out is not evidence that it would have passed. 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.
  • P5 DR & Backup — 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. No backup/snapshot/replication config, RTO/RPO or restore-procedure documentation was found — and no production persistence was detected either (no data-access packages, no data-store services, no database resources), so there is nothing in this repository whose loss a DR control would recover. If this system's data lives in a platform or ops repo we can't see, that's where the DR evidence belongs.
  • S1 Web-Security Posture — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. These web-security controls are read from declarative annotations, request middleware, entity/column names and guard methods in a C# source model, and none was loaded on this run, so there was nothing to gather. That is a gap in this analyzer's language reach — not a finding that the repository lacks web-security controls.
  • X16 Unfloored truncation loop — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala and Kotlin source only, and no C# was loaded and no JavaScript/TypeScript, Java, PHP, Dart, Ruby, Scala or Kotlin was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X18 Disposal-pattern correctness — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala and PHP source only, and no C# was loaded and no JavaScript/TypeScript, Java, Kotlin, Dart, Ruby, Scala or PHP was found in this repository, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X2 Cancellation propagation — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Go, PHP, Dart, Kotlin, Ruby, Scala, Java, Python and Rust source only, and no C# was loaded, and no named async function in this repository's JavaScript/TypeScript, nor any Go, PHP or Dart function or Kotlin suspend function, makes a request that can be cancelled (fetch, axios, ky, ofetch; net/http, net.Dial; amphp; Dio; Ktor, OkHttp), so there is nothing to judge, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X29 Per-element action decided by a fixed element — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Rust, Dart, Ruby, Scala and Kotlin 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.
  • X4 Structured logging — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax, and JavaScript/TypeScript, Java, Kotlin, Python, PHP, Dart, Ruby, Scala and Rust source only, and no C# was loaded, and this repository's JavaScript/TypeScript, Python and PHP make no call through a named logger, so it had nothing of this repository's product to read. That is a gap in this analyzer's language reach — not a finding that the repository is free of what this check looks for.
  • X5 Nullable reference types — not measured this run — Watchdog could not measure this here. That is a gap on our side — a collector, parser or image we have not built yet — and it is neither a defect in this repository nor evidence that the check would have passed. This check reads C# syntax and MSBuild project configuration, TypeScript source and its tsconfig files, Java source and its package and module declarations, PHP source and its PHPStan and Psalm configuration, Dart source and its pubspec language version, Ruby source and its Sorbet and Steep configuration, Scala source and its build's explicit-nulls, WartRemover and Scalafix settings, and Kotlin source only, and no C# was loaded, no TypeScript was found, and this repository's C, Cpp, 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

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

Per-dimension blind spots

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

  • D1 Cyclomatic Complexity: Cyclomatic complexity counts branches statically — it cannot tell an essential decision tree from accidental tangle, nor see complexity that lives in data or configuration (large switch-case token tables, DSL lexers/parsers, data-as-code rule tables) rather than control flow: a tokenizer's many single-character cases read as high complexity though each branch is trivial.
  • D2 Cognitive Complexity: Cognitive-complexity heuristics approximate how hard code is to follow; genuine domain difficulty and well-named intent that eases reading are not captured.
  • D3 God Classes: "God class" is sized by members and responsibilities visible in the type — a deliberately broad facade over a coherent subsystem can read the same as an accidental grab-bag. For front-end JS the file-length check is cohesion-aware (a single-responsibility module — one class/IIFE — earns a 3× threshold), but cohesion is approximated from top-level declarations, not true dependency structure.
  • D4 Code Duplication: Duplication is token-similarity — an in-process token-stream comparison over sliding windows, with type-aware normalization — so it finds copy-paste, not semantic duplication expressed differently. Committed machine-written code (scaffolded migrations, designer/codegen output, protobuf/OpenAPI stubs, model snapshots) is EXCLUDED — its repetition is the tool's, not the team's — so the score reflects hand-written duplication only.
  • D5 Coupling: Coupling is measured between projects/assemblies — runtime coupling through DI, reflection, messaging or shared databases is invisible to a static reference graph.
  • D6 Cohesion (LCOM4): LCOM4 cohesion is syntactic — it infers connectivity from which methods touch which fields/methods by name, not from real runtime behaviour or intent.
  • D9 Test Distribution: The test-pyramid shape is inferred from project/folder naming and references, with a single test host bucketed per-file by its path tier and content signals — a suite that names tiers unconventionally and gives no per-file signal can still be mis-bucketed.
  • D10 Test Quality: Assertion density is structural — it cannot tell a meaningful behavioural assertion from a trivial one, only that an assertion is present.
  • D12 Dependency Hygiene: Dependency health reads manifests and lockfiles — a vulnerability in a vendored/copied dependency, or risk from how a dependency is actually used, is outside this view.
  • D13 REDACTED Scanning: REDACTED detection is signature- and entropy-based on the current tree — a secret that does not match a known pattern, or one already rotated, will not be flagged (a clean scan is "nothing matched", not "no secrets exist").
  • D14 License Compliance: License compatibility is checked against declared package metadata and a policy — mislabelled or missing license metadata, and obligations that depend on how you distribute, are not resolved here.
  • D15 Churn × Complexity Hotspots: Churn hotspots come from git history — a freshly imported or squashed repository has no churn signal, and recent rewrites can mask a historically risky file.
  • D16 Bus Factor: Bus-factor is a time-decayed model of commit attribution (who has recently, repeatedly worked a file), not comprehension — pairing, review and reading-without-committing spread knowledge it can't see; bot commits and shared accounts still distort it.
  • D17 Explicit Debt: Acknowledged-debt signals (TODO/FIXME, suppressions, dead code) are textual — undocumented debt that nobody marked, and debt that lives in design rather than annotations, is invisible. Committed machine-written code (scaffolded migrations, designer/codegen output, generated stubs) is excluded — it is never the team's dead code to delete.
  • D20 ADR Quality: ADR quality is an LLM read of the decision records present — it cannot know about decisions made and never recorded, and its verdict is sampled and advisory.
  • D26 Project Cohesion: Project focus is sized from members/namespaces per project — a project that is broad by deliberate design reads the same as one that has sprawled.
  • D28 Secrets (history): Secret-history scanning sweeps the git log for known patterns — a secret that predates the available history, or never matched a signature, is not found (clean means "nothing matched in the history we can see").
  • D29 Static Analysis (SAST): SAST findings are pattern-based (semgrep) — it finds classes of bug it has rules for; logic flaws, auth/authorization gaps and issues needing runtime context are out of reach (and clean means "no rule matched").
  • D30 Dependency Vulnerabilities: CVE matching depends on accurate package/version metadata and on the advisory databases — a vulnerability with no published advisory, or in code not declared as a dependency, is not seen. Coverage needs a RESOLVED graph: an unpinned requirements.txt, or a pom without a resolved build, yields partial coverage rather than a clean verdict. An ecosystem the analyzer cannot scan is reported as unmeasured, never as clean.
  • D34 Knowledge Freshness: Freshness is decayed commit RECENCY, not comprehension — code read often but rarely committed reads as orphaned, and stable code that genuinely needs no changes is penalised the same as forgotten code; bot/squash commits distort it like the bus factor.
  • D35 Change Coupling: Change coupling is co-change in COMMITS — files split across separate commits, or coupled only through a shared config/build step, read as uncoupled, and a sweeping commit (rename/format) is excluded so it doesn't couple everything. It shows that files change together, not WHY: a high coupling can be a healthy cohesive pair as readily as a hidden leak.
  • D43 Malicious Dependencies: Only packages some vulnerability database has already NAMED as malicious are seen — a compromise published in the last hours, or never reported at all, is invisible here, and this dimension reading 10 is not evidence that a dependency is trustworthy. There is no typosquat or dependency-confusion analysis: a package nobody has reported is simply absent from the feeds. Coverage is the dependency scan's: an ecosystem that could not be scanned is disclosed as unmeasured, never as clean.
  • D44 Platform End-of-Life: The support table is FROZEN, so it goes out of date by losing RECALL: a release that ended support after the table was written is missed until the table is refreshed, and this dimension reading 10 is not evidence that a platform is current. Only platforms the repository DECLARES in a place this pass reads are seen — a runtime named only in a Dockerfile (D31's subject), in a CI workflow (D29's), or in a file this pass does not parse (go.mod, a Gemfile ruby directive) is invisible here, which is why a repository declaring none of them abstains rather than scoring. Only frameworks with a PUBLISHED support policy are tracked: React, Flask and Express publish none, so their age cannot be judged and their absence from a report is not a statement that they are supported.
  • AX10 Code composition: Role is inferred from namespace/folder convention, not semantics — a domain concept living in a folder named "Services" reads as application, and the split is lines-of-code, not business value. The business-logic-share score is a SOFT, FLOORED signal: it contributes to the Architecture lens but is floored at the Critical gate, so an infrastructure-heavy design (a gateway, an ETL, a driver) is legitimately low without being nuked to zero.
  • AX9 CQS / query purity: Handlers are found by interface/name convention — a query handler using neither is not seen. Mutation is a resolved write/publish invocation (SaveChanges/repository/bus), so a write hidden behind a hand-rolled wrapper, reflection, or a string-keyed service locator resolves to a non-persistence type and isn't flagged; it detects that a query writes state, not whether the write is a legitimate read-side cache update. Clean means "no resolved write/publish in a query body", not a proof of CQS purity.
  • M4 Documentation accuracy: Onboarding quality is an LLM read of the docs/setup present — it cannot run the onboarding or measure how long a real new joiner takes; the verdict is sampled and advisory.
  • P4 Deployment & Rollback: Approval/branch-protection rules live in repository settings the scan cannot see — only their in-repo evidence (config files, workflows) is checked, so a control enforced purely in the host's settings reads as "not evidenced".
  • P6 Release Hygiene: Rollback/observability controls are inferred from repo artefacts (pipelines, dashboards-as-code) — controls configured in external tooling, with no in-repo trace, cannot be credited.

Dimensions

D1 · Cyclomatic Complexity5.4 / 10Adequate✓ Tool-verified

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

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

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

174 method(s) exceeded the cyclomatic complexity threshold of 15; the worst was SpeakCommand.validate at 128. A further 4 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 EngineID.make at 34 — they are counted neither in the figure above nor in this dimension's score. 2 files carry no cyclomatic complexity row at all for this reason — every one of their over-threshold methods was excluded, so the exclusion is disclosed nowhere in the file itself: Sources/AsrBenchmark/Engine.swift (EngineID.make at 34), Sources/PersonaPlex/Configuration.swift (PersonaPlexVoice.displayName at 19). 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.

SpeakCommand.validate (cyclomatic 128)Sources/AudioCLILib/SpeakCommand.swift:391
AudioServer.swift.handleRealtimeWS (cyclomatic 105)Sources/AudioServer/AudioServer.swift:968
GermanPhonemizer.normalizeNumbers (cyclomatic 91)Sources/KokoroTTS/GermanPhonemizer.swift:901
GermanPhonemizer.mapConsonants (cyclomatic 71)Sources/KokoroTTS/GermanPhonemizer.swift:514
PersonaPlexModel.respond (cyclomatic 69)Sources/PersonaPlex/PersonaPlex.swift:127

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

What to do

  1. Bring the 7 bodies over 60 down to 60 or less in Cyclomatic Complexity — start with SpeakCommand.validate (cyclomatic 128), AudioServer.swift.handleRealtimeWS (cyclomatic 105), GermanPhonemizer.normalizeNumbers (cyclomatic 91). — 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 7 together lifts Cyclomatic Complexity from 5.4 to about 6.4/10, projected with the scoring formula itself and assuming each lands exactly at 60; a cleaner split scores higher.
  2. Enforce Cyclomatic Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D2 · Cognitive 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

316 method(s) exceeded the cognitive complexity threshold of 15; the worst was AudioServer.swift.handleRealtimeWS at 309.

AudioServer.swift.handleRealtimeWS (cognitive 309)Sources/AudioServer/AudioServer.swift:968
PersonaPlexModel.respondStream (cognitive 196)Sources/PersonaPlex/PersonaPlex.swift:618
SpeakCommand.validate (cognitive 185)Sources/AudioCLILib/SpeakCommand.swift:391
GermanPhonemizer.normalizeNumbers (cognitive 168)Sources/KokoroTTS/GermanPhonemizer.swift:901
PersonaPlexModel.respond (cognitive 140)Sources/PersonaPlex/PersonaPlex.swift:127

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

What to do

  1. Bring the 6 bodies over 120 down to 120 or less in Cognitive Complexity — start with AudioServer.swift.handleRealtimeWS (cognitive 309), PersonaPlexModel.respondStream (cognitive 196), SpeakCommand.validate (cognitive 185). — 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 6 together lifts Cognitive Complexity from 2.0 to about 3.5/10, projected with the scoring formula itself and assuming each lands exactly at 120; a cleaner split scores higher.
  2. Enforce Cognitive Complexity in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D3 · God Classes8.5 / 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.5 / 10 · rule-coverage 100% · ceiling Prevented

98 god class(es) detected.

MethodTooLong: VoiceChatBench.runFullDuplexToolScenario · ×45Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:886
FileTooLong: VoiceChat/VoiceChatSession.swift · ×27Sources/VoiceChat/VoiceChatSession.swift
ClassTooLong: SpeakCommand · ×19Sources/AudioCLILib/SpeakCommand.swift:21
TooManyMethods: VoiceChatSession · ×6Sources/VoiceChat/VoiceChatSession.swift:85
FunctionTooLong: AudioServer.swift.handleRealtimeWSSources/AudioServer/AudioServer.swift:968

What to do

  1. Resolve the 45 MethodTooLong finding(s) in God Classes — start with PersonaPlex.swift (4), FullDuplexToolBench.swift (3), VoxCPM2TTS.swift (2). — One of this dimension's main actionable groups (45 warning-level).
  2. Resolve the 27 FileTooLong finding(s) in God Classes — start with VoiceChatSession.swift, SpeakCommand.swift, AudioServer.swift. — One of this dimension's main actionable groups (27 warning-level).
  3. Resolve the 19 ClassTooLong finding(s) in God Classes — start with SpeakCommand.swift, PersonaPlex.swift, VoxCPM2TTS.swift. — One of this dimension's main actionable groups (19 warning-level).
  4. Enforce God Classes in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D4 · Code Duplication8.1 / 10Strong✓ Tool-verified

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

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

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

603 duplicated block group(s) detected. A further 50 rows report members as variants of one another; they aggregate block groups already counted above and are not themselves counted. 16 of the 653 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 (5 lines × 2) · ×70Sources/AsrBenchmark/Memory.swift:38
Duplicated block (7 lines × 2) · ×40Sources/AudioCLILib/DiarizeCommand.swift:351
Duplicated block (6 lines × 2) · ×33Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:405
Duplicated block (8 lines × 2) · ×26Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:532
Duplicated block (9 lines × 2) · ×19Sources/VoxtralASR/VoxtralAudioFrontend.swift:104

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

What to do

  1. Resolve the 70 Duplicated block (5 lines × 2) finding(s) in Code Duplication — start with DiarizationBench.swift (3), HiggsTTSBackbone.swift (3), StreamingSession.swift (3). — One of this dimension's main actionable groups (70 warning-level).
  2. Resolve the 40 Duplicated block (7 lines × 2) finding(s) in Code Duplication — start with VoxtralAudioFrontend.swift (2), DiarizationBench.swift (2), NemotronMLXRuntime.swift (2). — One of this dimension's main actionable groups (40 warning-level).
  3. Resolve the 33 Duplicated block (6 lines × 2) finding(s) in Code Duplication — start with AudioServer.swift (2), Qwen3ASR.swift (2), MultiCodeDecoderCoreML.swift (2). — One of this dimension's main actionable groups (33 warning-level).
  4. Enforce Code Duplication in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

D5 · Coupling9.4 / 10Stronggated by 5 serious findings✓ 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 9.4 / 10 · rule-coverage 100% · ceiling Prevented

70 production modules (SwiftPM), 0 dependency cycle(s), 0 unstable depended-on module(s). Read from the build's own module declarations; 7 module(s) off the main sequence, with abstractness counted on 64 of the 70 (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).

Off the main sequence: SpeechRuntime · ×5
Off the main sequence: MLXCommon · ×2

What to do

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

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

D6 · Cohesion (LCOM4)9.9 / 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.9 / 10 · rule-coverage 100% · ceiling Verified

2 of 431 classes have LCOM4 above 3.

Low cohesion: CoreMLTextDecoder (LCOM4 5) · ×2Sources/Qwen3ASR/CoreMLTextDecoder.swift:32

What to do

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

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

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

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

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

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

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

✓ On the Gold path — maintain.

Detailed fixes: d9_recommendation.md.

D10 · Test Quality7.6 / 10Strong✓ 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 7.6 / 10 · rule-coverage 100% · ceiling Prevented

259 skipped, 142 zero-assertion, no mocking-framework packages referenced (hand-written doubles or no mocking) across 3000 tests.

Skipped test: testMLXForwardMatchesONNXFixtureWhenAvailable · ×259Tests/Audio2Face3DTests/Audio2Face3DParityTests.swift:5
No assertions: testFromPretrainedMarkGeneratesFrames · ×142Tests/Audio2Face3DTests/E2EAudio2Face3DTests.swift:8

What to do

  1. Resolve the 259 Skipped test finding(s) in Test Quality — start with WeSpeakerTests.swift (14), PersonaPlexTests.swift (11), E2EFishAudioTTSTests.swift (10). — One of this dimension's main actionable groups (259 warning-level).
  2. Resolve the 142 No assertions finding(s) in Test Quality — start with AudioCLITests.swift (17), JSONSchemaConstraintTests.swift (12), StreamingAudioPlayerTests.swift (11). — One of this dimension's main actionable groups (142 warning-level).
  3. Enforce Test Quality in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Prevented — provenance only; does not change the score.

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

D12 · Dependency Hygiene8.0 / 10Strong✓ Tool-verified

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

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

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

45 outdated, 0 yanked pinned Python distributions. Only EXACT pins are graded for currency: a floor or a range already installs the newest release it admits, so reporting one would report this repository for being current. Whether a deliberate upper cap has itself gone stale is a different and weaker question, and is not asked. Whether any distribution is UNMAINTAINED is not graded — PyPI publishes no maintenance status, and release age does not stand in for one. Lockfiles are not read (poetry.lock, uv.lock, Pipfile.lock, pdm.lock), so a lock-resolved install is outside this verdict. Known CVEs in this dependency graph are D30's question.

Outdated: accelerate · ×45

What to do

  1. Enforce Dependency Hygiene in CI to reach Verified (currently Documented). — Hardens enforcement from Documented toward Verified — provenance only; does not change the score.

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

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

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

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

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

REDACTED scan ran and found no leaked secrets.

✓ On the Gold path — maintain.

Detailed fixes: d13_recommendation.md.

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

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

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

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

0 of 121 shipped Python distribution(s) use a banned license. Licences were resolved from PyPI over the distributions a consumer installs — this repository's 94 declared runtime requirement(s) closed transitively over each distribution's published `requires_dist` (27 reached that way). Requirements it states ONLY under an extra, a PEP 735 dependency group, a Poetry dev group or a dev-named requirements file are excluded: pip does not install any of them for a consumer. ★ This repository commits no dependency lockfile that this pass reads, so each licence is the one PyPI publishes for the distribution's CURRENT release rather than for a pinned version. 12 of them publish no licence on PyPI this pass can read; that is missing data, not a violation, and none of them is charged. ★ COVERAGE OF THIS VERDICT: it grades this repository's Python distribution dependencies and nothing else. The repository also declares a Swift Package.swift/Package.resolved, and the licences of those dependencies were NOT read by this pass — a gap in this engine's coverage, not a statement about them. So this result says the graded closure carries no banned licence; it does NOT say this repository's licensing is clear.

✓ On the Gold path — maintain.

Detailed fixes: d14_recommendation.md.

D15 · Churn × Complexity Hotspots9.6 / 10Stronggated by 16 serious findings✓ Tool-verified

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

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

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

Top hotspots: Sources/AudioServer/AudioServer.swift (8×105=840); Sources/AudioCLILib/SpeakCommand.swift (6×128=768); Sources/Qwen3Chat/Gemma4Chat.swift (13×22=286) Repeated repair below the complexity floor: Sources/Qwen3ASR/CoreMLEncoder.swift (4 of 5 changes were fixes)

Hotspot: Sources/AudioServer/AudioServer.swift · ×15Sources/AudioServer/AudioServer.swift:968
Repeated repair: Sources/Qwen3ASR/CoreMLEncoder.swiftSources/Qwen3ASR/CoreMLEncoder.swift:148

What to do

  1. Resolve the 15 Hotspot finding(s) in Churn × Complexity Hotspots — start with AudioServer.swift, SpeakCommand.swift, Gemma4Chat.swift. — One of this dimension's main actionable groups (15 warning-level).
  2. Resolve the 1 Repeated repair finding(s) in Churn × Complexity Hotspots — start with CoreMLEncoder.swift. — One of this dimension's main actionable groups (1 warning-level).

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

D16 · Bus Factor8.3 / 10Strong✓ Tool-verified

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

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

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

96 source file(s) have their living knowledge concentrated in one author (≥90% of recent, decayed contribution). The largest is Sources/VoiceChat/VoiceChatSession.swift. Counted over 558 of the 691 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

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

What to do

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

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

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

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

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

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

0 deducted task-comment markers across 157673 LoC (0.0/KLoC) → score 10.0. Task comments only: this repository's language is read without a compiler, so D17's suppression, dead-code and commented-out-code arms did not run and this score counts fewer marker kinds than a .NET repository's would.

✓ On the Gold path — maintain.

Detailed fixes: d17_recommendation.md.

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

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

Method: Per-ADR judgment by language model at low temperature with two-pass stability; confidence is share of ADRs evaluated; enforcement-field presence detected deterministically. Advisory.

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

No architecture decision records were found.

No ADRs found

What to do

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

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

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

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

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

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

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

Projects may be oversized for their cohesion

What to do

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

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

D28 · Secrets (history)9.0 / 10Adequategated by 1 critical finding✓ 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 9.0 / 10 · rule-coverage 100% · ceiling Documented

1 finding(s): 0 critical, 1 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 1 REDACTED finding(s) in Secrets (history) — start with REDACTED. — One of this dimension's main actionable groups (1 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 7 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

7 finding(s): 0 critical, 7 high, 0 medium, 0 low. 7 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. Separately, one or more rules could not re-parse an embedded snippet in 1 file(s) (e.g. a workflow `run:` block read as shell). Those files WERE scanned and their other rows are unaffected; only those rules' view of those snippets is missing.

REDACTED

What to do

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

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

D30 · Dependency Vulnerabilities3.8 / 10Weak✓ Tool-verified

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

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

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

9 finding(s): 3 critical, 3 high, 3 medium, 0 low.

REDACTED
REDACTED
REDACTED
REDACTED

What to do

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

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

D34 · Knowledge Freshness7.7 / 10Adequategated by 5 critical findings✓ 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 7.7 / 10 · rule-coverage 100% · ceiling Documented

131 of 558 significant source file(s) are orphaned — their living knowledge has decayed to nothing, so no one currently understands them. The largest is Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift. Counted over 558 of the 691 production source files in this repository: the rest are under the ~2,400-byte size floor this dimension measures over.

Orphaned knowledge · ×5Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:1
Orphaned file · ×126Sources/SpeechEnhancement/MLXDeepFilterNet3Network.swift:1
Further orphaned files (smaller)

What to do

  1. Resolve the 126 Orphaned file finding(s) in Knowledge Freshness — start with Configuration.swift (7), MLXDeepFilterNet3Network.swift, VAE.swift. — One of this dimension's main actionable groups (126 recommendation-level).
  2. Resolve the 5 Orphaned knowledge finding(s) in Knowledge Freshness — start with Audio2Face3DMLXRuntime.swift, Community1Clustering.swift, MioCodecWaveDecoder.swift. — One of this dimension's main actionable groups (5 issue-level).
  3. Resolve the 1 Further orphaned files (smaller) finding(s) in Knowledge Freshness. — One of this dimension's main actionable groups (1 recommendation-level).

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

D35 · Change Coupling10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

No strong hidden change-coupling between production files.

✓ On the Gold path — maintain.

Detailed fixes: d35_recommendation.md.

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

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

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

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

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

REDACTED
REDACTED
REDACTED
REDACTED
REDACTED

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

What to do

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

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

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

What it measures: Whether any dependency the repository declares is published as MALICIOUS rather than merely vulnerable — a package that is an attacker's work, in any ecosystem osv-scanner reads. Scored apart from D30 because the answer is binary: there is no safe version to upgrade to, and the fix is to remove the package and rotate every credential it could have read.

Method: The same dependency scan D30 reads, partitioned on the scanner's own classification rather than rescanned: a row is MALICIOUS when its id is in the `MAL-` space (the ossf/malicious-packages feed) OR its `database_specific.cwe_ids` carries `CWE-506` ("Embedded Malicious Code"). Both channels are structural; the summary text is deliberately NOT read, because a malicious-package record whose summary says only "Critical severity vulnerability" is a real shape ([GHSA redacted]) and a text matcher misses it. Scored BINARY: any surviving row is 0, whatever its severity and however many CVEs sit beside it — a hostile dependency is not a quantity. Applicability and degradation are D30's: NotApplicable only when no ecosystem is readable, and an unscannable ecosystem degrades rather than reading clean. SCORED, not informational.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d43_recommendation.md.

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

What it measures: Whether anyone still ships security patches for the platform this repository RUNS ON — the runtime it pins and the framework majors its own constraints hold it to. Separate from D12 because the question differs: a current Django on an end-of-life Python is perfectly up to date and completely unsupported, and the fix is a migration rather than a version bump. What the repository says it merely SUPPORTS is never charged.

Method: End-of-life PLATFORM read from the repository's own declarations and graded against a FROZEN, dated table of vendor support dates — no network, no feed, no API, so this dimension answers identically inside a closed scan fence. Two subjects: a RUNTIME the project pins (a single or all-end-of-life TargetFramework, a .nvmrc or .python-version, a requires-python CAP) and a FRAMEWORK major a dependency constraint cannot move off (a caret, tilde or exact version; `vue@^2.7.16` pins Vue 2). A FLOOR is deliberately never charged — `requires-python = ">=3.8"` states what a package SUPPORTS, not what it runs on — and a multi-target project is charged only when EVERY target is out of support. Runtime 4.0/product capped 8.0, framework 1.5 capped 4.5. The table is safe to freeze because a statement about support that ended in the past cannot become false: it loses recall as it ages, never precision, and a test asserts every entry predates the freeze date. Disjoint from D31 (a container image's OS layer) and D29 (the toolchain a CI workflow installs). Abstains when the repository declares no platform this pass reads — never scores it clean.

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

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

✓ On the Gold path — maintain.

Detailed fixes: d44_recommendation.md.

Frontend & cross-cutting dimensions

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

AX10 · Code composition9.7 / 10Exemplary✓ Tool-verified

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

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

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

What to do

  • The domain core is a small share of production code, but most of the rest matched no layer vocabulary at all — so this is not yet an anemic-domain finding. The namespace/path convention could not place that code, which makes the composition above a statement about the naming, not about the design. Name the layers (or check that the repository's conventions differ from the ones this check knows) before reading a thin domain into it.
AX2 · Stateful singletons5.0 / 10Adequate✓ Tool-verified

Other · Architecture — Whether singleton services avoid mutable shared instance state that concurrent callers would race on.

Method: Roslyn scan: singleton field mutations unguarded by lock or Interlocked, per type; syntax-based guard detection. Deterministic, traceable per field.

  • `Gemma4Chat` is written on every request (`resetState` is reached per request from the Hummingbird route closure `NativeInferenceService.registerRoutes`, and every request shares the instance it runs on and every static it writes) but writes that shared state outside any lock (state; e.g. `state` in `resetState` at line 103). Handlers run concurrently — SwiftNIO serves one event loop per core and async handlers run on the cooperative thread pool — and unsynchronised concurrent writes are a data race in Swift: an update is lost, and a concurrent Array or Dictionary write corrupts its storage. — Sources/Qwen3Chat/Gemma4Chat.swift:14

What to do

  • Swift: move the state handlers share into an actor, or guard it with a lock held for the whole update (NIOLockedValueBox, Mutex, or NSLock with `defer { lock.unlock() }`) or an atomic (ManagedAtomic); keep per-request data in locals or `req.storage`. Building in the Swift 6 language mode makes the compiler reject an unsynchronised capture.
AX3 · Project dependency cycles10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

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

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

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

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

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

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

M1 · Documentation (README)10.0 / 10Exemplary✓ Tool-verified

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

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

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

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

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

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

What to do

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

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

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

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

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

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

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

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

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

P10 · Library API & versioning10.0 / 10Exemplary○ Nothing flagged

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

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

P2 · Observability8.0 / 10Strong✓ Tool-verified

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

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

What to do

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

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

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

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

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

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

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

What to do

  • Nothing pauses a release for a human: publish as a draft release (or gate the release job on a protected tag/manual dispatch) so a bad build can be stopped before users can download it.
P6 · Release Hygiene8.0 / 10Strong✓ Tool-verified

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

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

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

What to do

  • Keep the changelog current — add a versioned entry (Keep-a-Changelog ## [x.y.z]) for each release so the history isn't a stub.
P7 · Outbound HTTP resilience3.0 / 10Weak✓ Tool-verified

Readiness · Readiness — Whether outbound HTTP calls are wrapped in resilience (retry/timeout/circuit-breaker) so a failing dependency doesn't cascade.

Method: Source scan: outbound HTTP clients and what bounds them — resilience handlers (Polly, AddStandardResilienceHandler) on .NET; on Go, the JVM, Python, JavaScript/TypeScript, Ruby, PHP, Rust, Elixir, Swift, Dart and Erlang, a timeout, deadline, retry or breaker beside each call, or a process-wide client default (a framework-wide deadline such as Drupal core's, Laravel's or actix's awc counts). Exhaustive, deterministic.

  • `URLSession.shared` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout. (×3) — Sources/AudioCommon/HuggingFaceRepoManifest.swift:105, Sources/AudioCommon/HuggingFaceRepoManifest.swift:319, Sources/WhisperASR/WhisperASR.swift:235

What to do

  • Bound every outbound call: pass `timeout:` to AsyncHTTPClient's `execute`, set `app.http.client.configuration.timeout` (with a `read` bound) or each `ClientRequest.timeout` for Vapor's client, and a `timeoutIntervalForRequest` on any `URLSessionConfiguration`; add retries with back-off around dependencies that fail.
PF1 · Benchmark discipline8.0 / 10Strong✓ Tool-verified

Readiness · Performance — Whether the code protects its performance with benchmarks — a benchmark suite, allocation/memory measurement, and (ideally) a CI gate. Presence is credited as a bonus, never a deduction.

Method: Repo + source scan: BenchmarkDotNet referenced (csproj/source), [Benchmark]/[MemoryDiagnoser] attribute counts, and a benchmark step in CI; off .NET, the same ladder over Go testing.B, Rust criterion/#[bench]/divan, JMH/kotlinx-benchmark, pytest-benchmark/asv/pyperf, tinybench/mitata/vitest bench/benchmark.js and Swift package-benchmark — scored as a bonus ladder (absence is neutral, never a deduction). Deterministic, presence detection.

PF2 · Allocation hygiene7.0 / 10Strong✓ Tool-verified

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

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

What to do

  • Raise allocation-aware density on the hot paths — currently 349 use(s) across 166,599 production line(s) (~2.1/1k). More of the idioms below on the allocation-heavy paths climbs this toward 10.
  • Swift: on hot paths, reserveCapacity before appending, use ContiguousArray for class-element arrays, work in place with withUnsafeBufferPointer/withUnsafeTemporaryAllocation, and make large values ~Copyable with borrowing/consuming parameters.
PF3 · Async & latency hygiene8.5 / 10Exemplary✓ Tool-verified

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

Method: Production-source scan: sync-over-async blocking counted everywhere — .Wait()/.GetAwaiter().GetResult() in .NET; off .NET, read from the language model, a blocking call inside an async function (Python, TS/JS, Rust, Kotlin, Swift, Dart) or inside a Java method returning a Reactor Mono/Flux or a Scala method returning a Future or effect — and, for a .NET library with ≥5 awaits, the share of awaits using ConfigureAwait(false). Deterministic, syntax/text detection.

  • `runIsolated` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs. — Sources/AsrBenchmark/AsrBench.swift:244

What to do

  • Swift: await instead of blocking — `try await Task.sleep(for:)` for Thread.sleep/sleep, a checked continuation instead of a DispatchSemaphore or DispatchGroup wait, the async Process and URLSession APIs; never park a thread waiting on a Task — the cooperative pool cannot guarantee it progress.
X1 · Async correctness10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

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

X17 · Uncapped recursion over a caller-supplied document3.5 / 10Weak✓ Tool-verified

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

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

  • `first_numeric` is public and takes `value: object` from its caller, and it calls itself at line 196 (`first_numeric`) with a piece of `value` (and at line 201) — and nowhere in `first_numeric` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `first_numeric` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack. — scripts/monitor_apple_gpu.py:196

What to do

  • Each finding names the externally-callable member that accepts the document and the self-call that descends, and states that no depth parameter or counter exists anywhere in the walk. Confirm from the two, then thread a depth argument through the walk and reject documents past a fixed maximum, or rewrite it with an explicit stack.
X19 · Unrestored process-global state10.0 / 10Exemplary○ Nothing flagged

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Other · Code Health — Whether a `for` loop leaves the `dict`, `set` or `deque` it is walking alone — CPython's iterators over those check that the collection has not changed size since the loop began, so a body that removes from (or empties) the very collection the loop is walking makes the next step raise `RuntimeError: dictionary changed size during iteration` and the remaining items are never seen.

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

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

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

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

X3 · Exception handling6.8 / 10Strong✓ 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.

  • `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. — scripts/monitor_apple_gpu.py:168
  • `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. (×8) — Sources/VoiceChat/VoiceChatSession.swift:1605, Sources/VoiceChat/VoiceChatSession.swift:1623, Sources/VoiceChat/VoiceChatSession.swift:1673, …
  • 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. (×4) — Sources/MagpieTTSCoreML/Decoder.swift:130, Sources/AudioServer/AudioServer.swift:750, Sources/AudioCommon/StreamingAudioPlayer.swift:185, …

What to do

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

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

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

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 Health77%Adequate — gated by D2Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Architecture78%Adequate — gated by D26Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Maturity80%StrongStrongest area.
Readiness46%Adequate — gated by P3, P7Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Security71%Adequate — gated by D30, D36Capped at Fair by a Critical contributor — resolve it before relying on this lens.
Performance77%StrongSolid.
Unscored — 2 check(s) recorded observations but carry no score

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

  • X10 Duplicated predicate — 14 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
  • X7 Silent fallback defaults — 8 observation(s) recorded · Advisory — this card reports evidence and never carries a score.
Not evidenced — 2 control(s) we could not find positive evidence for

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

  • C3 Audit Trail — Not assessed: these audit controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks audit controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • P5 DR & Backup — not evidenced — repo shows no backup/RTO/RPO controls; absence of evidence is not evidence of a working control
Not included — 55 check(s) not relevant to this codebase

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

  • AC1 Text alternatives — No web markup found — accessibility is not applicable to this repository.
  • AC2 Forms & labels — No web markup found — accessibility is not applicable to this repository.
  • AC3 Page structure — No web markup found — accessibility is not applicable to this repository.
  • AC4 Keyboard semantics — No web markup found — accessibility is not applicable to this repository.
  • AC5 ARIA correctness — No web markup found — accessibility is not applicable to this repository.
  • AC6 Visual & motion safety — No web markup found — accessibility is not applicable to this repository.
  • AC7 A11y enforcement — No web markup found — accessibility is not applicable to this repository.
  • AX1 Captive dependencies — Not applicable: this repository's Swift imports no dependency-injection container and defines no container of its own — nothing that both registers and resolves bindings, and nothing that names two lifetimes — so nothing holds one lifetime's instance while handing out another's.
  • AX5 Architecture & structure — not assessed — architecture style/structure is computed from a project graph (projects, types, module namespaces) that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX6 Interface segregation — not assessed — interface segregation is computed over a type surface that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • AX7 Slice cohesion — not applicable — not a vertical-slice architecture
  • AXB1 Runtime evidence locked — no reproducible boot — This repository has nothing the runtime tiers could boot or serve — no markup, no UI framework or web-server dependency, no UI component source, no native UI project and no API definition — nothing here is a surface to boot — so runtime a11y/egress/header evidence has no subject here. Not applicable: this is neither a gap in the scan nor a finding about your code.
  • AXB2 Runtime readiness — Advisory — this card reports evidence and never carries a score, so there is nothing missing here.
  • C1 Data Protection — Not assessed: these personal data controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks personal data controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C2 Access Controls — Not assessed: these authorization controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks authorization controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • C4 Data Retention — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data whose lifetime a retention limit would bound.
  • C5 Data-Subject Rights — No personal data detected in a persisted data model — no PII-named property (email, firstName, dateOfBirth, phoneNumber, …) or stored credential on a SwiftData @Model, a Core Data, Realm, GRDB or Fluent type, a GRDB or SQLite.swift column, or in a SQL CREATE TABLE or ALTER TABLE — and no database or data-store client (CoreData, SwiftData, GRDB, RealmSwift, SQLite, Firebase, …) imported either, so this repository keeps no personal data for a data subject to erase, export or consent over.
  • D11 Test Reliability — Test reliability not included — the .swift suite was found but not re-run
  • D18 Solution Shape — D18 scores the shape of a .NET solution; this repository has no .NET solution or project files, so the dimension does not apply.
  • D19 Documentation Quality — No runnable or published unit to look for an example in, and no multi-project root README to look for a map in; the other documentation kinds are withheld (see the gaps), so documentation quality is not applicable here.
  • D21 Naming Consistency — Naming consistency is measured on C# only; Python, Swift, html not measured.
  • D22 Internal API Consistency — API consistency is measured on C# only; the exposed Swift surface was not measured.
  • D23 Boundary Type-Coupling — No bounded-context organisation was detected either — neither a context-shaped layout, nor 2+ sibling source directories each declaring an aggregate root, nor 2+ sibling projects each declaring an entity of their own or taking another project's integration events. Declaring this codebase's bounded contexts (≥2) would let cross-boundary type coupling be assessed. Declare them in `.codehealth/config.yaml` at the repository root (create it if absent), mapping each context name to the module-path or namespace prefixes that belong to it — e.g. `architecture:` → `contexts:` → `Billing: ["src/billing", "Acme.Billing"]`, `Catalog: ["src/catalog", "Acme.Catalog"]`.
  • D24 Comment Value — D24 reads C# and Visual Basic 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
  • D27 Navigability — D27 counts a call into the standard library or a dependency as unresolved for this repository's language (.swift), so too few call sites counted as resolved to assess navigability. Not scored: this is a gap in the analyzer, not a verdict about this repository.
  • D31 IaC & Container Security — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.
  • D32 Data Compliance (PII/GDPR) — 48 file(s) were not parsed by semgrep — the PII/GDPR ruleset never ran over them
  • D37 Vulnerability-disclosure Policy — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.
  • D39 IL Efficiency — D39 measures the IL emitted by a .NET build; this repository has no .NET solution or project files, so the dimension does not apply.
  • D40 Network Egress Confinement — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.
  • D41 Kernel & Syscall Confinement — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.
  • D42 Runtime Threat Enforcement — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.
  • D7 Architectural Integrity — no checkable ADRs, and no project-reference graph for the cycle pass to read — so this dimension makes no claim about dependency cycles in either direction (where this repository's language has an import-cycle lens, cycles are reported there). Architectural integrity not assessed
  • D8 Code Coverage — Coverage not measured — Swift suite
  • DM1 Domain Modelling — not scored — this repository shows only 1 of the 3 signals this lens looks for (3 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 and Scala, and none was read for this repository's product. That is a limit of the analyzer, not a finding about your code.
  • IC1 Incompleteness & stubs — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • P12 CI test-gate honesty — Reported, not scored — and nothing was matched here. The coverage check applies to any stack, and the automatic-re-run check to any GitHub-Actions workflow, but the checks for excluded tests, skipped tests and sleep-based synchronisation currently recognise only some ecosystems' test-runner idioms, so on a repository built with another stack the zeros below mean 'not checked', not 'clean'.
  • P8 Schema migrations — no ORM, schema-migration tool or schema auto-create was found in this repository's dependency manifests or source, so there is no database schema for this check to judge
  • P9 Domain vs controller coverage — no coverage report found on disk — produce a coverage report in a standard format (lcov — `swift test --enable-code-coverage` (SwiftPM) or `xcodebuild test -scheme <YourScheme> -enableCodeCoverage YES` (an .xcodeproj/.xcworkspace suite), then `xcrun llvm-cov export -format=lcov`) and commit it — a hosted scan measures a clone of the repository, so a report that exists only in a working tree, a CI runner's or your own, never reaches it; the artefact is commonly gitignored, so `git add -f` that one file (or un-ignore its path) and commit it alongside the code it measures, or wire coverage collection into CI, to enable this cross-layer check
  • S1 Web-Security Posture — Not assessed: these web-security controls are read from a source model (declarative annotations, request middleware, entity/column names, guard methods) that was not loaded for this repository — because the repository is written in a language this check does not yet model, or because its projects failed to load. Absence of an idiom this check recognises is NOT evidence that this repository lacks web-security controls: it may implement them entirely in its own ecosystem. This is a gap in the analyzer's language coverage, not a finding about this repository.
  • X16 Unfloored truncation loop — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X18 Disposal-pattern correctness — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X2 Cancellation propagation — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X20 Mistyped argument guard — This check asks whether an argument guard reports an EMPTY value as a NULL one, which needs a language that throws a null-specific argument exception — .NET's ArgumentNullException, the JVM's NullPointerException, Dart's ArgumentError.notNull. This repository contains none of those languages: the ones it is written in have a single exception for a bad argument, so there is no pair of exceptions to confuse and nothing here for it to assess. Not a gap in the analyzer and not a finding about your code.
  • 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
  • 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 — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X5 Nullable reference types — not analysed — these correctness checks read a source model that was not loaded for this repository, because the repository is written in a language this check does not yet model, or because its projects failed to load. This is a gap in the analyzer, not a finding about this repository
  • X6 Hand-rolled structured-format parsing — 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 — 19 finding(s)
D29 · Static Analysis (SAST) · REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
  • REDACTED
D34 · Knowledge Freshness · Orphaned knowledge · ×5
  • Orphaned knowledge Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge Sources/SpeechVAD/Community1Clustering.swift:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge Sources/IndicMioTTS/MioCodecWaveDecoder.swift:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge scripts/export_moss_mlx.py:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
  • Orphaned knowledge Sources/FlashSR/UNet.swift:1 — No living knowledge remains for this large file — its last meaningful change has decayed away; if it breaks, no one currently understands it. Schedule a read-through / add characterisation tests before it bites.
D30 · Dependency Vulnerabilities · High CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D30 · Dependency Vulnerabilities · Critical CVE · ×2
  • REDACTED
  • REDACTED
D28 · Secrets (history) · REDACTED · ×1
  • REDACTED
D30 · Dependency Vulnerabilities · Critical vulnerability · ×1
  • REDACTED
Serious — 1691 finding(s)
D10 · Test Quality · Skipped test · ×259
  • Skipped test: testMLXForwardMatchesONNXFixtureWhenAvailable Tests/Audio2Face3DTests/Audio2Face3DParityTests.swift:5 — Skipped — throws XCTSkip
  • Skipped test: testJamesMLXRuntimeLoadsWhenBundleIsAvailable Tests/Audio2Face3DTests/Audio2Face3DTests.swift:79 — Skipped — throws XCTSkip
  • Skipped test: testStreamingCLIProducesCompleteWAV Tests/AudioCLITests/E2EBreezeCLITests.swift:5 — Skipped — throws XCTSkip
  • Skipped test: testNativeCLIStreamingProducesCompleteWAV Tests/AudioCLITests/E2EPocketCLITests.swift:5 — Skipped — throws XCTSkip
  • Skipped test: testCommandsRunExportedCheckpoint Tests/AudioCLITests/GLiNERCommandTests.swift:120 — Skipped — throws XCTSkip
  • Skipped test: testPublishedMLXModelRunsThroughCLICommand Tests/AudioCLITests/LanguageIDCommandTests.swift:53 — Skipped — throws XCTSkip
  • Skipped test: testAppleRemindersMCPServerExposesPinnedTools Tests/AudioCLITests/VoiceChatCommandTests.swift:2189 — Skipped — throws XCTSkip
  • Skipped test: testFileModeRunsCompleteINT5PipelineAndWritesAudio Tests/AudioCLITests/VoiceChatCommandTests.swift:2238 — Skipped — throws XCTSkip
  • Skipped test: testStartsVoiceProcessingGraphOnCurrentAudioDevices Tests/AudioCommonTests/FullDuplexAudioIOTests.swift:56 — Skipped — throws XCTSkip
  • Skipped test: testValidatedLocalPathAcceptsMissingFileUnderPrivatePrefixedDirectory Tests/AudioCommonTests/HuggingFaceDownloaderTests.swift:487 — Skipped — throws XCTSkip
  • Skipped test: testStallTimeoutDefaultIsEndUserTuned Tests/AudioCommonTests/HuggingFaceDownloaderTests.swift:675 — Skipped — throws XCTSkip
  • Skipped test: testRealNativeSpeechAndFullWhisperRoundTrip Tests/AudioServerTests/E2ENativeInferenceTests.swift:6 — Skipped — throws XCTSkip
  • Skipped test: testAudioData Tests/AudioServerTests/E2EOpenAITranscriptionsTests.swift:23 — Skipped — throws XCTSkip
  • Skipped test: testSDKHTTPAndWebSocketReturnTheSamePresetAudio Tests/AudioServerTests/E2EPocketTransportTests.swift:8 — Skipped — throws XCTSkip
  • Skipped test: testAudioPCM16At24kHz Tests/AudioServerTests/E2ERealtimeAPIEnginesTests.swift:97 — Skipped — throws XCTSkip
  • Skipped test: testS2SHibikiTranslatesAudio Tests/AudioServerTests/E2ERealtimeAPIEnginesTests.swift:245 — Skipped — throws XCTSkip
  • Skipped test: testReferenceCloneAndDirection Tests/BreezeTTSTests/E2EBreezeTTSTests.swift:109 — Skipped — throws XCTSkip
  • Skipped test: testLoadOurExport Tests/CSMTests/CSMLoadTests.swift:11 — Skipped — throws XCTSkip
  • Skipped test: testGenerateFrameRuns Tests/CSMTests/CSMLoadTests.swift:31 — Skipped — throws XCTSkip
  • Skipped test: testGenerateFrameLoop Tests/CSMTests/CSMLoadTests.swift:55 — Skipped — throws XCTSkip
  • Skipped test: testGenerateAudio Tests/CSMTests/CSMLoadTests.swift:80 — Skipped — throws XCTSkip
  • Skipped test: testTextToAudio Tests/CSMTests/CSMPipelineTests.swift:11 — Skipped — throws XCTSkip
  • Skipped test: testFromPretrainedE2E Tests/CSMTests/CSMPipelineTests.swift:40 — Skipped — throws XCTSkip
  • Skipped test: testTranscribesRealSpeech Tests/CanaryASRTests/E2ECanaryTests.swift:105 — Skipped — throws XCTSkip
  • Skipped test: testMelMatchesTheTrainingPreprocessor Tests/CanaryASRTests/MelContractTests.swift:30 — Skipped — throws XCTSkip
  • + 234 more in this group — see findings.md.
D10 · Test Quality · No assertions · ×142
  • No assertions: testFromPretrainedMarkGeneratesFrames Tests/Audio2Face3DTests/E2EAudio2Face3DTests.swift:8 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testFromPretrainedClaireGeneratesFrames Tests/Audio2Face3DTests/E2EAudio2Face3DTests.swift:14 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testFromPretrainedJamesGeneratesFrames Tests/Audio2Face3DTests/E2EAudio2Face3DTests.swift:20 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testIndexTTS2RejectsMissingVoiceSample Tests/AudioCLITests/AudioCLITests.swift:1010 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testIndexTTS2RejectsUnsupportedControls Tests/AudioCLITests/AudioCLITests.swift:1016 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testF5RejectsMissingVoiceSample Tests/AudioCLITests/AudioCLITests.swift:1101 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testF5RejectsMissingOrBlankReferenceText Tests/AudioCLITests/AudioCLITests.swift:1107 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testF5RejectsUnsupportedControls Tests/AudioCLITests/AudioCLITests.swift:1119 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testF5RejectsInvalidSamplingValues Tests/AudioCLITests/AudioCLITests.swift:1146 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testHiggsRejectsRefTextWithoutVoiceSample Tests/AudioCLITests/AudioCLITests.swift:1213 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testHiggsRejectsUnsupportedControls Tests/AudioCLITests/AudioCLITests.swift:1219 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testHiggsRejectsInvalidSamplingValues Tests/AudioCLITests/AudioCLITests.swift:1234 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testIndicMioRejectsVoiceSampleWithExplicitEmbedding Tests/AudioCLITests/AudioCLITests.swift:1259 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testIndicMioRejectsQwen3StyleControls Tests/AudioCLITests/AudioCLITests.swift:1271 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testIndicMioRejectsStreamingAndBatch Tests/AudioCLITests/AudioCLITests.swift:1280 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMagpieRejectsVoiceSample Tests/AudioCLITests/AudioCLITests.swift:1289 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMagpieRejectsQwen3SpeakerFlag Tests/AudioCLITests/AudioCLITests.swift:1295 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMagpieRejectsInstruct Tests/AudioCLITests/AudioCLITests.swift:1301 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMagpieRejectsUnknownSpeaker Tests/AudioCLITests/AudioCLITests.swift:1315 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testMagpieCoreMLRejectsVoiceCloningFlags Tests/AudioCLITests/AudioCLITests.swift:1336 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testRejectsInvalidLabels Tests/AudioCLITests/GLiNERCommandTests.swift:72 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testRejectsInvalidDescriptions Tests/AudioCLITests/GLiNERCommandTests.swift:80 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testRejectsInvalidThresholdAndTask Tests/AudioCLITests/GLiNERCommandTests.swift:89 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testRejectsUnsafeBufferAndPromptCombinations Tests/AudioCLITests/VoiceChatCommandTests.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* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • No assertions: testAnUnknownSessionIdentifierStillAnswersTheSystem Tests/AudioCommonTests/BackgroundTransferTests.swift:498 — This method's body runs code, and no assertion call was recognised in it. Recognised by name: Assert*, *Should*/ShouldBe*, Verify, Expect, Throws, Record, Received/DidNotReceive, MustHaveHappened/MustNotHaveHappened, EnsureSuccessStatusCode and *AndEnsure* — so verification routed through a helper of your own naming, through a base-class or callback object whose members hold the assertions, or through a harness that fails by throwing under some other name, is not visible to this check and is not counted here. Read it as 'no assertion this check knows how to see', and if that is right, add one.
  • + 117 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (5 lines × 2) · ×70
  • Duplicated block (5 lines × 2) Sources/AsrBenchmark/Memory.swift:38 — Sources/AsrBenchmark/Memory.swift:38-42 | Sources/BenchmarkSupport/BenchmarkSupport.swift:242-246 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) Sources/AudioCLILib/ClefCommand.swift:58 — Sources/AudioCLILib/ClefCommand.swift:58-62 | Sources/ClefCLI/main.swift:21-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/ClefCommand.swift:58` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (5 lines × 2) Sources/AudioCommon/Tokenizer.swift:73 — Sources/AudioCommon/Tokenizer.swift:73-78 | Sources/Qwen3Chat/ChatTokenizer.swift:110-114 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCommon/Tokenizer.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.
  • Duplicated block (5 lines × 2) Sources/AudioServer/AudioServer.swift:1920 — Sources/AudioServer/AudioServer.swift:1920-1924 | Sources/KokoroTTS/Phonemizer.swift:347-351 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioServer/AudioServer.swift:1920` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (5 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:344 — Sources/ChatterboxTTS/S3GenVocoder.swift:344-348 | Sources/CosyVoiceTTS/HiFiGAN.swift:430-434 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:344` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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) Sources/ChatterboxTTS/S3GenVocoder.swift:365 — Sources/ChatterboxTTS/S3GenVocoder.swift:365-369 | Sources/CosyVoiceTTS/HiFiGAN.swift:453-457 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.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) Sources/CosyVoiceTTS/FlowMelExtractor.swift:90 — Sources/CosyVoiceTTS/FlowMelExtractor.swift:90-94 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:86-90 — before extracting anything, compare `Sources/CosyVoiceTTS/FlowMelExtractor.swift` and `Sources/CosyVoiceTTS/WhisperMelExtractor.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 139 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) Sources/DiarizationBenchmark/DiarizationBench.swift:850 — Sources/DiarizationBenchmark/DiarizationBench.swift:850-854 | Sources/SpeechVAD/DERScoring.swift:286-292 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/DiarizationBenchmark/DiarizationBench.swift:850` 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 (5 lines × 2) Sources/FishAudioTTS/FishAudioCodec.swift:70 — Sources/FishAudioTTS/FishAudioCodec.swift:70-74 | Sources/FishAudioTTS/FishAudioCodec.swift:86-90 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioCodec.swift:70` 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 (5 lines × 2) Sources/FishAudioTTS/FishAudioCodec.swift:94 — Sources/FishAudioTTS/FishAudioCodec.swift:94-98 | Sources/FishAudioTTS/FishAudioCodec.swift:112-116 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioCodec.swift:94` 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) Sources/FlashSR/Vocoder.swift:299 — Sources/FlashSR/Vocoder.swift:299-303 | Sources/IndexTTS2TTS/IndexTTS2BigVGAN.swift:166-170 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FlashSR/Vocoder.swift:299` 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) Sources/HibikiTranslate/HibikiDepformer.swift:203 — Sources/HibikiTranslate/HibikiDepformer.swift:203-207 | Sources/PersonaPlex/Depformer.swift:178-182 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:129 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:129-133 | Sources/PersonaPlex/TemporalTransformer.swift:127-131 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiTemporalTransformer.swift:129` 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 `cfg` to `HibikiTemporalConfig` in one and `TemporalTransformerConfig` 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 (5 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:140 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:140-144 | Sources/PersonaPlex/TemporalTransformer.swift:141-145 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiTemporalTransformer.swift:140` 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 (5 lines × 2) Sources/HiggsTTS/HiggsTTSBackbone.swift:45 — Sources/HiggsTTS/HiggsTTSBackbone.swift:45-49 | Sources/IndicMioTTS/IndicMioQwen3.swift:40-46 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HiggsTTS/HiggsTTSBackbone.swift:45` 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) Sources/HiggsTTS/HiggsTTSBackbone.swift:117 — Sources/HiggsTTS/HiggsTTSBackbone.swift:117-121 | Sources/Qwen3Chat/Qwen3DenseModel.swift:171-175 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HiggsTTS/HiggsTTSBackbone.swift:117` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 2) Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:188 — Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:188-193 | Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:195-199 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:188` 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) Sources/IndicMioTTS/IndicMioQwen3.swift:250 — Sources/IndicMioTTS/IndicMioQwen3.swift:250-259 | Sources/Qwen3TTS/TTSWeightLoading.swift:350-354 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndicMioTTS/IndicMioQwen3.swift:250` 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 (5 lines × 2) Sources/KokoroTTS/Phonemizer.swift:467 — Sources/KokoroTTS/Phonemizer.swift:467-471 | Sources/KokoroTTS/Phonemizer.swift:493-497 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/KokoroTTS/Phonemizer.swift:467` 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) Sources/MLXCommon/SlaneyMel.swift:124 — Sources/MLXCommon/SlaneyMel.swift:124-128 | Sources/SpeechRestoration/SeamlessM4TFrontEnd.swift:306-310 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (5 lines × 2) Sources/MagpieTTS/Transformer.swift:140 — Sources/MagpieTTS/Transformer.swift:140-147 | Sources/MagpieTTS/Transformer.swift:219-223 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/Transformer.swift:140` 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) Sources/MagpieTTS/Transformer.swift:150 — Sources/MagpieTTS/Transformer.swift:150-155 | Sources/MagpieTTS/Transformer.swift:226-230 — both copies are in the same file, so extract the 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) Sources/MagpieTTSCoreML/CoreMLHelpers.swift:111 — Sources/MagpieTTSCoreML/CoreMLHelpers.swift:111-115 | Sources/SupertonicTTS/SupertonicGraphs.swift:28-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTSCoreML/CoreMLHelpers.swift:111` 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) Sources/MossTranscribe/MossMLXAudioModel.swift:25 — Sources/MossTranscribe/MossMLXAudioModel.swift:25-41 | Sources/VoxtralASR/VoxtralAudioEncoder.swift:21-25 — before extracting anything, compare `Sources/MossTranscribe/MossMLXAudioModel.swift` and `Sources/VoxtralASR/VoxtralAudioEncoder.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MossTranscribe/MossMLXAudioModel.swift:25` 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 (5 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:217 — Sources/NemotronStreamingASR/StreamingSession.swift:217-221 | Sources/ParakeetStreamingASR/StreamingSession.swift:218-222 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 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 `Sources/NemotronStreamingASR/StreamingSession.swift:217` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/ParakeetStreamingASR/StreamingSession.swift:226` calls `Array` and `Sources/NemotronStreamingASR/StreamingSession.swift:223` 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.
  • + 45 more in this group — see findings.md.
D3 · God Classes · MethodTooLong · ×45
  • MethodTooLong: VoiceChatBench.runFullDuplexToolScenario Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:886 — MethodTooLong — runFullDuplexToolScenario runs 445 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 345 over it, 4.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: VoxCPM2TTSModel.generateVoxCPM2 Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1149 — MethodTooLong — generateVoxCPM2 runs 309 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 209 over it, 3.09× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: VoiceChatSession.advance Sources/VoiceChat/VoiceChatSession.swift:946 — MethodTooLong — advance runs 282 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 182 over it, 2.82× 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: PersonaPlexModel.respondStream Sources/PersonaPlex/PersonaPlex.swift:618 — MethodTooLong — respondStream runs 280 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 180 over it, 2.80× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PersonaPlexModel.respond Sources/PersonaPlex/PersonaPlex.swift:127 — MethodTooLong — respond runs 268 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 168 over it, 2.68× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: PersonaPlexModel.respondRealtime Sources/PersonaPlex/PersonaPlex.swift:1012 — MethodTooLong — respondRealtime runs 221 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 121 over it, 2.21× 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: MossMLXModel.transcribeLocked Sources/MossTranscribe/MossMLXRuntime.swift:380 — MethodTooLong — transcribeLocked runs 212 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 112 over it, 2.12× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: AudioServer.buildRouter Sources/AudioServer/AudioServer.swift:90 — MethodTooLong — buildRouter runs 191 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 91 over it, 1.91× 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: Qwen3TTSModel.runStreamingGeneration Sources/Qwen3TTS/Qwen3TTS.swift:411 — MethodTooLong — runStreamingGeneration runs 184 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 84 over it, 1.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: VoiceChatCommand.runMicrophone Sources/AudioCLILib/VoiceChatCommand.swift:473 — MethodTooLong — runMicrophone runs 182 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 82 over it, 1.82× 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: PersonaPlexModel.respondDiagnostic Sources/PersonaPlex/PersonaPlex.swift:1332 — MethodTooLong — respondDiagnostic runs 177 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 77 over it, 1.77× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: RespondCommand.run Sources/AudioCLILib/RespondCommand.swift:94 — MethodTooLong — run runs 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.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.
  • MethodTooLong: SpeakCommand.runCosyVoice Sources/AudioCLILib/SpeakCommand.swift:1898 — MethodTooLong — runCosyVoice runs 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.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.
  • MethodTooLong: FullDuplexAcousticAnalyzer.analyze Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:621 — MethodTooLong — analyze runs 165 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 65 over it, 1.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.
  • MethodTooLong: SpeakCommand.validate Sources/AudioCLILib/SpeakCommand.swift:391 — MethodTooLong — validate runs 160 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 60 over it, 1.60× 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: MossTranscribeModel.transcribeLocked Sources/MossTranscribe/MossCoreMLRuntime.swift:605 — MethodTooLong — transcribeLocked runs 159 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 59 over it, 1.59× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: ChatterboxFlashT3Graphs.generateSpeechTokens Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:435 — MethodTooLong — generateSpeechTokens runs 157 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 57 over it, 1.57× 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: AsrBench.run Sources/AsrBenchmark/AsrBench.swift:44 — MethodTooLong — run runs 155 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 55 over it, 1.55× 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: PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization Sources/SpeechVAD/DiarizationPipeline.swift:310 — MethodTooLong — runEmbeddingClusteredDiarization runs 151 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 51 over it, 1.51× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: Qwen3TTSCoreMLModel.synthesize Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:220 — MethodTooLong — synthesize runs 140 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 40 over it, 1.40× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: HibikiTranslateModel.translate Sources/HibikiTranslate/HibikiTranslate.swift:41 — MethodTooLong — translate runs 138 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 38 over it, 1.38× 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: MossWhisperFeatureExtractor.extractPaddedChunk Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:76 — MethodTooLong — extractPaddedChunk runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: StreamingASR.transcribeStream Sources/Qwen3ASR/StreamingASR.swift:85 — MethodTooLong — transcribeStream runs 137 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 37 over it, 1.37× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
  • MethodTooLong: VibeVoiceTTSModel.generateLongForm Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:404 — MethodTooLong — generateLongForm runs 135 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 35 over it, 1.35× 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: VoiceChatBench.run Sources/VoiceChatBenchmark/VoiceChatBench.swift:175 — MethodTooLong — run runs 132 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 32 over it, 1.32× 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.
  • + 20 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (7 lines × 2) · ×40
  • Duplicated block (7 lines × 2) Sources/AudioCLILib/DiarizeCommand.swift:351 — Sources/AudioCLILib/DiarizeCommand.swift:351-357 | Sources/AudioCLILib/VadCommand.swift:105-111 — 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 `Sources/AudioCLILib/DiarizeCommand.swift:351` 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) Sources/AudioCLILib/VoiceChatDemoSupport.swift:804 — Sources/AudioCLILib/VoiceChatDemoSupport.swift:804-810 | Sources/AudioCLILib/VoiceChatDemoSupport.swift:1042-1048 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/VoiceChatDemoSupport.swift:1042` 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 (7 lines × 2) Sources/VoxtralASR/VoxtralAudioFrontend.swift:120 — Sources/CohereTranscribeASR/CohereAudioFrontend.swift:131-137 | Sources/VoxtralASR/VoxtralAudioFrontend.swift:120-126 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/VoxtralASR/VoxtralAudioFrontend.swift:128 — Sources/CohereTranscribeASR/CohereAudioFrontend.swift:139-145 | Sources/VoxtralASR/VoxtralAudioFrontend.swift:128-134 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/CosyVoiceTTS/LLM.swift:426 — Sources/CosyVoiceTTS/LLM.swift:426-433 | Sources/Qwen3TTS/CodePredictor.swift:195-201 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:426` 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, `Sources/Qwen3TTS/CodePredictor.swift:192` calls `proj` and `Sources/CosyVoiceTTS/LLM.swift:423` 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) Sources/DiarizationBenchmark/DiarizationBench.swift:160 — Sources/DiarizationBenchmark/DiarizationBench.swift:160-166 | Sources/VadBenchmark/VadBench.swift:155-161 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/DiarizationBenchmark/DiarizationBench.swift:160` 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) Sources/DiarizationBenchmark/DiarizationBench.swift:902 — Sources/DiarizationBenchmark/DiarizationBench.swift:902-909 | Sources/SpeechVAD/DERScoring.swift:347-353 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/DiarizationBenchmark/DiarizationBench.swift:902` 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) Sources/HibikiTranslate/HibikiWeightLoading.swift:229 — Sources/HibikiTranslate/HibikiWeightLoading.swift:229-235 | Sources/PersonaPlex/WeightLoading.swift:244-250 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:229` 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) Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:64 — Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:64-70 | Sources/IndicMioTTS/MioCodecGlobalEncoder.swift:39-45 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.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.
  • Duplicated block (7 lines × 2) Sources/IndicMioTTS/IndicMioConfig.swift:43 — Sources/IndicMioTTS/IndicMioConfig.swift:43-49 | Sources/Qwen3Chat/Qwen3DenseModel.swift:46-52 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (7 lines × 2) Sources/IndicMioTTS/IndicMioQwen3.swift:171 — Sources/IndicMioTTS/IndicMioQwen3.swift:171-181 | Sources/Qwen3Chat/Qwen3DenseModel.swift:217-223 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndicMioTTS/IndicMioQwen3.swift:171` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (7 lines × 2) Sources/MADLADTranslation/MADLADTranslator.swift:185 — Sources/MADLADTranslation/MADLADTranslator.swift:185-192 | Sources/MADLADTranslation/MADLADTranslator.swift:245-251 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MADLADTranslation/MADLADTranslator.swift:185` 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) Sources/MAGNeTMusicGen/MAGNeTLM.swift:183 — Sources/MAGNeTMusicGen/MAGNeTLM.swift:183-189 | Sources/OmnilingualASR/MLX/OmnilingualMLXWeightLoader.swift:108-114 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MAGNeTMusicGen/MAGNeTLM.swift:183` 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, `Sources/OmnilingualASR/MLX/OmnilingualMLXWeightLoader.swift:116` calls `applyLayerNormWeights` and `Sources/MAGNeTMusicGen/MAGNeTLM.swift:191` 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) Sources/MLXCommon/WeightLoading.swift:185 — Sources/MLXCommon/WeightLoading.swift:185-191 | Sources/MLXCommon/WeightLoading.swift:229-235 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/WeightLoading.swift:185` 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 (7 lines × 2) Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:67 — Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:67-73 | Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:93-99 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:67` 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 (7 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:147 — Sources/NemotronStreamingASR/StreamingSession.swift:147-153 | Sources/ParakeetStreamingASR/StreamingSession.swift:121-128 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 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 `Sources/NemotronStreamingASR/StreamingSession.swift:147` 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) Sources/NemotronStreamingASR/Vocabulary.swift:65 — Sources/NemotronStreamingASR/Vocabulary.swift:65-74 | Sources/ParakeetStreamingASR/Vocabulary.swift:17-23 — `Sources/NemotronStreamingASR/Vocabulary.swift` and `Sources/ParakeetStreamingASR/Vocabulary.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 3 separate duplicated blocks between them, totalling at least 49 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (7 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:430 — Sources/PersonaPlex/PersonaPlex.swift:430-436 | Sources/PersonaPlex/PersonaPlex.swift:909-915 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:430` 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) Sources/PersonaPlex/PersonaPlex.swift:524 — Sources/PersonaPlex/PersonaPlex.swift:524-530 | Sources/PersonaPlex/PersonaPlex.swift:893-899 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.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.
  • Duplicated block (7 lines × 2) Sources/Qwen3TTS/Qwen3TTS+ICL.swift:361 — Sources/Qwen3TTS/Qwen3TTS+ICL.swift:361-367 | Sources/Qwen3TTS/Qwen3TTS.swift:1521-1530 — 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) Sources/Qwen3TTS/Qwen3TTS.swift:2044 — Sources/Qwen3TTS/Qwen3TTS.swift:2044-2050 | Sources/Qwen3TTS/Qwen3TTS.swift:2063-2069 — both copies are in the same file, so extract the 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) Sources/Qwen3TTSCoreML/TalkerGenerator.swift:143 — Sources/Qwen3TTSCoreML/TalkerGenerator.swift:143-149 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:128-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. 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) Sources/SpeechRestoration/SidonModels.swift:27 — Sources/SpeechRestoration/SidonModels.swift:27-33 | Sources/SpeechRestoration/SidonModels.swift:64-70 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechRestoration/SidonModels.swift:27` 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 (7 lines × 2) Sources/SpeechVAD/SortformerDiarizer.swift:76 — Sources/SpeechVAD/SortformerDiarizer.swift:76-82 | Sources/SpeechVAD/SortformerDiarizer.swift:154-160 — both copies are in the same file, so extract the 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) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:267 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:267-273 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:576-582 — 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.
  • + 15 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (6 lines × 2) · ×33
  • Duplicated block (6 lines × 2) Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:405 — Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:405-410 | Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:1270-1275 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/AudioCLILib/VibeVoiceCommand.swift:93 — Sources/AudioCLILib/VibeVoiceCommand.swift:93-99 | Sources/AudioCLILib/VibeVoiceCommand.swift:117-122 — both copies are in the same file, so extract the 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) Sources/AudioServer/AudioServer.swift:1396 — Sources/AudioServer/AudioServer.swift:1396-1401 | Sources/AudioServer/AudioServer.swift:1407-1413 — both copies are in the same file, so extract the 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) Sources/AudioServer/AudioServer.swift:1919 — Sources/AudioServer/AudioServer.swift:1919-1924 | Sources/AudioServer/AudioServer.swift:1940-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 `Sources/AudioServer/AudioServer.swift:1919` 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 lines × 2) Sources/CosyVoiceTTS/DialogueParser.swift:70 — Sources/CosyVoiceTTS/DialogueParser.swift:70-75 | Sources/CosyVoiceTTS/DialogueParser.swift:119-124 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/DialogueParser.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 (6 lines × 2) Sources/DiarizationBenchmark/DiarizationBench.swift:96 — Sources/DiarizationBenchmark/DiarizationBench.swift:96-101 | Sources/VadBenchmark/VadBench.swift:105-110 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/F5TTS/F5TTSFlow.swift:514 — Sources/F5TTS/F5TTSFlow.swift:514-519 | Sources/IndexTTS2TTS/IndexTTS2S2MelFlow.swift:192-197 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (6 lines × 2) Sources/FishAudioTTS/FishAudioCodec.swift:62 — Sources/FishAudioTTS/FishAudioCodec.swift:62-67 | Sources/FishAudioTTS/FishAudioCodec.swift:78-83 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioCodec.swift:62` 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) Sources/FlashSR/Vocoder.swift:83 — Sources/FlashSR/Vocoder.swift:83-88 | Sources/IndexTTS2TTS/IndexTTS2BigVGAN.swift:305-310 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `factor` to `Int = 2` 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.
  • Duplicated block (6 lines × 2) Sources/IndicMioTTS/IndicMioSampler.swift:13 — Sources/IndicMioTTS/IndicMioSampler.swift:13-18 | Sources/Qwen3Chat/ChatSampler.swift:42-47 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `IndicMioSamplingConfig` in one and `ChatSamplingConfig` 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) Sources/MLXCommon/SDPA.swift:21 — Sources/MLXCommon/SDPA.swift:21-28 | Sources/MLXCommon/SDPA.swift:45-50 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/SDPA.swift:21` 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) Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:141 — Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:141-146 | Sources/ParakeetStreamingASR/RNNTGreedyDecoder.swift:159-164 — `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift` and `Sources/ParakeetStreamingASR/RNNTGreedyDecoder.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 5 separate duplicated blocks between them, totalling at least 62 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. 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) Sources/PersonaPlex/PersonaPlex.swift:870 — Sources/PersonaPlex/PersonaPlex.swift:870-875 | Sources/PersonaPlex/PersonaPlex.swift:1540-1545 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:870` 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) Sources/Qwen3ASR/CoreMLASRModel.swift:128 — Sources/Qwen3ASR/CoreMLASRModel.swift:128-133 | Sources/Qwen3ASR/CoreMLASRModel.swift:281-287 — both copies are in the same file, so extract the 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) Sources/Qwen3ASR/Qwen3ASR.swift:494 — Sources/Qwen3ASR/Qwen3ASR.swift:494-499 | Sources/Qwen3ASR/Qwen3ASR.swift:983-988 — both copies are in the same file, so extract the 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) Sources/Qwen3Chat/Gemma4Chat.swift:404 — Sources/Qwen3Chat/Gemma4Chat.swift:404-409 | Sources/Qwen3Chat/Gemma4Chat.swift:421-426 — both copies are in the same file, so extract the 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) Sources/Qwen3TTS/SpeakerEncoder.swift:385 — Sources/Qwen3TTS/SpeakerEncoder.swift:385-390 | Sources/SpeechVAD/FireRedVAD.swift:498-503 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/SpeakerEncoder.swift:385` 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) Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:218 — Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:218-223 | Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:134-139 — 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 `Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:218` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (6 lines × 2) Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:102 — Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:102-107 | Sources/Qwen3TTSCoreML/TalkerGenerator.swift:84-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.
  • Duplicated block (6 lines × 2) Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:118 — Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:118-123 | Sources/Qwen3TTSCoreML/TalkerGenerator.swift:101-106 — 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 `Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:118` 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) Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:181 — Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:181-186 | Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:272-277 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:181` 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) Sources/VibeVoiceTTS/Models/DiffusionHead.swift:69 — Sources/VibeVoiceTTS/Models/DiffusionHead.swift:69-74 | Sources/VibeVoiceTTS/Models/Qwen2MLP.swift:10-15 — 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) Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:168 — Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:168-174 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:676-681 — both copies are in the same file, so extract the 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) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:790 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:790-795 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:869-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 `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:790` 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) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:162 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:162-167 | Sources/PersonaPlex/TemporalTransformer.swift:163-168 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • + 8 more in this group — see findings.md.
D3 · God Classes · FileTooLong · ×27
  • FileTooLong: VoiceChat/VoiceChatSession.swift Sources/VoiceChat/VoiceChatSession.swift — FileTooLong — 1607 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 1107 over it, 3.21× 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: AudioCLILib/SpeakCommand.swift Sources/AudioCLILib/SpeakCommand.swift — FileTooLong — 1539 significant lines (blank, comment-only and punctuation-only lines excluded), about 99% of them inside a single declaration: SpeakCommand (21-2182). The bar is 500 significant lines; this is 1039 over it, 3.08× 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: AudioServer/AudioServer.swift Sources/AudioServer/AudioServer.swift — FileTooLong — 1381 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 881 over it, 2.76× 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: VoiceChatBenchmark/FullDuplexToolBench.swift Sources/VoiceChatBenchmark/FullDuplexToolBench.swift — FileTooLong — 1328 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 828 over it, 2.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: AudioCLILib/VoiceChatMCP.swift Sources/AudioCLILib/VoiceChatMCP.swift — FileTooLong — 1321 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 821 over it, 2.64× 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: Qwen3TTS/Qwen3TTS.swift Sources/Qwen3TTS/Qwen3TTS.swift — FileTooLong — 1264 significant lines (blank, comment-only and punctuation-only lines excluded), about 83% of them inside a single declaration: Qwen3TTSModel (32-1765). The bar is 500 significant lines; this is 764 over it, 2.53× 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: VoxCPM2TTS/VoxCPM2TTS.swift Sources/VoxCPM2TTS/VoxCPM2TTS.swift — FileTooLong — 1139 significant lines (blank, comment-only and punctuation-only lines excluded), about 95% of them inside a single declaration: VoxCPM2TTSModel (30-1561). The bar is 500 significant lines; this is 639 over it, 2.28× 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: PersonaPlex/PersonaPlex.swift Sources/PersonaPlex/PersonaPlex.swift — FileTooLong — 1096 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: PersonaPlexModel (12-1701). The bar is 500 significant lines; this is 596 over it, 2.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: IndexTTS2TTS/IndexTTS2SemanticGPT.swift Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift — FileTooLong — 1019 significant lines (blank, comment-only and punctuation-only lines excluded), about 92% of them inside a single declaration: IndexTTS2SemanticGPT (51-1279). The bar is 500 significant lines; this is 519 over it, 2.04× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: FishAudioTTS/FishAudioCodec.swift Sources/FishAudioTTS/FishAudioCodec.swift — FileTooLong — 861 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 361 over it, 1.72× 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: AudioCLILib/VoiceChatDemoSupport.swift Sources/AudioCLILib/VoiceChatDemoSupport.swift — FileTooLong — 847 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 347 over it, 1.69× 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: ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift — FileTooLong — 841 significant lines (blank, comment-only and punctuation-only lines excluded), about 65% of them inside a single declaration: ChatterboxFlashT3Graphs (180-911). The bar is 500 significant lines; this is 341 over it, 1.68× 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: KokoroTTS/GermanPhonemizer.swift Sources/KokoroTTS/GermanPhonemizer.swift — FileTooLong — 829 significant lines (blank, comment-only and punctuation-only lines excluded), about 100% of them inside a single declaration: GermanPhonemizer (19-1156). The bar is 500 significant lines; this is 329 over it, 1.66× 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: MossTranscribe/MossCoreMLRuntime.swift Sources/MossTranscribe/MossCoreMLRuntime.swift — FileTooLong — 809 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: MossTranscribeModel (212-1083). The bar is 500 significant lines; this is 309 over it, 1.62× 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: Qwen3ASR/Qwen3ASR.swift Sources/Qwen3ASR/Qwen3ASR.swift — FileTooLong — 774 significant lines (blank, comment-only and punctuation-only lines excluded), about 76% of them inside a single declaration: Qwen3ASRModel (118-1170). The bar is 500 significant lines; this is 274 over it, 1.55× 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: AudioCLILib/VoiceChatCommand.swift Sources/AudioCLILib/VoiceChatCommand.swift — FileTooLong — 759 significant lines (blank, comment-only and punctuation-only lines excluded), about 89% of them inside a single declaration: VoiceChatCommand (14-855). The bar is 500 significant lines; this is 259 over it, 1.52× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: DiarizationBenchmark/DiarizationBench.swift Sources/DiarizationBenchmark/DiarizationBench.swift — FileTooLong — 746 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 246 over it, 1.49× 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: qwen3_tts_coreml/convert_coreml.py scripts/qwen3_tts_coreml/convert_coreml.py — FileTooLong — 650 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 150 over it, 1.30× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: Qwen3Chat/Gemma4Model.swift Sources/Qwen3Chat/Gemma4Model.swift — FileTooLong — 611 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 111 over it, 1.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: AudioCLILib/TranscribeCommand.swift Sources/AudioCLILib/TranscribeCommand.swift — FileTooLong — 595 significant lines (blank, comment-only and punctuation-only lines excluded), about 82% of them inside a single declaration: TranscribeCommand (18-668). The bar is 500 significant lines; this is 95 over it, 1.19× the bar. Moving the declarations that sit BESIDE it into sibling files will not shorten this file. Extract from INSIDE that declaration instead: lift each cohesive group of its body — the parts that share the same inputs and are named together — into its own unit in a sibling file, and have the original call them.
  • FileTooLong: Audio2Face3D/Audio2Face3DMLXRuntime.swift Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift — FileTooLong — 574 significant lines (blank, comment-only and punctuation-only lines excluded), about 97% of them inside a single declaration: Audio2Face3DMLXRuntime (4-676). The bar is 500 significant lines; this is 74 over it, 1.15× 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: SpeechVAD/Community1Clustering.swift Sources/SpeechVAD/Community1Clustering.swift — FileTooLong — 569 significant lines (blank, comment-only and punctuation-only lines excluded), about 73% of them inside a single declaration: Community1Clustering (219-793). The bar is 500 significant lines; this is 69 over it, 1.14× 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: NemotronStreamingASR/NemotronMLXNetwork.swift Sources/NemotronStreamingASR/NemotronMLXNetwork.swift — FileTooLong — 566 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 66 over it, 1.13× the bar. To reduce it, split the file along the responsibilities already in it: move each cohesive group of declarations into its own sibling file in the same module or package, so no one file has to be read whole to change one of them.
  • FileTooLong: VoxCPM2TTS/MiniCPM4.swift Sources/VoxCPM2TTS/MiniCPM4.swift — FileTooLong — 538 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 38 over it, 1.08× 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: IndicMioTTS/MioCodecWaveDecoder.swift Sources/IndicMioTTS/MioCodecWaveDecoder.swift — FileTooLong — 520 significant lines (blank, comment-only and punctuation-only lines excluded). The bar is 500 significant lines; this is 20 over it, 1.04× 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.
  • + 2 more in this group — see findings.md.
D4 · Code Duplication · Duplicated block (8 lines × 2) · ×26
  • Duplicated block (8 lines × 2) Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:532 — Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:532-539 | Sources/AudioCommon/AudioIO.swift:156-163 — 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. 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) Sources/AsrBenchmark/AsrBench.swift:312 — Sources/AsrBenchmark/AsrBench.swift:312-319 | Sources/BenchmarkSupport/BenchmarkSupport.swift:225-232 — 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 (8 lines × 2) Sources/AudioServer/OpenAISpeech.swift:177 — Sources/AudioServer/OpenAISpeech.swift:177-184 | Sources/AudioServer/OpenAISpeech.swift:202-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioServer/OpenAISpeech.swift:177` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:103 — Sources/ChatterboxTTS/S3GenVocoder.swift:103-110 | Sources/ChatterboxTTS/S3GenVocoder.swift:140-147 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:103` 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) Sources/CosyVoiceTTS/LLM.swift:321 — Sources/CosyVoiceTTS/LLM.swift:321-328 | Sources/Qwen3TTS/Qwen3TTS.swift:1219-1226 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:321` 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) Sources/F5TTS/F5TTSConfig.swift:147 — Sources/F5TTS/F5TTSConfig.swift:147-154 | Sources/HiggsTTS/HiggsTTSConfig.swift:92-99 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/F5TTS/F5TTSConfig.swift:147` 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) Sources/HibikiTranslate/HibikiDepformer.swift:117 — Sources/HibikiTranslate/HibikiDepformer.swift:117-124 | Sources/PersonaPlex/Depformer.swift:92-99 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:117` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:79 — Sources/HibikiTranslate/HibikiWeightLoading.swift:79-86 | Sources/PersonaPlex/WeightLoading.swift:58-65 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:79` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:213 — Sources/HibikiTranslate/HibikiWeightLoading.swift:213-220 | Sources/PersonaPlex/WeightLoading.swift:228-235 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:213` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:187 — Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:187-194 | Sources/NemotronStreamingASR/SentencePieceUnigramTokenizer.swift:133-140 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:187` 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 (8 lines × 2) Sources/MLXCommon/SDPA.swift:30 — Sources/MLXCommon/SDPA.swift:30-37 | Sources/MLXCommon/SDPA.swift:52-59 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/SDPA.swift:30` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
  • Duplicated block (8 lines × 2) Sources/MagpieTTS/WeightLoader.swift:165 — Sources/MagpieTTS/WeightLoader.swift:165-172 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:27-34 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) Sources/MossTranscribe/MossMLXTextModel.swift:114 — Sources/MossTranscribe/MossMLXTextModel.swift:114-130 | Sources/VoxtralASR/VoxtralLanguageModel.swift:98-105 — 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 (8 lines × 2) Sources/ParakeetASR/MelPreprocessor.swift:34 — Sources/ParakeetASR/MelPreprocessor.swift:34-41 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:38-45 — before extracting anything, compare `Sources/ParakeetASR/MelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 162 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetASR/MelPreprocessor.swift:34` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `ParakeetConfig` in one and `ParakeetEOUConfig` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (8 lines × 2) Sources/Qwen3ASR/CoreMLEncoder.swift:173 — Sources/Qwen3ASR/CoreMLEncoder.swift:173-180 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:654-661 — 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 `Sources/Qwen3ASR/CoreMLEncoder.swift:173` 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) Sources/SpeechVAD/DERScoring.swift:106 — Sources/SpeechVAD/DERScoring.swift:106-113 | Sources/SpeechVAD/DERScoring.swift:290-301 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechVAD/DERScoring.swift:106` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8 lines × 2) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:97 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:97-104 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:107-114 — both copies are in the same file, so extract the 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) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1264 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1264-1271 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1341-1348 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1264` 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) Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:190 — Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:190-197 | Sources/VoxCPM2TTS/AudioVAE.swift:266-273 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (8 lines × 2) Sources/AudioCommon/AudioIO.swift:66 — Sources/AudioCommon/AudioIO.swift:66-73 | Sources/AudioCommon/SystemAudioTap.swift:176-183 — 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) Sources/VoxtralASR/VoxtralASR.swift:137 — Sources/CohereTranscribeASR/CohereTranscribe.swift:221-228 | Sources/VoxtralASR/VoxtralASR.swift:137-144 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 2) Sources/SpeechVAD/Nemotron3Diarizer.swift:375 — Sources/SpeechVAD/Nemotron3Diarizer.swift:375-382 | Sources/SpeechVAD/SortformerStreamingSession.swift:107-114 — 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, `Sources/SpeechVAD/SortformerStreamingSession.swift:98` calls `removeAll` and `Sources/SpeechVAD/Nemotron3Diarizer.swift:371` 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) Sources/F5TTS/F5TTSFlow.swift:266 — Sources/F5TTS/F5TTSFlow.swift:266-273 | Sources/F5TTS/F5TTSFlow.swift:504-511 — both copies are in the same file, so extract the 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) scripts/qwen3_tts_coreml/convert_coreml.py:324 — scripts/qwen3_tts_coreml/convert_coreml.py:324-331 | scripts/qwen3_tts_coreml/convert_coreml.py:417-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (8 lines × 2) Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:84 — Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:84-91 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:185-192 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • + 1 more in this group — see findings.md.
D3 · God Classes · ClassTooLong · ×19
  • ClassTooLong: SpeakCommand Sources/AudioCLILib/SpeakCommand.swift:21 — ClassTooLong — 1520 significant lines (blank, comment-only and punctuation-only lines excluded), 32 methods. The bar is 400 significant lines; this is 1120 over it, 3.80× 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: PersonaPlexModel Sources/PersonaPlex/PersonaPlex.swift:12 — ClassTooLong — 1091 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 691 over it, 2.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.
  • ClassTooLong: VoxCPM2TTSModel Sources/VoxCPM2TTS/VoxCPM2TTS.swift:30 — ClassTooLong — 1077 significant lines (blank, comment-only and punctuation-only lines excluded), 38 methods. The bar is 400 significant lines; this is 677 over it, 2.69× 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: Qwen3TTSModel Sources/Qwen3TTS/Qwen3TTS.swift:32 — ClassTooLong — 1053 significant lines (blank, comment-only and punctuation-only lines excluded), 45 methods. The bar is 400 significant lines; this is 653 over it, 2.63× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: IndexTTS2SemanticGPT Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:51 — ClassTooLong — 934 significant lines (blank, comment-only and punctuation-only lines excluded), 58 methods. The bar is 400 significant lines; this is 534 over it, 2.34× 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: GermanPhonemizer Sources/KokoroTTS/GermanPhonemizer.swift:19 — ClassTooLong — 828 significant lines (blank, comment-only and punctuation-only lines excluded), 55 methods. The bar is 400 significant lines; this is 428 over it, 2.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.
  • ClassTooLong: VoiceChatCommand Sources/AudioCLILib/VoiceChatCommand.swift:14 — ClassTooLong — 676 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 276 over it, 1.69× 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: MossTranscribeModel Sources/MossTranscribe/MossCoreMLRuntime.swift:211 — ClassTooLong — 664 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 264 over it, 1.66× 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: Qwen3ASRModel Sources/Qwen3ASR/Qwen3ASR.swift:118 — ClassTooLong — 587 significant lines (blank, comment-only and punctuation-only lines excluded), 30 methods. The bar is 400 significant lines; this is 187 over it, 1.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: Audio2Face3DMLXRuntime Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:4 — ClassTooLong — 556 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 156 over it, 1.39× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: ChatterboxFlashT3Graphs Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:180 — ClassTooLong — 548 significant lines (blank, comment-only and punctuation-only lines excluded), 20 methods. The bar is 400 significant lines; this is 148 over it, 1.37× 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: TranscribeCommand Sources/AudioCLILib/TranscribeCommand.swift:18 — ClassTooLong — 486 significant lines (blank, comment-only and punctuation-only lines excluded), 17 methods. The bar is 400 significant lines; this is 86 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MossMLXModel Sources/MossTranscribe/MossMLXRuntime.swift:16 — ClassTooLong — 486 significant lines (blank, comment-only and punctuation-only lines excluded), 11 methods. The bar is 400 significant lines; this is 86 over it, 1.22× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: F5TTSFlow Sources/F5TTS/F5TTSFlow.swift:49 — ClassTooLong — 457 significant lines (blank, comment-only and punctuation-only lines excluded), 23 methods. The bar is 400 significant lines; this is 57 over it, 1.14× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: KokoroPhonemizer Sources/KokoroTTS/Phonemizer.swift:13 — ClassTooLong — 436 significant lines (blank, comment-only and punctuation-only lines excluded), 29 methods. The bar is 400 significant lines; this is 36 over it, 1.09× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: HuggingFaceDownloader Sources/AudioCommon/HuggingFaceDownloader.swift:44 — ClassTooLong — 422 significant lines (blank, comment-only and punctuation-only lines excluded), 46 methods. The bar is 400 significant lines; this is 22 over it, 1.06× 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: JSONSchemaMatcher Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:10 — ClassTooLong — 418 significant lines (blank, comment-only and punctuation-only lines excluded), 22 methods. The bar is 400 significant lines; this is 18 over it, 1.05× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: Community1Clustering Sources/SpeechVAD/Community1Clustering.swift:219 — ClassTooLong — 413 significant lines (blank, comment-only and punctuation-only lines excluded), 15 methods. The bar is 400 significant lines; this is 13 over it, 1.03× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • ClassTooLong: MagpieTTSCoreML Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:26 — ClassTooLong — 408 significant lines (blank, comment-only and punctuation-only lines excluded), 14 methods. The bar is 400 significant lines; this is 8 over it, 1.02× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
D4 · Code Duplication · Duplicated block (9 lines × 2) · ×19
  • Duplicated block (9 lines × 2) Sources/VoxtralASR/VoxtralAudioFrontend.swift:104 — Sources/CohereTranscribeASR/CohereAudioFrontend.swift:115-123 | Sources/VoxtralASR/VoxtralAudioFrontend.swift:104-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CohereTranscribeASR/CohereAudioFrontend.swift:115` 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) Sources/FishAudioTTS/FishAudioCodec.swift:100 — Sources/FishAudioTTS/FishAudioCodec.swift:100-108 | Sources/FishAudioTTS/FishAudioCodec.swift:118-126 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioCodec.swift:100` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (9 lines × 2) Sources/FishAudioTTS/FishAudioCodec.swift:1036 — Sources/FishAudioTTS/FishAudioCodec.swift:1036-1044 | Sources/FishAudioTTS/FishAudioWeightLoading.swift:103-111 — 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) Sources/FlashSR/VAE.swift:203 — Sources/FlashSR/VAE.swift:203-211 | Sources/FlashSR/VAE.swift:230-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 `Sources/FlashSR/VAE.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 (9 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:289 — Sources/HibikiTranslate/HibikiDepformer.swift:289-297 | Sources/PersonaPlex/Depformer.swift:253-262 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:289` 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, `Sources/HibikiTranslate/HibikiDepformer.swift:299` calls `sliceIndex` and `Sources/PersonaPlex/Depformer.swift:264` 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) Sources/HibikiTranslate/HibikiWeightLoading.swift:28 — Sources/HibikiTranslate/HibikiWeightLoading.swift:28-36 | Sources/HibikiTranslate/HibikiWeightLoading.swift:58-66 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:28` 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) Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:191 — Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:191-199 | Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:353-361 — both copies are in the same file, so extract the 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) Sources/MagpieTTSCoreML/NanoCodec.swift:31 — Sources/MagpieTTSCoreML/NanoCodec.swift:31-39 | Sources/MagpieTTSCoreML/NanoCodec.swift:79-87 — both copies are in the same file, so extract the 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) Sources/NemotronStreamingASR/Vocabulary.swift:239 — Sources/NemotronStreamingASR/Vocabulary.swift:239-247 | Sources/ParakeetStreamingASR/Vocabulary.swift:39-47 — `Sources/NemotronStreamingASR/Vocabulary.swift` and `Sources/ParakeetStreamingASR/Vocabulary.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 3 separate duplicated blocks between them, totalling at least 49 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 `Sources/NemotronStreamingASR/Vocabulary.swift:239` 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, `Sources/NemotronStreamingASR/Vocabulary.swift:248` calls `isSpecialToken` and `Sources/ParakeetStreamingASR/Vocabulary.swift:48` 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) Sources/OmniVoiceTTS/OmniVoiceCodec.swift:280 — Sources/OmniVoiceTTS/OmniVoiceCodec.swift:280-288 | Sources/ParakeetASR/Configuration.swift:45-53 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/OmniVoiceTTS/OmniVoiceCodec.swift:280` 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) Sources/Qwen3ASR/Qwen3ASR.swift:730 — Sources/Qwen3ASR/Qwen3ASR.swift:730-738 | Sources/Qwen3ASR/Qwen3ASR.swift:826-834 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/Qwen3ASR.swift:730` 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) Sources/Qwen3ASR/StreamingASR.swift:155 — Sources/Qwen3ASR/StreamingASR.swift:155-163 | Sources/Qwen3ASR/StreamingASR.swift:182-190 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/StreamingASR.swift:155` 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) Sources/Qwen3Chat/Qwen35CoreMLChat.swift:136 — Sources/Qwen3Chat/Qwen35CoreMLChat.swift:136-144 | Sources/Qwen3Chat/Qwen35CoreMLChat.swift:146-154 — both copies are in the same file, so extract the 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) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:153 — Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:153-161 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:173-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:153` 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) Sources/SourceSeparation/WienerFilter.swift:13 — Sources/SourceSeparation/WienerFilter.swift:13-21 | Sources/SourceSeparation/WienerFilterMLX.swift:88-96 — 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 `Sources/SourceSeparation/WienerFilter.swift:13` 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) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:50 — Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:50-58 | Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:107-115 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:50` 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) Sources/OmniVoiceTTS/OmniVoiceCodec.swift:181 — Sources/OmniVoiceTTS/OmniVoiceCodec.swift:181-189 | Sources/OmniVoiceTTS/OmniVoiceCodecEncoder.swift:157-165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (9 lines × 2) scripts/qwen3_tts_coreml/convert_coreml.py:625 — scripts/qwen3_tts_coreml/convert_coreml.py:625-633 | scripts/qwen3_tts_coreml/convert_coreml.py:793-801 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/qwen3_tts_coreml/convert_coreml.py:625` 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) scripts/qwen3_tts_coreml/convert_coreml.py:639 — scripts/qwen3_tts_coreml/convert_coreml.py:639-647 | scripts/qwen3_tts_coreml/convert_coreml.py:653-661 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `scripts/qwen3_tts_coreml/convert_coreml.py: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.
D4 · Code Duplication · Duplicated block (12 lines × 2) · ×18
  • Duplicated block (12 lines × 2) Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:617 — Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:617-628 | Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:661-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 `Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:617` 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) Sources/AudioCLILib/TranscribeCommand.swift:623 — Sources/AudioCLILib/TranscribeCommand.swift:623-634 | Sources/AudioCLILib/TranscribeCommand.swift:653-664 — both copies are in the same file, so extract the 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) Sources/FishAudioTTS/FishAudioDualAR.swift:35 — Sources/FishAudioTTS/FishAudioDualAR.swift:35-46 | Sources/FishAudioTTS/FishAudioDualAR.swift:49-60 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) Sources/FishAudioTTS/FishAudioWeightLoading.swift:121 — Sources/FishAudioTTS/FishAudioWeightLoading.swift:121-132 | Sources/IndicMioTTS/IndicMioQwen3.swift:239-250 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioWeightLoading.swift:121` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12 lines × 2) Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:36 — Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:36-47 | Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:62-73 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:36` 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) Sources/MADLADTranslation/MADLADTranslationError.swift:12 — Sources/MADLADTranslation/MADLADTranslationError.swift:12-23 | Sources/Qwen3Chat/Qwen3ChatError.swift:11-22 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MADLADTranslation/MADLADTranslationError.swift:12` 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) Sources/MLXCommon/WeightLoading.swift:215 — Sources/MLXCommon/WeightLoading.swift:215-226 | Sources/MLXCommon/WeightLoading.swift:269-280 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/WeightLoading.swift:215` 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) Sources/MagpieTTS/SubVocab.swift:30 — Sources/MagpieTTS/SubVocab.swift:30-41 | Sources/MagpieTTS/SubVocab.swift:44-55 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (12 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:343 — Sources/NemotronStreamingASR/StreamingSession.swift:343-354 | Sources/ParakeetStreamingASR/StreamingSession.swift:422-433 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 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 `Sources/NemotronStreamingASR/StreamingSession.swift:343` 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 (12 lines × 2) Sources/PersonaPlex/Conv.swift:19 — Sources/PersonaPlex/Conv.swift:19-30 | Sources/PersonaPlex/Conv.swift:60-71 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/Conv.swift:19` 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) Sources/SpeechVAD/BiLSTM.swift:42 — Sources/SpeechVAD/BiLSTM.swift:42-53 | Sources/SpeechVAD/SileroModel.swift:131-142 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (12 lines × 2) Sources/SpeechVAD/ReDimNet2Speaker.swift:165 — Sources/SpeechVAD/ReDimNet2Speaker.swift:165-176 | Sources/SpeechVAD/SmartTurn.swift:77-88 — before extracting anything, compare `Sources/SpeechVAD/ReDimNet2Speaker.swift` and `Sources/SpeechVAD/SmartTurn.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 `Sources/SpeechVAD/ReDimNet2Speaker.swift:165` 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, `Sources/SpeechVAD/ReDimNet2Speaker.swift:163` calls `validateDefaultArtifact` and `Sources/SpeechVAD/SmartTurn.swift:76` 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) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:331 — Sources/VibeVoiceTTS/Inference/WeightLoader.swift:331-342 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:346-357 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VibeVoiceTTS/Inference/WeightLoader.swift:331` 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) Sources/VibeVoiceTTS/Models/AcousticTokenizerDecoder.swift:161 — Sources/VibeVoiceTTS/Models/AcousticTokenizerDecoder.swift:161-172 | Sources/VibeVoiceTTS/Models/AcousticTokenizerEncoder.swift:65-76 — 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) Sources/VoxtralASR/VoxtralLanguageModel.swift:128 — Sources/VoxtralASR/VoxtralLanguageModel.swift:128-139 | Sources/VoxtralTTS/LanguageModel.swift:128-139 — before extracting anything, compare `Sources/VoxtralASR/VoxtralLanguageModel.swift` and `Sources/VoxtralTTS/LanguageModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12 lines × 2) Sources/VoxtralASR/VoxtralLanguageModel.swift:167 — Sources/VoxtralASR/VoxtralLanguageModel.swift:167-178 | Sources/VoxtralTTS/LanguageModel.swift:167-178 — before extracting anything, compare `Sources/VoxtralASR/VoxtralLanguageModel.swift` and `Sources/VoxtralTTS/LanguageModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxtralASR/VoxtralLanguageModel.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. Note first that the copies are not typed on the same thing: the declarations holding them bind `state` to `VoxtralLanguageModelState ) -> (MLXArray` in one and `VoxtralTTSLanguageState ) -> (MLXArray` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12 lines × 2) scripts/qwen3_tts_coreml/convert_coreml.py:286 — scripts/qwen3_tts_coreml/convert_coreml.py:286-297 | scripts/qwen3_tts_coreml/convert_coreml.py:380-391 — both copies are in the same file, so extract the 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) Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:73 — Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:73-84 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:107-118 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.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. 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 (13 lines × 2) · ×16
  • Duplicated block (13 lines × 2) Examples/PersonaPlexDemo/PersonaPlexDemo/SentencePieceDecoder.swift:90 — Examples/PersonaPlexDemo/PersonaPlexDemo/SentencePieceDecoder.swift:90-102 | Sources/AudioCommon/SentencePieceModel.swift:133-145 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (13 lines × 2) Sources/AudioCLILib/SpeakCommand.swift:747 — Sources/AudioCLILib/SpeakCommand.swift:747-759 | Sources/AudioCLILib/SpeakCommand.swift:850-862 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/SpeakCommand.swift:747` 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) Sources/AudioServer/AudioServer.swift:1341 — Sources/AudioServer/AudioServer.swift:1341-1353 | Sources/AudioServer/AudioServer.swift:1357-1369 — both copies are in the same file, so extract the 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) Sources/VoxtralASR/VoxtralASR.swift:193 — Sources/CohereTranscribeASR/CohereTranscribe.swift:277-289 | Sources/VoxtralASR/VoxtralASR.swift:193-205 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CohereTranscribeASR/CohereTranscribe.swift:277` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13 lines × 2) Sources/VoxtralASR/VoxtralASR.swift:214 — Sources/CohereTranscribeASR/CohereTranscribe.swift:298-310 | Sources/VoxtralASR/VoxtralASR.swift:214-226 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Each matched range is the entire body of the declaration above it, so the region is already a complete unit: move that whole declaration to the shared location and have each site call it, rather than lifting the lines out of their bodies. Any `return` inside it is the body's own exit and keeps its meaning in the moved unit.
  • Duplicated block (13 lines × 2) Sources/CosyVoiceTTS/VoiceCloning.swift:317 — Sources/CosyVoiceTTS/VoiceCloning.swift:317-329 | Sources/CosyVoiceTTS/VoiceCloning.swift:339-351 — both copies are in the same file, so extract the 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) Sources/FishAudioTTS/FishAudioGeneration.swift:13 — Sources/FishAudioTTS/FishAudioGeneration.swift:13-25 | Sources/HibikiTranslate/Configuration.swift:288-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioGeneration.swift:13` 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) Sources/MagpieTTSCoreML/NanoCodec.swift:86 — Sources/MagpieTTSCoreML/NanoCodec.swift:86-98 | Sources/MagpieTTSCoreML/TextEncoder.swift:48-60 — 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 `Sources/MagpieTTSCoreML/NanoCodec.swift:86` 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, `Sources/MagpieTTSCoreML/TextEncoder.swift:47` calls `MLFeatureValue` and `Sources/MagpieTTSCoreML/NanoCodec.swift:85` 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) Sources/MossTranscribe/MossCoreMLRuntime.swift:799 — Sources/MossTranscribe/MossCoreMLRuntime.swift:799-811 | Sources/MossTranscribe/MossMLXRuntime.swift:636-649 — 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 `Sources/MossTranscribe/MossCoreMLRuntime.swift:799` 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, `Sources/MossTranscribe/MossMLXRuntime.swift:635` calls `CFAbsoluteTimeGetCurrent` and `Sources/MossTranscribe/MossCoreMLRuntime.swift:798` 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 (13 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:359 — Sources/NemotronStreamingASR/StreamingSession.swift:359-371 | Sources/ParakeetStreamingASR/StreamingSession.swift:439-451 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 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 `Sources/NemotronStreamingASR/StreamingSession.swift:359` 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 (13 lines × 2) Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:63 — Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:63-75 | Sources/VibeVoiceTTS/Models/AcousticTokenizerConfiguration.swift:89-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:63` 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) Sources/Qwen3TTS/Qwen3TTS+ICL.swift:172 — Sources/Qwen3TTS/Qwen3TTS+ICL.swift:172-184 | Sources/Qwen3TTS/Qwen3TTS.swift:328-340 — 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 (13 lines × 2) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:32 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:32-44 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:37-49 — 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) Sources/VoxCPM2TTS/AudioVAE.swift:85 — Sources/VoxCPM2TTS/AudioVAE.swift:85-97 | Sources/VoxCPM2TTS/AudioVAE.swift:133-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxCPM2TTS/AudioVAE.swift:85` 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 lines × 2) scripts/profiling/RuntimeOwnershipProfile.swift:142 — scripts/profiling/RuntimeOwnershipProfile.swift:142-154 | scripts/profiling/RuntimeOwnershipProfile.swift:159-171 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (13 lines × 2) Sources/SpeechVAD/ReDimNet2Speaker.swift:208 — Sources/SpeechVAD/ReDimNet2Speaker.swift:208-220 | Sources/SpeechVAD/SmartTurn.swift:119-131 — before extracting anything, compare `Sources/SpeechVAD/ReDimNet2Speaker.swift` and `Sources/SpeechVAD/SmartTurn.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 (10 lines × 2) · ×16
  • Duplicated block (10 lines × 2) Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:45 — Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:45-54 | Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:99-108 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:45` 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) Sources/AudioCLILib/SpeakCommand.swift:1517 — Sources/AudioCLILib/SpeakCommand.swift:1517-1526 | Sources/AudioCLILib/SpeakCommand.swift:1572-1581 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/SpeakCommand.swift:1517` 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) Sources/BenchmarkSupport/BenchmarkSupport.swift:91 — Sources/BenchmarkSupport/BenchmarkSupport.swift:91-100 | Sources/BenchmarkSupport/BenchmarkSupport.swift:117-126 — both copies are in the same file, so extract the 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) Sources/CosyVoiceTTS/FlowMelExtractor.swift:212 — Sources/CosyVoiceTTS/FlowMelExtractor.swift:212-221 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:197-206 — before extracting anything, compare `Sources/CosyVoiceTTS/FlowMelExtractor.swift` and `Sources/CosyVoiceTTS/WhisperMelExtractor.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 139 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:175 — Sources/HibikiTranslate/HibikiDepformer.swift:175-184 | Sources/PersonaPlex/Depformer.swift:150-159 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:175` 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) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:169 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:169-178 | Sources/PersonaPlex/TemporalTransformer.swift:171-180 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (10 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:149 — Sources/PersonaPlex/PersonaPlex.swift:149-158 | Sources/PersonaPlex/PersonaPlex.swift:1345-1354 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.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 (10 lines × 2) Sources/Qwen3ASR/CoreMLASRModel.swift:85 — Sources/Qwen3ASR/CoreMLASRModel.swift:85-94 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:143-154 — 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 `Sources/Qwen3ASR/CoreMLASRModel.swift:85` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/Qwen3ASR/CoreMLASRModel.swift:83` calls `CoreMLASRModel`, `appendingPathComponent` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:143` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10 lines × 2) Sources/Qwen3ASR/CoreMLASRModel.swift:141 — Sources/Qwen3ASR/CoreMLASRModel.swift:141-150 | Sources/Qwen3ASR/CoreMLASRModel.swift:295-304 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (10 lines × 2) Sources/Qwen3TTS/CodePredictor.swift:104 — Sources/Qwen3TTS/CodePredictor.swift:104-113 | Sources/Qwen3TTS/Talker.swift:115-124 — before extracting anything, compare `Sources/Qwen3TTS/CodePredictor.swift` and `Sources/Qwen3TTS/Talker.swift` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 102 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 `Sources/Qwen3TTS/CodePredictor.swift:104` 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 `config` to `CodePredictorConfig` in one and `TalkerConfig` 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 (10 lines × 2) Sources/Qwen3TTS/Qwen3TTS.swift:228 — Sources/Qwen3TTS/Qwen3TTS.swift:228-237 | Sources/Qwen3TTS/Qwen3TTS.swift:335-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/Qwen3TTS.swift:228` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (10 lines × 2) Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:129 — Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:129-138 | Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:220-231 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:129` 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) Sources/SpeechEnhancement/AudioProcessing.swift:326 — Sources/SpeechEnhancement/AudioProcessing.swift:326-335 | Sources/SpeechEnhancement/AudioProcessing.swift:355-364 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechEnhancement/AudioProcessing.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.
  • Duplicated block (10 lines × 2) Sources/SpeechEnhancement/MLXDeepFilterNet3Network.swift:386 — Sources/SpeechEnhancement/MLXDeepFilterNet3Network.swift:386-395 | Sources/SpeechEnhancement/WeightLoading.swift:25-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 (10 lines × 2) Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:216 — Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:216-225 | Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:245-254 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:216` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (10 lines × 2) Sources/MossTranscribe/MossMLXMemory.swift:7 — Sources/MossTranscribe/MossMLXMemory.swift:7-16 | Sources/VoxCPM2TTS/VoxCPM2Memory.swift:8-17 — 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.
D15 · Churn × Complexity Hotspots · Hotspot · ×15
  • Hotspot: Sources/AudioServer/AudioServer.swift Sources/AudioServer/AudioServer.swift:968 — Sources/AudioServer/AudioServer.swift changed 8 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 105 in AudioServer.swift.handleRealtimeWS at line 968. 1 of those changes was a fix/bug commit, and the other 7 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/AudioServer/AudioServer.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: Sources/AudioCLILib/SpeakCommand.swift Sources/AudioCLILib/SpeakCommand.swift:391 — Sources/AudioCLILib/SpeakCommand.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 128 in SpeakCommand.validate at line 391. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/AudioCLILib/SpeakCommand.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: Sources/Qwen3Chat/Gemma4Chat.swift Sources/Qwen3Chat/Gemma4Chat.swift:253 — Sources/Qwen3Chat/Gemma4Chat.swift changed 13 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in Gemma4Chat.decode at line 253. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3Chat/Gemma4Chat.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: Sources/VoiceChat/VoiceChatSession.swift Sources/VoiceChat/VoiceChatSession.swift:946 — Sources/VoiceChat/VoiceChatSession.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 68 in VoiceChatSession.advance at line 946. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/VoiceChat/VoiceChatSession.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: Sources/Qwen3Chat/Gemma4Tools.swift Sources/Qwen3Chat/Gemma4Tools.swift:153 — Sources/Qwen3Chat/Gemma4Tools.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 27 in Gemma4ToolCodec.prompt at line 153. 1 of those changes was a fix/bug commit, and the other 5 changed it for other reasons — this file is under both repair and feature pressure. Before the next change lands here, make sure the area it touches is under test, then split that area out of the file so the following change is smaller than this one — a file this often edited pays the complexity back every time. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3Chat/Gemma4Tools.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: Sources/Qwen3TTS/Qwen3TTS.swift Sources/Qwen3TTS/Qwen3TTS.swift:411 — Sources/Qwen3TTS/Qwen3TTS.swift changed 7 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 22 in Qwen3TTSModel.runStreamingGeneration at line 411. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3TTS/Qwen3TTS.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: Sources/Qwen3Chat/Gemma4UnifiedChat.swift Sources/Qwen3Chat/Gemma4UnifiedChat.swift:149 — Sources/Qwen3Chat/Gemma4UnifiedChat.swift changed 6 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 24 in Gemma4UnifiedChat.generateResponse at line 149. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3Chat/Gemma4UnifiedChat.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: Sources/KokoroTTS/KokoroTTS.swift Sources/KokoroTTS/KokoroTTS.swift:203 — Sources/KokoroTTS/KokoroTTS.swift changed 9 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in KokoroTTSModel.runModel at line 203. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/KokoroTTS/KokoroTTS.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: Sources/Clef/Clef.swift Sources/Clef/Clef.swift:41 — Sources/Clef/Clef.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in Clef.load at line 41. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Clef/Clef.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: Sources/VoxCPM2TTS/VoxCPM2TTS.swift Sources/VoxCPM2TTS/VoxCPM2TTS.swift:158 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift changed 4 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 15 in VoxCPM2TTSModel.fromPretrained at line 158. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/VoxCPM2TTS/VoxCPM2TTS.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: Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:40 — Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 28 in Qwen3TTSCoreMLModel.fromPretrained at line 40. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.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: Sources/AudioServer/OpenAISpeech.swift Sources/AudioServer/OpenAISpeech.swift:133 — Sources/AudioServer/OpenAISpeech.swift changed 3 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 18 in OpenAISpeech.swift.handleOpenAISpeech at line 133. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/AudioServer/OpenAISpeech.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: Sources/CosyVoiceTTS/CosyVoiceTTS.swift Sources/CosyVoiceTTS/CosyVoiceTTS.swift:62 — Sources/CosyVoiceTTS/CosyVoiceTTS.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 21 in CosyVoiceTTSModel.fromPretrained at line 62. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/CosyVoiceTTS/CosyVoiceTTS.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: Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:94 — Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 20 in IndexTTS2Tokenizer.encode at line 94. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/IndexTTS2TTS/IndexTTS2Tokenizer.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: Sources/DiarizationBenchmark/DiarizationBench.swift Sources/DiarizationBenchmark/DiarizationBench.swift:268 — Sources/DiarizationBenchmark/DiarizationBench.swift changed 2 times in last 90 days, and the most complex body those changes touched has cyclomatic complexity 19 in DiarizationBench.swift.makeDiarizationEngine at line 268. 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-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/DiarizationBenchmark/DiarizationBench.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.
D4 · Code Duplication · Members sharing a duplicated core (4 members, 50+ identical tokens) · ×12
  • Members sharing a duplicated core (4 members, 50+ identical tokens) Sources/AsrBenchmark/EngineNemotron.swift:17 — Sources/AsrBenchmark/EngineNemotron.swift:17-27 | Sources/AsrBenchmark/EngineNemotron.swift:64-84 | Sources/AsrBenchmark/EngineOmnilingual.swift:17-27 | Sources/AsrBenchmark/EngineParakeet.swift:17-31 — 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) Sources/AudioCLILib/DiarizeCommand.swift:83 — Sources/AudioCLILib/DiarizeCommand.swift:83-124 | Sources/AudioCLILib/EmbedSpeakerCommand.swift:24-88 | Sources/AudioCLILib/VadCommand.swift:44-122 | Sources/AudioCLILib/VadStreamCommand.swift:47-146 — 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) Sources/AudioCLILib/DiarizeCommand.swift:418 — Sources/AudioCLILib/DiarizeCommand.swift:418-436 | Sources/AudioCLILib/DiarizeCommand.swift:438-451 | Sources/AudioCLILib/VadCommand.swift:124-137 | Sources/AudioCLILib/VadStreamCommand.swift:158-175 — 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) Sources/CanaryASR/MelPreprocessor.swift:31 — Sources/CanaryASR/MelPreprocessor.swift:31-52 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:28-54 | Sources/ParakeetASR/MelPreprocessor.swift:26-49 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:31-56 — 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) Sources/FishAudioTTS/FishAudioTokenizer.swift:31 — Sources/FishAudioTTS/FishAudioTokenizer.swift:31-61 | Sources/HiggsTTS/HiggsTTSTokenizer.swift:57-76 | Sources/IndicMioTTS/IndicMioTokenizer.swift:12-41 | Sources/OmniVoiceTTS/OmniVoiceTokenizer.swift:28-47 — 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) Sources/FishAudioTTS/FishAudioTokenizer.swift:83 — Sources/FishAudioTTS/FishAudioTokenizer.swift:83-112 | Sources/Qwen3Chat/ChatTokenizer.swift:46-85 | Sources/Qwen3Chat/Gemma4Tokenizer.swift:39-87 | Sources/VoiceChat/VoiceChatTokenizer.swift:88-126 — 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) Sources/HibikiTranslate/HibikiWeightLoading.swift:113 — Sources/HibikiTranslate/HibikiWeightLoading.swift:113-138 | Sources/HibikiTranslate/HibikiWeightLoading.swift:149-199 | Sources/PersonaPlex/WeightLoading.swift:119-148 | Sources/PersonaPlex/WeightLoading.swift:160-216 — 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) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:381 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:381-394 | Sources/ParakeetASR/ParakeetASR.swift:538-561 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:223-236 | Sources/SpeechWakeWord/SpeechWakeWord.swift:326-336 — 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) Sources/Qwen3ASR/FloatTextDecoder.swift:50 — Sources/Qwen3ASR/FloatTextDecoder.swift:50-68 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:24-54 | Sources/Qwen3TTS/CodePredictor.swift:24-51 | Sources/Qwen3TTS/Talker.swift:29-56 — 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) Sources/Qwen3ASR/WeightLoading.swift:232 — Sources/Qwen3ASR/WeightLoading.swift:232-255 | Sources/Qwen3ASR/WeightLoading.swift:257-273 | Sources/Qwen3TTS/TTSWeightLoading.swift:103-133 | Sources/Qwen3TTS/TTSWeightLoading.swift:181-207 — 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) scripts/render_benchmark_dashboard.py:192 — scripts/render_benchmark_dashboard.py:192-232 | scripts/render_benchmark_dashboard.py:236-266 | scripts/render_benchmark_dashboard.py:270-300 | scripts/render_benchmark_dashboard.py:482-503 — 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) Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:55 — Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:55-77 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:79-100 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:102-125 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:127-150 — These 4 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Duplicated block (11 lines × 2) · ×11
  • Duplicated block (11 lines × 2) Sources/AudioCLILib/SpeakCommand.swift:1505 — Sources/AudioCLILib/SpeakCommand.swift:1505-1515 | Sources/AudioCLILib/SpeakCommand.swift:1560-1570 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/SpeakCommand.swift:1505` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (11 lines × 2) Sources/CanaryASR/Configuration.swift:101 — Sources/CanaryASR/Configuration.swift:101-111 | Sources/ParakeetASR/Configuration.swift:36-46 — `Sources/CanaryASR/Configuration.swift` and `Sources/ParakeetASR/Configuration.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 3 separate duplicated blocks between them, totalling at least 35 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 `Sources/CanaryASR/Configuration.swift:101` 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) Sources/VoxtralASR/VoxtralASR.swift:167 — Sources/CohereTranscribeASR/CohereTranscribe.swift:251-261 | Sources/VoxtralASR/VoxtralASR.swift:167-177 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CohereTranscribeASR/CohereTranscribe.swift:251` 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, `Sources/CohereTranscribeASR/CohereTranscribe.swift:250` calls `normalizeCohereWeightKeys` and `Sources/VoxtralASR/VoxtralASR.swift:166` 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) Sources/FunctionGemma/FunctionGemma.swift:242 — Sources/FunctionGemma/FunctionGemma.swift:242-252 | Sources/FunctionGemma/FunctionGemma.swift:283-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FunctionGemma/FunctionGemma.swift:242` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (11 lines × 2) Sources/ParakeetASR/MelPreprocessor.swift:170 — Sources/ParakeetASR/MelPreprocessor.swift:170-180 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:169-179 — before extracting anything, compare `Sources/ParakeetASR/MelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 162 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetASR/MelPreprocessor.swift:170` 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) Sources/PersonaPlex/PersonaPlex.swift:460 — Sources/PersonaPlex/PersonaPlex.swift:460-474 | Sources/PersonaPlex/PersonaPlex.swift:849-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 `Sources/PersonaPlex/PersonaPlex.swift:460` 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) Sources/Qwen3ASR/CoreMLEncoder.swift:76 — Sources/Qwen3ASR/CoreMLEncoder.swift:76-86 | Sources/Qwen3ASR/CoreMLTextDecoder.swift:157-168 — 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 `Sources/Qwen3ASR/CoreMLEncoder.swift:76` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `computeUnits` to `MLComputeUnits = CoreMLComputeUnitsResolver.resolved(default: .all)` in one and `MLComputeUnits = CoreMLComputeUnitsResolver.resolved(default: .cpuAndNeuralEngine)` 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) Sources/SpeechVAD/ReDimNet2Speaker.swift:149 — Sources/SpeechVAD/ReDimNet2Speaker.swift:149-161 | Sources/SpeechVAD/SmartTurn.swift:66-76 — before extracting anything, compare `Sources/SpeechVAD/ReDimNet2Speaker.swift` and `Sources/SpeechVAD/SmartTurn.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 `Sources/SpeechVAD/ReDimNet2Speaker.swift:149` 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, `Sources/SpeechVAD/ReDimNet2Speaker.swift:163` calls `validateDefaultArtifact` and `Sources/SpeechVAD/SmartTurn.swift:77` 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) Sources/SpeechVAD/SortformerStateUpdater.swift:494 — Sources/SpeechVAD/SortformerStateUpdater.swift:494-504 | Sources/SpeechVAD/SortformerStateUpdater.swift:511-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.
  • Duplicated block (11 lines × 2) Sources/VibeVoiceTTS/Models/Qwen2Model.swift:38 — Sources/VibeVoiceTTS/Models/Qwen2Model.swift:38-48 | Sources/VibeVoiceTTS/Models/Qwen2Model.swift:60-70 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (11 lines × 2) Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:638 — Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:638-648 | Sources/NemotronStreamingASR/StreamingSession.swift:387-397 — 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.
X3 · Exception handling · Swallowed exception (caught, then discarded) · ×9
  • Swallowed exception (caught, then discarded) scripts/monitor_apple_gpu.py:168 — `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) Sources/VoiceChat/VoiceChatSession.swift:1605 — `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) Sources/VoiceChat/VoiceChatSession.swift:1623 — `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) Sources/VoiceChat/VoiceChatSession.swift:1673 — `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) Sources/SpeechVAD/StreamingVADProcessor.swift:278 — `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) Sources/MagpieTTS/ChineseG2P.swift:67 — `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) Sources/MagpieTTS/EnglishG2P.swift:73 — `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) Sources/KokoroTTS/Phonemizer.swift:613 — `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) Sources/AudioServer/AudioServer.swift:993 — `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.
D4 · Code Duplication · Duplicated block (5 lines × 3) · ×8
  • Duplicated block (5 lines × 3) Sources/ChatterboxTTS/ChatterboxS3Gen.swift:100 — Sources/ChatterboxTTS/ChatterboxS3Gen.swift:100-104 | Sources/FlashSR/Mel.swift:100-104 | Sources/MLXCommon/SlaneyMel.swift:108-112 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxS3Gen.swift:100` 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 (5 lines × 3) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:144 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:144-148 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:273-277 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:400-405 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 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 `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:144` 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 (5 lines × 3) Sources/Qwen3ASR/CoreMLEncoder.swift:171 — Sources/Qwen3ASR/CoreMLEncoder.swift:171-175 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:478-482 | Sources/SpeechEnhancement/DeepFilterNet3Model.swift:33-39 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) Sources/Qwen3TTSCoreML/EmbedderModels.swift:14 — Sources/Qwen3TTSCoreML/EmbedderModels.swift:14-18 | Sources/Qwen3TTSCoreML/EmbedderModels.swift:30-34 | Sources/Qwen3TTSCoreML/EmbedderModels.swift:49-53 — 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 `Sources/Qwen3TTSCoreML/EmbedderModels.swift:14` 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 (5 lines × 3) Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:10 — Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:10-14 | Sources/Qwen3ASR/AudioPreprocessing.swift:13-17 | Sources/SpeechLanguageID/SpeechBrainFbank.swift:10-14 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (5 lines × 3) Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:231 — Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:231-235 | Sources/Qwen3TTSCoreML/MultiCodeDecoderCoreML.swift:147-151 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:185-189 — 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 (5 lines × 3) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:234 — Sources/VibeVoiceTTS/Inference/WeightLoader.swift:234-238 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:280-284 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:294-298 — 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 `Sources/VibeVoiceTTS/Inference/WeightLoader.swift:234` 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) Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246 — Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246-250 | Examples/SpeechDemo/SpeechDemo/DictateViewModel.swift:59-65 | Examples/SpeechDemo/SpeechDemo/DictateViewModel.swift:75-81 — 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 `Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246` 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 after the matched lines, `Examples/SpeechDemo/SpeechDemo/DictateViewModel.swift:67` calls `warmUp` and `Examples/SpeechDemo/SpeechDemo/DictateViewModel.swift:82` 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 lines × 2) · ×7
  • Duplicated block (15 lines × 2) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:520 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:520-534 | Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:598-612 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.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.
  • Duplicated block (15 lines × 2) Sources/CosyVoiceTTS/LLM.swift:165 — Sources/CosyVoiceTTS/LLM.swift:165-179 | Sources/Qwen3TTS/Talker.swift:61-75 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3TTS/Talker.swift` as WHOLE FILES: this scan already matched 7 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:165` 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, `Sources/Qwen3TTS/Talker.swift:77` calls `qNorm`, `kNorm` and `Sources/CosyVoiceTTS/LLM.swift:182` 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) Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:109 — Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:109-123 | Sources/IndicMioTTS/MioCodecGlobalEncoder.swift:84-98 — 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 (15 lines × 2) Sources/MagpieTTS/Downloader.swift:26 — Sources/MagpieTTS/Downloader.swift:26-40 | Sources/MossTranscribe/MossCoreMLRuntime.swift:314-328 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/Downloader.swift:26` 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) Sources/MagpieTTSCoreML/LocalTransformer.swift:28 — Sources/MagpieTTSCoreML/LocalTransformer.swift:28-42 | Sources/MagpieTTSCoreML/LocalTransformer.swift:170-184 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTSCoreML/LocalTransformer.swift:28` 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 (15 lines × 2) Sources/SpeechVAD/Community1DiarizationPipeline.swift:46 — Sources/SpeechVAD/Community1DiarizationPipeline.swift:46-60 | Sources/SpeechVAD/Nemotron3CoreMLModel.swift:130-144 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once.
  • Duplicated block (15 lines × 2) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:166 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:166-180 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:447-461 — 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 (14 lines × 2) · ×7
  • Duplicated block (14 lines × 2) Sources/AudioCLILib/SpeakCommand.swift:477 — Sources/AudioCLILib/SpeakCommand.swift:477-490 | Sources/AudioCLILib/SpeakCommand.swift:536-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 `Sources/AudioCLILib/SpeakCommand.swift:477` 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, `Sources/AudioCLILib/SpeakCommand.swift:535` calls `parseHiggsSynthesisOptions` and `Sources/AudioCLILib/SpeakCommand.swift:476` 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 × 2) Sources/AudioCLILib/TranscribeCommand.swift:217 — Sources/AudioCLILib/TranscribeCommand.swift:217-230 | Sources/AudioCLILib/TranscribeCommand.swift:243-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/TranscribeCommand.swift:217` 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) Sources/CosyVoiceTTS/WeightLoading.swift:74 — Sources/CosyVoiceTTS/WeightLoading.swift:74-87 | Sources/CosyVoiceTTS/WeightLoading.swift:184-197 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/WeightLoading.swift:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (14 lines × 2) Sources/IndexTTS2TTS/IndexTTS2TTSModel.swift:264 — Sources/IndexTTS2TTS/IndexTTS2TTSModel.swift:264-277 | Sources/IndexTTS2TTS/IndexTTS2TTSModel.swift:283-296 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2TTSModel.swift:264` 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) Sources/MagpieTTSCoreML/Decoder.swift:287 — Sources/MagpieTTSCoreML/Decoder.swift:287-300 | Sources/MagpieTTSCoreML/StatefulDecoder.swift:88-101 — 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 `Sources/MagpieTTSCoreML/Decoder.swift:287` 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) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:138 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:138-151 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:78-91 — `Sources/NemotronStreamingASR/NemotronStreamingASR.swift` and `Sources/ParakeetStreamingASR/ParakeetStreamingASR.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 8 separate duplicated blocks between them, totalling at least 118 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 `Sources/NemotronStreamingASR/NemotronStreamingASR.swift:138` 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 (14 lines × 2) Sources/Qwen3ASR/StreamingASR.swift:187 — Sources/Qwen3ASR/StreamingASR.swift:187-200 | Sources/Qwen3ASR/StreamingASR.swift:217-230 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/StreamingASR.swift:187` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (13–14 lines × 2) · ×7
  • Duplicated block (13–14 lines × 2) Sources/HibikiTranslate/Configuration.swift:231 — Sources/HibikiTranslate/Configuration.swift:231-243 | Sources/PersonaPlex/Configuration.swift:146-159 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/Configuration.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 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 × 2) Sources/HibikiTranslate/HibikiTranslateModel.swift:79 — Sources/HibikiTranslate/HibikiTranslateModel.swift:79-91 | Sources/PersonaPlex/PersonaPlex.swift:1583-1596 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiTranslateModel.swift:79` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register.
  • Duplicated block (13–14 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:667 — Sources/PersonaPlex/PersonaPlex.swift:667-680 | Sources/PersonaPlex/PersonaPlex.swift:1063-1075 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:667` 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) Sources/PersonaPlex/PersonaPlex.swift:929 — Sources/PersonaPlex/PersonaPlex.swift:929-942 | Sources/PersonaPlex/PersonaPlex.swift:959-971 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:929` 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) Sources/Qwen3ASR/CoreMLTextDecoder.swift:146 — Sources/Qwen3ASR/CoreMLTextDecoder.swift:146-159 | Sources/SpeechVAD/Nemotron3CoreMLModel.swift:127-139 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/CoreMLTextDecoder.swift:146` 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 × 2) Sources/Qwen3TTS/Qwen3TTS.swift:610 — Sources/Qwen3TTS/Qwen3TTS.swift:610-622 | Sources/Qwen3TTS/Qwen3TTS.swift:1708-1721 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/Qwen3TTS.swift:610` 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–14 lines × 2) Sources/VoiceChat/VoiceChatSession.swift:1389 — Sources/VoiceChat/VoiceChatSession.swift:1389-1401 | Sources/VoiceChat/VoiceChatSession.swift:1497-1510 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D3 · God Classes · TooManyMethods · ×6
  • TooManyMethods: VoiceChatSession Sources/VoiceChat/VoiceChatSession.swift:85 — TooManyMethods — 72 methods, declared across 2 files: VoiceChat/VoiceChatSession.swift (71), VoiceChat/VoiceChatToolCalling.swift (1). The bar is 30 methods; this is 42 over it, 2.40× the bar. That list is where to read them, not a suggestion to split the file: the members belong to the type wherever they are declared, so moving them between files leaves the count unchanged. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: IndexTTS2SemanticGPT Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:51 — TooManyMethods — 58 methods. The bar is 30 methods; this is 28 over it, 1.93× 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: GermanPhonemizer Sources/KokoroTTS/GermanPhonemizer.swift:19 — TooManyMethods — 55 methods. The bar is 30 methods; this is 25 over it, 1.83× the bar. To reduce it, group the members that share the same data into a smaller type of their own and delegate to it, so no single type carries every responsibility.
  • TooManyMethods: Qwen3TTSModel Sources/Qwen3TTS/Qwen3TTS.swift:32 — TooManyMethods — 45 methods, declared across 5 files: Qwen3TTS/Qwen3TTS.swift (37), Qwen3TTS/Qwen3TTS+ICL.swift (3), Qwen3TTS/Qwen3TTS+Protocols.swift (3), Qwen3TTS/LocalModelConfiguration.swift (1), +1 more file(s). The bar is 30 methods; this is 15 over it, 1.50× 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: VoxCPM2TTSModel Sources/VoxCPM2TTS/VoxCPM2TTS.swift:30 — 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: SpeakCommand Sources/AudioCLILib/SpeakCommand.swift:21 — TooManyMethods — 32 methods, declared across 2 files: AudioCLILib/SpeakCommand.swift (31), AudioCLILib/SpeakCommand+MossNano.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 · Duplicated block (17 lines × 2) · ×6
  • Duplicated block (17 lines × 2) Sources/AudioCLILib/VoiceChatCommand.swift:388 — Sources/AudioCLILib/VoiceChatCommand.swift:388-404 | Sources/AudioCLILib/VoiceChatCommand.swift:410-426 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/VoiceChatCommand.swift:388` 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) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:494 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:494-510 | Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:577-593 — both copies are in the same file, so extract the 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) Sources/MossTranscribe/MossCoreMLRuntime.swift:579 — Sources/MossTranscribe/MossCoreMLRuntime.swift:579-595 | Sources/MossTranscribe/MossMLXRuntime.swift:333-349 — 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 (17 lines × 2) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:38 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:38-54 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:40-56 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 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 `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:38` 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 `config` to `NemotronStreamingConfig` in one and `ParakeetEOUConfig` 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 (17 lines × 2) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:449 — Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:449-465 | Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:560-576 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:449` 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, `Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:579` calls `eval` and `Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:466` 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 (17 lines × 2) Sources/SpeechVAD/SileroVAD+Memory.swift:4 — Sources/SpeechVAD/SileroVAD+Memory.swift:4-20 | Sources/SpeechVAD/WeSpeaker+Memory.swift:4-20 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD+Memory.swift` and `Sources/SpeechVAD/WeSpeaker+Memory.swift` as WHOLE FILES: 86% of the shorter file's lines also appear in the other, so this reads as one file having been copied from the other rather than as a helper waiting to be extracted. The 1 duplicated block(s) this scan matched between them are fragments of that copy, not the extent of it — treat the file pair as the unit. 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 (10–12 lines × 2) · ×6
  • Duplicated block (10–12 lines × 2) Sources/F5TTS/F5TTSPrimitives.swift:168 — Sources/F5TTS/F5TTSPrimitives.swift:168-177 | Sources/IndexTTS2TTS/IndexTTS2ReferenceConditioning.swift:263-274 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/F5TTS/F5TTSPrimitives.swift:168` 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–12 lines × 2) Sources/IndicMioTTS/IndicMioQwen3.swift:212 — Sources/IndicMioTTS/IndicMioQwen3.swift:212-221 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:107-118 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (10–12 lines × 2) Sources/KokoroTTS/HindiPhonemizer.swift:94 — Sources/KokoroTTS/HindiPhonemizer.swift:94-103 | Sources/KokoroTTS/JapanesePhonemizer.swift:134-145 — 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 `Sources/KokoroTTS/HindiPhonemizer.swift:94` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:129 — Sources/NemotronStreamingASR/StreamingSession.swift:129-138 | Sources/ParakeetStreamingASR/StreamingSession.swift:100-111 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
  • Duplicated block (10–12 lines × 2) Sources/Qwen3Chat/Gemma4WeightLoading.swift:29 — Sources/Qwen3Chat/Gemma4WeightLoading.swift:29-40 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:20-29 — before extracting anything, compare `Sources/Qwen3Chat/Gemma4WeightLoading.swift` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift` as WHOLE FILES: this scan already matched 5 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 `Sources/Qwen3Chat/Gemma4WeightLoading.swift:29` 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, `Sources/Qwen3Chat/Gemma4WeightLoading.swift:42` calls `hasPrefix`, `String`, `dropFirst` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:31` 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–12 lines × 2) Sources/Qwen3Chat/MLXGenerator.swift:384 — Sources/Qwen3Chat/MLXGenerator.swift:384-395 | Sources/Qwen3Chat/Qwen35CoreMLChat.swift:278-287 — 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 `Sources/Qwen3Chat/MLXGenerator.swift:384` 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 (6 lines × 3) · ×6
  • Duplicated block (6 lines × 3) Sources/ChatterboxTTS/S3GenVocoder.swift:430 — Sources/ChatterboxTTS/S3GenVocoder.swift:430-435 | Sources/CosyVoiceTTS/HiFiGAN.swift:551-556 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:625-630 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:430` 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) Sources/VoxtralASR/VoxtralASR.swift:169 — Sources/CohereTranscribeASR/CohereTranscribe.swift:253-262 | Sources/VoxtralASR/VoxtralASR.swift:169-178 | Sources/VoxtralTTS/VoxtralTTSModel.swift:89-94 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CohereTranscribeASR/CohereTranscribe.swift:253` 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 before the matched lines, `Sources/CohereTranscribeASR/CohereTranscribe.swift:250` calls `normalizeCohereWeightKeys` and `Sources/VoxtralASR/VoxtralASR.swift:166` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (6 lines × 3) Sources/CosyVoiceTTS/LLM.swift:68 — Sources/CosyVoiceTTS/LLM.swift:68-78 | Sources/Qwen3TTS/Sampling.swift:45-50 | Sources/Qwen3TTS/Sampling.swift:190-195 — 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 `Sources/CosyVoiceTTS/LLM.swift:68` 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 × 3) Sources/HibikiTranslate/HibikiDepformer.swift:177 — Sources/HibikiTranslate/HibikiDepformer.swift:177-182 | Sources/PersonaPlex/Depformer.swift:152-157 | Sources/PersonaPlex/MimiTransformer.swift:108-113 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (6 lines × 3) Sources/MADLADTranslation/MADLADWeightLoading.swift:36 — Sources/MADLADTranslation/MADLADWeightLoading.swift:36-41 | Sources/Qwen3Chat/Gemma4WeightLoading.swift:29-34 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:20-25 — before extracting anything, compare `Sources/Qwen3Chat/Gemma4WeightLoading.swift` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift` as WHOLE FILES: this scan already matched 5 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 `Sources/MADLADTranslation/MADLADWeightLoading.swift:36` 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) Sources/PersonaPlex/Seanet.swift:190 — Sources/PersonaPlex/Seanet.swift:190-195 | Sources/PersonaPlex/Seanet.swift:286-291 | Sources/Qwen3TTS/SpeechTokenizerEncoder.swift:162-167 — 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.
D4 · Code Duplication · Duplicated block (5 lines × 4) · ×6
  • Duplicated block (5 lines × 4) Sources/CanaryASR/MelPreprocessor.swift:32 — Sources/CanaryASR/MelPreprocessor.swift:32-36 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:29-35 | Sources/ParakeetASR/MelPreprocessor.swift:27-33 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:32-37 — before extracting anything, compare `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetASR/MelPreprocessor.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/MelPreprocessor.swift:32` 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 `config` to `CanaryConfig` in one and `NemotronStreamingConfig` 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 before the matched lines, `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:26` calls `private` and `Sources/CanaryASR/MelPreprocessor.swift:29` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 4) Sources/PersonaPlex/PersonaPlex.swift:197 — Sources/PersonaPlex/PersonaPlex.swift:197-203 | Sources/PersonaPlex/PersonaPlex.swift:675-680 | Sources/PersonaPlex/PersonaPlex.swift:1071-1075 | Sources/PersonaPlex/PersonaPlex.swift:1376-1380 — 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 `Sources/PersonaPlex/PersonaPlex.swift:197` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (5 lines × 4) Sources/Qwen3ASR/FloatTextDecoder.swift:64 — Sources/Qwen3ASR/FloatTextDecoder.swift:64-68 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:48-54 | Sources/Qwen3TTS/CodePredictor.swift:46-51 | Sources/Qwen3TTS/Talker.swift:51-56 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.swift:64` 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 `config` to `TextDecoderConfig` in one and `CodePredictorConfig` 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 (5 lines × 4) Sources/Qwen3ASR/FloatTextDecoder.swift:70 — Sources/Qwen3ASR/FloatTextDecoder.swift:70-74 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:56-60 | Sources/Qwen3TTS/CodePredictor.swift:53-57 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:262-266 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.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 (5 lines × 4) Sources/MLXCommon/QuantizedMLP.swift:26 — Sources/MLXCommon/QuantizedMLP.swift:26-31 | Sources/MLXCommon/QuantizedMLP.swift:51-55 | Sources/Qwen3ASR/FloatTextDecoder.swift:128-132 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:132-137 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 × 4) Sources/AudioCommon/Protocols.swift:117 — Sources/AudioCommon/Protocols.swift:117-121 | Sources/AudioCommon/Protocols.swift:195-199 | Sources/BenchmarkSupport/BenchmarkSupport.swift:11-15 | Sources/NemotronStreamingASR/Vocabulary.swift:16-20 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `endTime` to `Float` 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.
D4 · Code Duplication · Duplicated block (20 lines × 2) · ×5
  • Duplicated block (20 lines × 2) Sources/AudioCommon/AudioIO.swift:258 — Sources/AudioCommon/AudioIO.swift:258-277 | Sources/AudioCommon/FullDuplexAudioIO.swift:377-396 — 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 (20 lines × 2) Sources/CosyVoiceTTS/LLM.swift:230 — Sources/CosyVoiceTTS/LLM.swift:230-249 | Sources/Qwen3TTS/Talker.swift:126-145 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3TTS/Talker.swift` as WHOLE FILES: this scan already matched 7 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. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (20 lines × 2) Sources/DiarizationBenchmark/DiarizationBench.swift:470 — Sources/DiarizationBenchmark/DiarizationBench.swift:470-489 | Sources/DiarizationBenchmark/DiarizationBench.swift:521-540 — both copies are in the same file, so extract the 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) Sources/NemotronStreamingASR/NemotronMLXNetwork.swift:161 — Sources/NemotronStreamingASR/NemotronMLXNetwork.swift:161-180 | Sources/VoiceChat/VoiceChatEncoder.swift:173-192 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/NemotronMLXNetwork.swift:161` 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 (20 lines × 2) Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:152 — Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:152-171 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:140-159 — 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 (18 lines × 2) · ×5
  • Duplicated block (18 lines × 2) Sources/AudioCLILib/SpeakCommand.swift:1466 — Sources/AudioCLILib/SpeakCommand.swift:1466-1483 | Sources/AudioCLILib/SpeakCommand.swift:1713-1730 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/SpeakCommand.swift:1466` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:168 — Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:168-185 | Sources/SpeechLanguageID/SpeechBrainFbank.swift:136-153 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:168` 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) Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:169 — Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:169-186 | Sources/SourceSeparation/SourceSeparation.swift:205-222 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:169` 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 `modelId` to `String? = nil` in one and `String = defaultModelId` 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 (18 lines × 2) Sources/SpeechEnhancement/SpeechEnhancement.swift:71 — Sources/SpeechEnhancement/SpeechEnhancement.swift:71-88 | Sources/SpeechEnhancement/SpeechEnhancement.swift:100-117 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechEnhancement/SpeechEnhancement.swift:71` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (18 lines × 2) Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:334 — Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:334-351 | Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:364-381 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (16 lines × 2) · ×5
  • Duplicated block (16 lines × 2) Examples/PersonaPlexDemo/PersonaPlexDemo/SentencePieceDecoder.swift:109 — Examples/PersonaPlexDemo/PersonaPlexDemo/SentencePieceDecoder.swift:109-124 | Sources/AudioCommon/SentencePieceModel.swift:152-167 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
  • Duplicated block (16 lines × 2) Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:17 — Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:17-32 | Sources/AsrBenchmark/EngineCohereVoxtralMLX.swift:71-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. 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 `variant` to `CohereTranscribeVariant` in one and `VoxtralVariant` 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) Sources/CosyVoiceTTS/FlowMelExtractor.swift:103 — Sources/CosyVoiceTTS/FlowMelExtractor.swift:103-118 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:93-108 — before extracting anything, compare `Sources/CosyVoiceTTS/FlowMelExtractor.swift` and `Sources/CosyVoiceTTS/WhisperMelExtractor.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 139 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (16 lines × 2) Sources/MLXCommon/WeightLoading.swift:284 — Sources/MLXCommon/WeightLoading.swift:284-299 | Sources/MLXCommon/WeightLoading.swift:306-321 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/WeightLoading.swift:284` 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) Sources/Qwen3TTS/LocalModelConfiguration.swift:178 — Sources/Qwen3TTS/LocalModelConfiguration.swift:178-193 | Sources/Qwen3TTS/LocalModelConfiguration.swift:247-262 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/LocalModelConfiguration.swift:178` 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–13 lines × 2) · ×5
  • Duplicated block (12–13 lines × 2) Sources/AudioCommon/AudioFileLoader.swift:33 — Sources/AudioCommon/AudioFileLoader.swift:33-44 | Sources/AudioCommon/AudioFileLoader.swift:91-103 — both copies are in the same file, so extract the 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–13 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:131 — Sources/HibikiTranslate/HibikiDepformer.swift:131-142 | Sources/PersonaPlex/Depformer.swift:106-118 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:131` 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) Sources/NemotronStreamingASR/StreamingSession.swift:245 — Sources/NemotronStreamingASR/StreamingSession.swift:245-256 | Sources/ParakeetStreamingASR/StreamingSession.swift:263-275 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 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. 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–13 lines × 2) Sources/Qwen3TTS/Sampling.swift:49 — Sources/Qwen3TTS/Sampling.swift:49-60 | Sources/Qwen3TTS/Sampling.swift:194-206 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/Sampling.swift:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (12–13 lines × 2) Sources/SpeechVAD/SortformerDiarizer.swift:296 — Sources/SpeechVAD/SortformerDiarizer.swift:296-308 | Sources/SpeechVAD/SortformerStreamingSession.swift:252-263 — 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 (9–10 lines × 2) · ×5
  • Duplicated block (9–10 lines × 2) Sources/AudioCLILib/VoiceChatMCP.swift:765 — Sources/AudioCLILib/VoiceChatMCP.swift:765-774 | Sources/AudioCLILib/VoiceChatMCP.swift:796-804 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/VoiceChatMCP.swift:765` 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–10 lines × 2) Sources/DiarizationBenchmark/DiarizationBench.swift:190 — Sources/DiarizationBenchmark/DiarizationBench.swift:190-198 | Sources/VadBenchmark/VadBench.swift:192-201 — 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.
  • Duplicated block (9–10 lines × 2) Sources/F5TTS/F5TTSFlow.swift:256 — Sources/F5TTS/F5TTSFlow.swift:256-264 | Sources/F5TTS/F5TTSFlow.swift:482-491 — both copies are in the same file, so extract the 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) Sources/MagpieTTS/MagpieTTS.swift:188 — Sources/MagpieTTS/MagpieTTS.swift:188-197 | Sources/MagpieTTS/MagpieTTS.swift:250-258 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/MagpieTTS.swift:188` 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–10 lines × 2) Sources/SpeechWakeWord/StreamingSession.swift:344 — Sources/SpeechWakeWord/StreamingSession.swift:344-353 | Sources/SpeechWakeWord/StreamingSession.swift:365-373 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechWakeWord/StreamingSession.swift:344` 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 (8–9 lines × 2) · ×5
  • Duplicated block (8–9 lines × 2) Sources/Qwen3ASR/CoreMLForcedAligner.swift:479 — Sources/Qwen3ASR/CoreMLForcedAligner.swift:479-486 | Sources/SpeechEnhancement/DeepFilterNet3Model.swift:34-42 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/CoreMLForcedAligner.swift:479` 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 (8–9 lines × 2) Sources/Qwen3Chat/Gemma4WeightLoading.swift:43 — Sources/Qwen3Chat/Gemma4WeightLoading.swift:43-50 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:29-37 — before extracting anything, compare `Sources/Qwen3Chat/Gemma4WeightLoading.swift` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift` as WHOLE FILES: this scan already matched 5 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 `Sources/Qwen3Chat/Gemma4WeightLoading.swift:43` 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, `Sources/Qwen3Chat/Gemma4WeightLoading.swift:41` calls `String`, `dropFirst`, `hasPrefix` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:29` 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–9 lines × 2) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:295 — Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:295-302 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:369-377 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:295` 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–9 lines × 2) Sources/Qwen3TTSCoreML/TalkerGenerator.swift:126 — Sources/Qwen3TTSCoreML/TalkerGenerator.swift:126-134 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:113-120 — 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 `Sources/Qwen3TTSCoreML/TalkerGenerator.swift:126` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (8–9 lines × 2) Sources/SpeechVAD/Community1DiarizationPipeline.swift:136 — Sources/SpeechVAD/Community1DiarizationPipeline.swift:136-144 | Sources/SpeechVAD/Community1DiarizationPipeline.swift:152-159 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechVAD/Community1DiarizationPipeline.swift:136` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7 lines × 3) · ×5
  • Duplicated block (7 lines × 3) Sources/ChatterboxTTS/S3GenVocoder.swift:469 — Sources/ChatterboxTTS/S3GenVocoder.swift:469-475 | Sources/CosyVoiceTTS/HiFiGAN.swift:608-616 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:659-667 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:177 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:177-183 | Sources/SpeechVAD/MelFeatureExtractor.swift:183-189 | Sources/SpeechVAD/SortformerMelExtractor.swift:192-198 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/SpeechVAD/MelFeatureExtractor.swift` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:177` 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 × 3) Sources/MagpieTTS/Downloader.swift:26 — Sources/MagpieTTS/Downloader.swift:26-40 | Sources/MossTranscribe/MossCoreMLRuntime.swift:314-328 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:58-64 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/Downloader.swift:26` 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 × 3) Sources/ParakeetASR/ParakeetASR.swift:312 — Sources/ParakeetASR/ParakeetASR.swift:312-318 | Sources/Qwen3ASR/CoreMLEncoder.swift:168-174 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:475-481 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (7 lines × 3) Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:28 — Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:28-35 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:63-69 | Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift:39-47 — before extracting anything, compare `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift` and `Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:28` 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, `Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:62` calls `AVAudioConverter` and `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:28` 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.
D5 · Coupling · Off the main sequence · ×5
  • Off the main sequence: SpeechRuntime — SpeechRuntime: abstractness 0.00, instability 0.00, distance 1.00 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
  • Off the main sequence: KokoroTTS — KokoroTTS: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: ParakeetASR — ParakeetASR: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: WhisperASR — WhisperASR: abstractness 0.00, instability 0.25, distance 0.75 — zone of pain — concrete and depended on by 3 project(s), so it's rigid to change.
  • Off the main sequence: SpeechVAD — SpeechVAD: abstractness 0.01, instability 0.25, distance 0.74 — zone of pain — concrete and depended on by 6 project(s), so it's rigid to change.
D4 · Code Duplication · Duplicated block (19–20 lines × 2) · ×4
  • Duplicated block (19–20 lines × 2) Sources/KokoroTTS/HindiPhonemizer.swift:53 — Sources/KokoroTTS/HindiPhonemizer.swift:53-71 | Sources/KokoroTTS/JapanesePhonemizer.swift:86-105 — 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 (19–20 lines × 2) Sources/MossTranscribe/MossMLXAudioModel.swift:43 — Sources/MossTranscribe/MossMLXAudioModel.swift:43-62 | Sources/VoxtralASR/VoxtralAudioEncoder.swift:27-45 — before extracting anything, compare `Sources/MossTranscribe/MossMLXAudioModel.swift` and `Sources/VoxtralASR/VoxtralAudioEncoder.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 45 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19–20 lines × 2) Sources/Qwen3TTS/Qwen3TTS.swift:529 — Sources/Qwen3TTS/Qwen3TTS.swift:529-547 | Sources/Qwen3TTS/Qwen3TTS.swift:1660-1679 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTS/Qwen3TTS.swift:529` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
  • Duplicated block (19–20 lines × 2) Sources/SpeechVAD/ReDimNet2Speaker.swift:314 — Sources/SpeechVAD/ReDimNet2Speaker.swift:314-333 | Sources/SpeechVAD/SmartTurn.swift:192-210 — before extracting anything, compare `Sources/SpeechVAD/ReDimNet2Speaker.swift` and `Sources/SpeechVAD/SmartTurn.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 58 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 `Sources/SpeechVAD/ReDimNet2Speaker.swift:314` 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 (14–15 lines × 2) · ×4
  • Duplicated block (14–15 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:349 — Sources/ChatterboxTTS/S3GenVocoder.swift:349-362 | Sources/CosyVoiceTTS/HiFiGAN.swift:435-449 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:349` 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–15 lines × 2) Sources/CosyVoiceTTS/DialogueParser.swift:84 — Sources/CosyVoiceTTS/DialogueParser.swift:84-98 | Sources/CosyVoiceTTS/DialogueParser.swift:133-146 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/DialogueParser.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 (14–15 lines × 2) Sources/FlashSR/UNet.swift:399 — Sources/FlashSR/UNet.swift:399-412 | Sources/FlashSR/UNet.swift:447-461 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FlashSR/UNet.swift:399` 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–15 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:805 — Sources/PersonaPlex/PersonaPlex.swift:805-818 | Sources/PersonaPlex/PersonaPlex.swift:1212-1226 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:805` 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–15 lines × 2) · ×4
  • Duplicated block (13–15 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:414 — Sources/ChatterboxTTS/S3GenVocoder.swift:414-426 | Sources/CosyVoiceTTS/HiFiGAN.swift:533-547 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:414` 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–15 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:244 — Sources/HibikiTranslate/HibikiDepformer.swift:244-256 | Sources/PersonaPlex/Depformer.swift:215-229 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:244` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `cfg` to `HibikiDepformerConfig` in one and `DepformerConfig` 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–15 lines × 2) Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:90 — Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:90-102 | Sources/ParakeetStreamingASR/RNNTGreedyDecoder.swift:103-117 — `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift` and `Sources/ParakeetStreamingASR/RNNTGreedyDecoder.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 5 separate duplicated blocks between them, totalling at least 62 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 `Sources/NemotronStreamingASR/RNNTGreedyDecoder.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.
  • Duplicated block (13–15 lines × 2) Sources/Qwen3Chat/MLXGenerator.swift:240 — Sources/Qwen3Chat/MLXGenerator.swift:240-254 | Sources/Qwen3Chat/Qwen35CoreMLChat.swift:195-207 — 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 `Sources/Qwen3Chat/MLXGenerator.swift:240` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–13 lines × 2) · ×4
  • Duplicated block (11–13 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:108 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:108-118 | Sources/PersonaPlex/TemporalTransformer.swift:104-116 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiTemporalTransformer.swift:108` 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 (11–13 lines × 2) Sources/MagpieTTS/MagpieTTS.swift:215 — Sources/MagpieTTS/MagpieTTS.swift:215-227 | Sources/MagpieTTS/MagpieTTS.swift:305-315 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/MagpieTTS.swift:215` 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–13 lines × 2) Sources/Qwen3ASR/FloatTextDecoder.swift:215 — Sources/Qwen3ASR/FloatTextDecoder.swift:215-225 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:239-251 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.swift:215` 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 (11–13 lines × 2) Sources/SpeechVAD/DiarizationHelpers.swift:114 — Sources/SpeechVAD/DiarizationHelpers.swift:114-126 | Sources/SpeechVAD/DiarizationHelpers.swift:224-234 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechVAD/DiarizationHelpers.swift:114` 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 (10–11 lines × 2) · ×4
  • Duplicated block (10–11 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:197 — Sources/ChatterboxTTS/S3GenVocoder.swift:197-207 | Sources/CosyVoiceTTS/HiFiGAN.swift:212-221 — 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. 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–11 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:293 — Sources/PersonaPlex/PersonaPlex.swift:293-303 | Sources/PersonaPlex/PersonaPlex.swift:744-753 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:293` 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, `Sources/PersonaPlex/PersonaPlex.swift:312` calls `Array`, `CFAbsoluteTimeGetCurrent` and `Sources/PersonaPlex/PersonaPlex.swift:756` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (10–11 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:632 — Sources/PersonaPlex/PersonaPlex.swift:632-642 | Sources/PersonaPlex/PersonaPlex.swift:1340-1349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:632` 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) Sources/Qwen3ASR/CoreMLTextDecoder.swift:197 — Sources/Qwen3ASR/CoreMLTextDecoder.swift:197-206 | Sources/Qwen3ASR/CoreMLTextDecoder.swift:437-447 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (10 lines × 3) · ×4
  • Duplicated block (10 lines × 3) Sources/AudioCLILib/SpeakCommand.swift:1464 — Sources/AudioCLILib/SpeakCommand.swift:1464-1473 | Sources/AudioCLILib/SpeakCommand.swift:1711-1720 | Sources/AudioCLILib/SpeakCommand.swift:1821-1830 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) Sources/FlashSR/UNet.swift:61 — Sources/FlashSR/UNet.swift:61-70 | Sources/FlashSR/VAE.swift:137-146 | Sources/FlashSR/VAE.swift:164-173 — 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 `Sources/FlashSR/UNet.swift:61` 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 × 3) Sources/FlashSR/UNet.swift:402 — Sources/FlashSR/UNet.swift:402-411 | Sources/FlashSR/UNet.swift:427-436 | Sources/FlashSR/UNet.swift:451-460 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (10 lines × 3) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:64 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:64-73 | Sources/PersonaPlex/MimiTransformer.swift:66-75 | Sources/PersonaPlex/TemporalTransformer.swift:66-75 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9 lines × 3) · ×4
  • Duplicated block (9 lines × 3) Sources/AudioCLILib/DiarizeCommand.swift:137 — Sources/AudioCLILib/DiarizeCommand.swift:137-145 | Sources/AudioCLILib/DiarizeCommand.swift:202-210 | Sources/AudioCLILib/DiarizeCommand.swift:280-288 — 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 `Sources/AudioCLILib/DiarizeCommand.swift:137` 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 × 3) Sources/KokoroTTS/KokoroModel.swift:59 — Sources/KokoroTTS/KokoroModel.swift:59-67 | Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:156-164 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:144-152 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (9 lines × 3) Sources/Qwen3ASR/FloatTextDecoder.swift:198 — Sources/Qwen3ASR/FloatTextDecoder.swift:198-207 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:218-230 | Sources/Qwen3TTS/Talker.swift:246-254 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.swift:198` 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) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1208 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1208-1216 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1273-1281 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1316-1324 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
D4 · Code Duplication · Duplicated block (8 lines × 3) · ×4
  • Duplicated block (8 lines × 3) Sources/AudioCLILib/SpeakCommand.swift:1245 — Sources/AudioCLILib/SpeakCommand.swift:1245-1252 | Sources/AudioCLILib/SpeakCommand.swift:1517-1524 | Sources/AudioCLILib/SpeakCommand.swift:1572-1579 — 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 `Sources/AudioCLILib/SpeakCommand.swift:1245` 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 × 3) Sources/FishAudioTTS/FishAudioTokenizer.swift:42 — Sources/FishAudioTTS/FishAudioTokenizer.swift:42-49 | Sources/HiggsTTS/HiggsTTSTokenizer.swift:63-70 | Sources/IndicMioTTS/IndicMioTokenizer.swift:25-32 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times.
  • Duplicated block (8 lines × 3) Sources/MagpieTTSCoreML/Decoder.swift:236 — Sources/MagpieTTSCoreML/Decoder.swift:236-243 | Sources/MagpieTTSCoreML/NanoCodec.swift:91-98 | Sources/MagpieTTSCoreML/TextEncoder.swift:53-60 — 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 `Sources/MagpieTTSCoreML/Decoder.swift:236` 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 × 3) Sources/SourceSeparation/WienerFilter.swift:14 — Sources/SourceSeparation/WienerFilter.swift:14-21 | Sources/SourceSeparation/WienerFilterMLX.swift:27-34 | Sources/SourceSeparation/WienerFilterMLX.swift:89-96 — 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.
D4 · Code Duplication · Duplicated block (7–8 lines × 2) · ×4
  • Duplicated block (7–8 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:21 — Sources/HibikiTranslate/HibikiWeightLoading.swift:21-27 | Sources/PersonaPlex/WeightLoading.swift:20-27 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:21` 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 `model` to `HibikiTranslateModel` in one and `PersonaPlexModel` 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, `Sources/HibikiTranslate/HibikiWeightLoading.swift:27` calls `update`, `missingWeightFile` and `Sources/PersonaPlex/WeightLoading.swift:27` 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 (7–8 lines × 2) Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:66 — Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:66-72 | Sources/ParakeetStreamingASR/RNNTGreedyDecoder.swift:79-86 — `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift` and `Sources/ParakeetStreamingASR/RNNTGreedyDecoder.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 5 separate duplicated blocks between them, totalling at least 62 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 `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:66` 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) Sources/ParakeetASR/ParakeetASR.swift:93 — Sources/ParakeetASR/ParakeetASR.swift:93-100 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:123-129 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetASR/ParakeetASR.swift:93` 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) Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:135 — Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:135-142 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:343-349 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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. 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.
X3 · Exception handling · Swallowed exception (empty catch) · ×4
  • Swallowed exception (empty catch) Sources/MagpieTTSCoreML/Decoder.swift:130 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) Sources/AudioServer/AudioServer.swift:750 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) Sources/AudioCommon/StreamingAudioPlayer.swift:185 — An empty catch block silently discards the error — failures vanish with no log and no rethrow. Log it, handle it, or don't catch it.
  • Swallowed exception (empty catch) Sources/AudioCLILib/Utilities.swift:50 — 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.
D30 · Dependency Vulnerabilities · Medium CVE · ×3
  • REDACTED
  • REDACTED
  • REDACTED
D4 · Code Duplication · Edited copy of a member (16 corresponding lines) · ×3
  • Edited copy of a member (16 corresponding lines) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:76 — Sources/VibeVoiceTTS/Inference/WeightLoader.swift:76-95 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:114-131 — 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) Sources/FishAudioTTS/FishAudioCodec.swift:92 — Sources/FishAudioTTS/FishAudioCodec.swift:92-108 | Sources/FishAudioTTS/FishAudioCodec.swift:110-126 — 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) Sources/PersonaPlex/Conv.swift:16 — Sources/PersonaPlex/Conv.swift:16-31 | Sources/PersonaPlex/Conv.swift:58-74 — 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 · Members sharing a duplicated core (6 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (6 members, 50+ identical tokens) Sources/CSM/CSMModel.swift:84 — Sources/CSM/CSMModel.swift:84-105 | Sources/HibikiTranslate/HibikiDepformer.swift:117-152 | Sources/HibikiTranslate/HibikiTemporalTransformer.swift:41-86 | Sources/PersonaPlex/Depformer.swift:92-128 | Sources/PersonaPlex/MimiTransformer.swift:48-86 | Sources/PersonaPlex/TemporalTransformer.swift:48-86 — 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) Sources/CanaryASR/MelPreprocessor.swift:59 — Sources/CanaryASR/MelPreprocessor.swift:59-160 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:58-148 | Sources/ParakeetASR/MelPreprocessor.swift:56-190 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:62-185 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:192-277 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:284-405 — 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) Sources/CosyVoiceTTS/LLM.swift:418 — Sources/CosyVoiceTTS/LLM.swift:418-459 | Sources/Qwen3ASR/FloatTextDecoder.swift:183-225 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:202-251 | Sources/Qwen3TTS/CodePredictor.swift:183-221 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:368-391 | Sources/Qwen3TTS/Talker.swift:237-281 — These 6 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 6 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 6 times.
D4 · Code Duplication · Members sharing a duplicated core (5 members, 50+ identical tokens) · ×3
  • Members sharing a duplicated core (5 members, 50+ identical tokens) Sources/CosyVoiceTTS/LLM.swift:230 — Sources/CosyVoiceTTS/LLM.swift:230-249 | Sources/Qwen3ASR/FloatTextDecoder.swift:149-165 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:156-174 | Sources/Qwen3TTS/CodePredictor.swift:115-131 | Sources/Qwen3TTS/Talker.swift:126-145 — 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) Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:93 — Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:93-108 | Sources/IndicMioTTS/IndicMioWavLM.swift:429-444 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:549-564 | Sources/MLXCommon/WeightLoading.swift:247-264 | Sources/Qwen3TTS/TTSWeightLoading+Encoder.swift:86-93 — 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) Sources/NemotronStreamingASR/NemotronStreamingASR+Protocols.swift:7 — Sources/NemotronStreamingASR/NemotronStreamingASR+Protocols.swift:7-14 | Sources/OmnilingualASR/MLX/OmnilingualASRMLXModel+Protocols.swift:8-15 | Sources/OmnilingualASR/OmnilingualASR+Protocols.swift:9-16 | Sources/ParakeetASR/ParakeetASR+Protocols.swift:7-14 | Sources/ParakeetStreamingASR/ParakeetStreamingASR+Protocols.swift:8-15 — These 5 members share a duplicated core: a run of at least 50 identical tokens appears in every one of them. That run is NOT broken out as duplicated-block rows below — it is what admitted this row, and the blocks below cover only the part of it that clears the block floor, so they understate the correspondence. Read the members as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Duplicated block (19 lines × 2) · ×3
  • Duplicated block (19 lines × 2) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114-132 | Sources/SpeechVAD/MelFeatureExtractor.swift:120-138 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/SpeechVAD/MelFeatureExtractor.swift` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114` 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) Sources/DiarizationBenchmark/DiarizationBench.swift:436 — Sources/DiarizationBenchmark/DiarizationBench.swift:436-454 | Sources/DiarizationBenchmark/DiarizationBench.swift:691-709 — both copies are in the same file, so extract the 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, `Sources/DiarizationBenchmark/DiarizationBench.swift:711` calls `DiarizationResult` and `Sources/DiarizationBenchmark/DiarizationBench.swift:455` 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 (19 lines × 2) Sources/VoxtralASR/VoxtralLanguageModel.swift:47 — Sources/VoxtralASR/VoxtralLanguageModel.swift:47-65 | Sources/VoxtralTTS/LanguageModel.swift:47-65 — before extracting anything, compare `Sources/VoxtralASR/VoxtralLanguageModel.swift` and `Sources/VoxtralTTS/LanguageModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxtralASR/VoxtralLanguageModel.swift:47` 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 (16–17 lines × 2) · ×3
  • Duplicated block (16–17 lines × 2) Sources/ChatterboxTTS/ChatterboxTTSModel.swift:283 — Sources/ChatterboxTTS/ChatterboxTTSModel.swift:283-298 | Sources/OmniVoiceTTS/OmniVoiceTTSModel.swift:82-98 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxTTSModel.swift:283` 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 (16–17 lines × 2) Sources/Qwen3ASR/AudioEncoder.swift:313 — Sources/Qwen3ASR/AudioEncoder.swift:313-329 | Sources/Qwen3ASR/AudioEncoder.swift:409-424 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
  • Duplicated block (16–17 lines × 2) Sources/Qwen3ASR/Qwen3ASR.swift:799 — Sources/Qwen3ASR/Qwen3ASR.swift:799-815 | Sources/Qwen3ASR/Qwen3ASR.swift:934-949 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/Qwen3ASR.swift:799` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (14–16 lines × 2) · ×3
  • Duplicated block (14–16 lines × 2) Sources/ChatterboxTTS/ChatterboxTTSModel.swift:58 — Sources/ChatterboxTTS/ChatterboxTTSModel.swift:58-71 | Sources/ChatterboxTTS/ChatterboxTTSModel.swift:435-450 — both copies are in the same file, so extract the 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 (14–16 lines × 2) Sources/FlashSR/Mel.swift:142 — Sources/FlashSR/Mel.swift:142-157 | Sources/MLXCommon/SlaneyMel.swift:115-128 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FlashSR/Mel.swift:142` 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–16 lines × 2) Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:65 — Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:65-80 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:168-181 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:65` 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) · ×3
  • Duplicated block (12–15 lines × 2) Sources/MLXCommon/SlaneyMel.swift:30 — Sources/MLXCommon/SlaneyMel.swift:30-41 | Sources/VoiceChat/VoiceChatTurnTaking.swift:42-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. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/SlaneyMel.swift:30` 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–15 lines × 2) Sources/Qwen3Chat/MLXGenerator.swift:347 — Sources/Qwen3Chat/MLXGenerator.swift:347-361 | Sources/Qwen3Chat/Qwen35CoreMLChat.swift:250-261 — 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 `Sources/Qwen3Chat/MLXGenerator.swift:347` 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 (12–15 lines × 2) Sources/SpeechVAD/Nemotron3MLXModel.swift:329 — Sources/SpeechVAD/Nemotron3MLXModel.swift:329-340 | Sources/SpeechVAD/ReDimNet2Speaker.swift:144-158 — 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, `Sources/SpeechVAD/ReDimNet2Speaker.swift:142` calls `modelCacheDirectory` and `Sources/SpeechVAD/Nemotron3MLXModel.swift:328` 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 (14 lines × 3) · ×3
  • Duplicated block (14 lines × 3) Sources/AudioCLILib/VoiceChatCommand.swift:390 — Sources/AudioCLILib/VoiceChatCommand.swift:390-403 | Sources/AudioCLILib/VoiceChatCommand.swift:412-425 | Sources/AudioCLILib/VoiceChatCommand.swift:439-452 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited.
  • Duplicated block (14 lines × 3) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:247 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:247-260 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:175-188 | Sources/SourceSeparation/SourceSeparation.swift:211-224 — `Sources/NemotronStreamingASR/NemotronStreamingASR.swift` and `Sources/ParakeetStreamingASR/ParakeetStreamingASR.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 8 separate duplicated blocks between them, totalling at least 118 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 `Sources/NemotronStreamingASR/NemotronStreamingASR.swift:247` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note first that the copies are not typed on the same thing: the declarations holding them bind `modelId` to `String? = nil` in one and `String = defaultModelId` 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 (14 lines × 3) Sources/NemotronStreamingASR/NemotronStreamingASR+Memory.swift:4 — Sources/NemotronStreamingASR/NemotronStreamingASR+Memory.swift:4-19 | Sources/ParakeetASR/ParakeetASR+Memory.swift:4-18 | Sources/ParakeetStreamingASR/ParakeetStreamingASR+Memory.swift:4-17 — 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.
D4 · Code Duplication · Duplicated block (11–12 lines × 2) · ×3
  • Duplicated block (11–12 lines × 2) Sources/KokoroTTS/JapanesePhonemizer.swift:198 — Sources/KokoroTTS/JapanesePhonemizer.swift:198-208 | Sources/KokoroTTS/Phonemizer.swift:666-677 — 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 (11–12 lines × 2) Sources/MLXCommon/WeightLoading.swift:199 — Sources/MLXCommon/WeightLoading.swift:199-210 | Sources/Qwen3ASR/WeightLoading.swift:290-300 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MLXCommon/WeightLoading.swift:199` 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–12 lines × 2) scripts/profiling/BreezeTTSBenchmark.swift:32 — scripts/profiling/BreezeTTSBenchmark.swift:32-43 | scripts/profiling/FishDrama3Benchmark.swift:44-54 — 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 `scripts/profiling/BreezeTTSBenchmark.swift:32` 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 (9–11 lines × 2) · ×3
  • Duplicated block (9–11 lines × 2) Sources/HiggsTTS/HiggsTTSTokenizer.swift:64 — Sources/HiggsTTS/HiggsTTSTokenizer.swift:64-74 | Sources/OmniVoiceTTS/OmniVoiceTokenizer.swift:37-45 — 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.
  • Duplicated block (9–11 lines × 2) Sources/KokoroTTS/HindiPhonemizer.swift:73 — Sources/KokoroTTS/HindiPhonemizer.swift:73-81 | Sources/KokoroTTS/JapanesePhonemizer.swift:109-119 — 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 `Sources/KokoroTTS/HindiPhonemizer.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.
  • Duplicated block (9–11 lines × 2) Sources/SpeechVAD/Nemotron3CoreMLModel.swift:124 — Sources/SpeechVAD/Nemotron3CoreMLModel.swift:124-134 | Sources/SpeechVAD/Nemotron3MLXModel.swift:324-332 — 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 `Sources/SpeechVAD/Nemotron3CoreMLModel.swift:124` 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 (7–8 lines × 3) · ×3
  • Duplicated block (7–8 lines × 3) Sources/ChatterboxTTS/MatchaCFM.swift:288 — Sources/ChatterboxTTS/MatchaCFM.swift:288-295 | Sources/ChatterboxTTS/MatchaCFM.swift:313-319 | Sources/ChatterboxTTS/MatchaCFM.swift:338-345 — 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 `Sources/ChatterboxTTS/MatchaCFM.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/ChatterboxTTS/MatchaCFM.swift:296` calls `CFMCausalConv1d` and `Sources/ChatterboxTTS/MatchaCFM.swift:320` 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 (7–8 lines × 3) Sources/KyutaiSTT/KyutaiSTTModel.swift:61 — Sources/CohereTranscribeASR/CohereTranscribe.swift:276-283 | Sources/KyutaiSTT/KyutaiSTTModel.swift:61-67 | Sources/VoxtralASR/VoxtralASR.swift:192-199 — before extracting anything, compare `Sources/CohereTranscribeASR/CohereTranscribe.swift` and `Sources/VoxtralASR/VoxtralASR.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 63 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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 (7–8 lines × 3) Sources/FlashSR/Mel.swift:160 — Sources/FlashSR/Mel.swift:160-166 | Sources/MLXCommon/SlaneyMel.swift:130-136 | Sources/Qwen3TTS/SpeakerEncoder.swift:376-383 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FlashSR/Mel.swift:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 5) · ×3
  • Duplicated block (5 lines × 5) Sources/CosyVoiceTTS/LLM.swift:232 — Sources/CosyVoiceTTS/LLM.swift:232-239 | Sources/Qwen3ASR/FloatTextDecoder.swift:151-155 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:158-163 | Sources/Qwen3TTS/CodePredictor.swift:117-121 | Sources/Qwen3TTS/Talker.swift:128-135 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3ASR/FloatTextDecoder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:232` 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 (5 lines × 5) Sources/CosyVoiceTTS/LLM.swift:428 — Sources/CosyVoiceTTS/LLM.swift:428-434 | Sources/Qwen3ASR/FloatTextDecoder.swift:204-208 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:226-231 | Sources/Qwen3TTS/CodePredictor.swift:197-202 | Sources/Qwen3TTS/Talker.swift:251-255 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3ASR/FloatTextDecoder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:428` 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 × 5) Sources/HibikiTranslate/HibikiDepformer.swift:146 — Sources/HibikiTranslate/HibikiDepformer.swift:146-150 | Sources/HibikiTranslate/HibikiTemporalTransformer.swift:78-84 | Sources/PersonaPlex/Depformer.swift:122-126 | Sources/PersonaPlex/MimiTransformer.swift:80-84 | Sources/PersonaPlex/TemporalTransformer.swift:80-84 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:146` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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.
P7 · Outbound HTTP resilience · Outbound HTTP without resilience · ×3
  • Outbound HTTP without resilience Sources/AudioCommon/HuggingFaceRepoManifest.swift:105 — `URLSession.shared` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience Sources/AudioCommon/HuggingFaceRepoManifest.swift:319 — `URLSession.shared` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
  • Outbound HTTP without resilience Sources/WhisperASR/WhisperASR.swift:235 — `URLSession.shared` makes an outbound HTTP call, and nothing bounds it: no timeout, deadline, retry or circuit breaker is set for it here, and the client has no process-wide default. A slow or failing dependency will hold this service's request, thread or connection until the call gives up on its own — or never, for a client with no default timeout.
D4 · Code Duplication · Edited copy of a member (14 corresponding lines) · ×2
  • Edited copy of a member (14 corresponding lines) Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:186 — Sources/Qwen3TTSCoreML/MultiCodeDecoderChunked.swift:186-199 | Sources/Qwen3TTSCoreML/TalkerGeneratorChunked.swift:161-174 — 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) Sources/FishAudioTTS/FishAudioCodec.swift:60 — Sources/FishAudioTTS/FishAudioCodec.swift:60-74 | Sources/FishAudioTTS/FishAudioCodec.swift:76-90 — 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 (24 corresponding lines) · ×2
  • Edited copy of a member (24 corresponding lines) Sources/Qwen3TTS/LocalModelConfiguration.swift:174 — Sources/Qwen3TTS/LocalModelConfiguration.swift:174-208 | Sources/Qwen3TTS/LocalModelConfiguration.swift:244-268 — 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) Sources/VoxCPM2TTS/AudioVAE.swift:72 — Sources/VoxCPM2TTS/AudioVAE.swift:72-97 | Sources/VoxCPM2TTS/AudioVAE.swift:122-145 — 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 · Duplicated block (23 lines × 2) · ×2
  • Duplicated block (23 lines × 2) Sources/VoxtralASR/VoxtralLanguageModel.swift:67 — Sources/VoxtralASR/VoxtralLanguageModel.swift:67-89 | Sources/VoxtralTTS/LanguageModel.swift:67-89 — before extracting anything, compare `Sources/VoxtralASR/VoxtralLanguageModel.swift` and `Sources/VoxtralTTS/LanguageModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 66 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxtralASR/VoxtralLanguageModel.swift:67` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `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 (23 lines × 2) scripts/qwen3_tts_coreml/convert_coreml.py:702 — scripts/qwen3_tts_coreml/convert_coreml.py:702-724 | scripts/qwen3_tts_coreml/convert_coreml.py:737-759 — both copies are in the same file, so extract the 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 (22 lines × 2) · ×2
  • Duplicated block (22 lines × 2) Sources/AsrBenchmark/EngineMoss.swift:28 — Sources/AsrBenchmark/EngineMoss.swift:28-49 | Sources/AsrBenchmark/EngineMoss.swift:91-112 — both copies are in the same file, so extract the 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) Sources/Qwen3TTS/CodePredictor.swift:25 — Sources/Qwen3TTS/CodePredictor.swift:25-46 | Sources/Qwen3TTS/Talker.swift:30-51 — before extracting anything, compare `Sources/Qwen3TTS/CodePredictor.swift` and `Sources/Qwen3TTS/Talker.swift` as WHOLE FILES: this scan already matched 9 separate duplicated blocks between them, totalling at least 102 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `CodePredictorConfig` in one and `TalkerConfig` 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 (20–21 lines × 2) · ×2
  • Duplicated block (20–21 lines × 2) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:43 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:43-62 | Sources/SpeechVAD/MelFeatureExtractor.swift:45-65 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/SpeechVAD/MelFeatureExtractor.swift` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:43` 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 (20–21 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:73 — Sources/HibikiTranslate/HibikiDepformer.swift:73-92 | Sources/PersonaPlex/Depformer.swift:48-68 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:73` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/HibikiTranslate/HibikiDepformer.swift:70` calls `precondition` and `Sources/PersonaPlex/Depformer.swift:47` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (19 lines × 3) · ×2
  • Duplicated block (19 lines × 3) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:79 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:79-97 | Sources/SpeechVAD/MelFeatureExtractor.swift:82-100 | Sources/SpeechVAD/SortformerMelExtractor.swift:98-116 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/SpeechVAD/MelFeatureExtractor.swift` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (19 lines × 3) Sources/F5TTS/F5TTSPrimitives.swift:43 — Sources/F5TTS/F5TTSPrimitives.swift:43-61 | Sources/IndexTTS2TTS/IndexTTS2S2MelFlow.swift:309-327 | Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:1242-1260 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/F5TTS/F5TTSPrimitives.swift:43` 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 (15–19 lines × 2) · ×2
  • Duplicated block (15–19 lines × 2) Sources/ParakeetASR/MelPreprocessor.swift:150 — Sources/ParakeetASR/MelPreprocessor.swift:150-168 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:153-167 — before extracting anything, compare `Sources/ParakeetASR/MelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 162 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetASR/MelPreprocessor.swift:150` 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–19 lines × 2) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:145 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:145-159 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:416-434 — 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 (14–18 lines × 2) · ×2
  • Duplicated block (14–18 lines × 2) Sources/AudioServer/AudioServer.swift:235 — Sources/AudioServer/AudioServer.swift:235-252 | Sources/AudioServer/AudioServer.swift:322-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioServer/AudioServer.swift:235` 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–18 lines × 2) Sources/Qwen3ASR/CoreMLForcedAligner.swift:71 — Sources/Qwen3ASR/CoreMLForcedAligner.swift:71-84 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:133-150 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/CoreMLForcedAligner.swift:71` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
D4 · Code Duplication · Duplicated block (15–17 lines × 2) · ×2
  • Duplicated block (15–17 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:206 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:206-220 | Sources/PersonaPlex/TemporalTransformer.swift:210-226 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiTemporalTransformer.swift:206` 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 `cfg` to `HibikiTemporalConfig` in one and `TemporalTransformerConfig` 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 (15–17 lines × 2) Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:161 — Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:161-175 | Sources/OmnilingualASR/OmnilingualASR.swift:184-200 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:161` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–15 lines × 3) · ×2
  • Duplicated block (11–15 lines × 3) Sources/CosyVoiceTTS/FlowMelExtractor.swift:40 — Sources/CosyVoiceTTS/FlowMelExtractor.swift:40-50 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:31-41 | Sources/Qwen3ASR/AudioPreprocessing.swift:39-53 — before extracting anything, compare `Sources/CosyVoiceTTS/FlowMelExtractor.swift` and `Sources/CosyVoiceTTS/WhisperMelExtractor.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 139 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (11–15 lines × 3) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:144 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:144-154 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:223-237 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:415-429 — 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.
D4 · Code Duplication · Duplicated block (12–14 lines × 3) · ×2
  • Duplicated block (12–14 lines × 3) Sources/HiggsTTS/HiggsTTSBackbone.swift:57 — Sources/HiggsTTS/HiggsTTSBackbone.swift:57-68 | Sources/IndicMioTTS/IndicMioQwen3.swift:52-63 | Sources/Qwen3Chat/Qwen35Model.swift:390-403 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `cache` to `(MLXArray, MLXArray)?` in one and `(MLXArray, MLXArray)? = nil` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
  • Duplicated block (12–14 lines × 3) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:381 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:381-392 | Sources/ParakeetASR/ParakeetASR.swift:538-551 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:223-234 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/NemotronStreamingASR.swift:381` 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 (12–14 lines × 2) · ×2
  • Duplicated block (12–14 lines × 2) Sources/HibikiTranslate/HibikiDepformer.swift:300 — Sources/HibikiTranslate/HibikiDepformer.swift:300-311 | Sources/PersonaPlex/Depformer.swift:264-277 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (12–14 lines × 2) Sources/Qwen3TTS/Sampling.swift:114 — Sources/Qwen3TTS/Sampling.swift:114-127 | Sources/Qwen3TTS/Sampling.swift:245-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.
D4 · Code Duplication · Duplicated block (13 lines × 3) · ×2
  • Duplicated block (13 lines × 3) Sources/AudioCommon/AudioIO.swift:264 — Sources/AudioCommon/AudioIO.swift:264-276 | Sources/AudioCommon/FullDuplexAudioIO.swift:383-395 | Sources/AudioCommon/SystemAudioTap.swift:443-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 all 3 call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCommon/AudioIO.swift:264` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
  • Duplicated block (13 lines × 3) Sources/PersonaPlex/Configuration.swift:107 — Sources/PersonaPlex/Configuration.swift:107-119 | Sources/PersonaPlex/Configuration.swift:159-171 | Sources/VibeVoiceTTS/Models/Qwen2Configuration.swift:41-53 — 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 `Sources/PersonaPlex/Configuration.swift:107` 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 (10–13 lines × 2) · ×2
  • Duplicated block (10–13 lines × 2) Sources/ChatterboxTTS/MTLTokenizer.swift:262 — Sources/ChatterboxTTS/MTLTokenizer.swift:262-271 | Sources/MagpieTTS/JapaneseG2P.swift:84-96 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/MTLTokenizer.swift:262` 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) Sources/MADLADTranslation/MADLADModel.swift:32 — Sources/MADLADTranslation/MADLADModel.swift:32-44 | Sources/MAGNeTMusicGen/T5Encoder.swift:16-25 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MADLADTranslation/MADLADModel.swift:32` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–13 lines × 2) · ×2
  • Duplicated block (9–13 lines × 2) Sources/CosyVoiceTTS/LLM.swift:66 — Sources/CosyVoiceTTS/LLM.swift:66-78 | Sources/Qwen3TTS/Sampling.swift:42-50 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:66` 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–13 lines × 2) Sources/NemotronStreamingASR/StreamingSession.swift:119 — Sources/NemotronStreamingASR/StreamingSession.swift:119-127 | Sources/ParakeetStreamingASR/StreamingSession.swift:86-98 — `Sources/NemotronStreamingASR/StreamingSession.swift` and `Sources/ParakeetStreamingASR/StreamingSession.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 9 separate duplicated blocks between them, totalling at least 86 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (12 lines × 15) · ×2
  • Duplicated block (12 lines × 15) Sources/AudioCommon/HindiEmotionTTSCatalog.swift:83 — Sources/AudioCommon/HindiEmotionTTSCatalog.swift:83-94 | Sources/CanaryASR/Configuration.swift:118-129 | Sources/HibikiTranslate/Configuration.swift:133-144 | Sources/HibikiTranslate/Configuration.swift:247-258 | Sources/IndexTTS2TTS/IndexTTS2NativeRuntime.swift:112-123 | Sources/MADLADTranslation/MADLADConfig.swift:66-77 | Sources/MLXCommon/SlaneyMel.swift:31-42 | Sources/NemotronStreamingASR/Configuration.swift:83-94 | Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:64-75 | Sources/ParakeetASR/Configuration.swift:52-63 | Sources/PersonaPlex/Configuration.swift:108-119 | Sources/PersonaPlex/Configuration.swift:160-171 | Sources/Qwen3Chat/Qwen3ChatConfig.swift:104-115 | Sources/SpeechVAD/SortformerConfig.swift:303-314 | Sources/VibeVoiceTTS/Models/AcousticTokenizerConfiguration.swift:90-101 — `Sources/CanaryASR/Configuration.swift` and `Sources/ParakeetASR/Configuration.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 3 separate duplicated blocks between them, totalling at least 35 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 `Sources/AudioCommon/HindiEmotionTTSCatalog.swift:83` 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 × 15) Sources/AudioCommon/HindiEmotionTTSCatalog.swift:86 — Sources/AudioCommon/HindiEmotionTTSCatalog.swift:86-97 | Sources/CanaryASR/Configuration.swift:124-135 | Sources/HibikiTranslate/Configuration.swift:137-148 | Sources/HibikiTranslate/Configuration.swift:252-263 | Sources/IndexTTS2TTS/IndexTTS2NativeRuntime.swift:122-133 | Sources/MADLADTranslation/MADLADConfig.swift:71-82 | Sources/MLXCommon/SlaneyMel.swift:33-44 | Sources/NemotronStreamingASR/Configuration.swift:90-101 | Sources/OmnilingualASR/MLX/OmnilingualMLXConfig.swift:69-80 | Sources/ParakeetASR/Configuration.swift:57-68 | Sources/PersonaPlex/Configuration.swift:110-121 | Sources/PersonaPlex/Configuration.swift:163-174 | Sources/Qwen3Chat/Qwen3ChatConfig.swift:119-130 | Sources/SpeechVAD/SortformerConfig.swift:320-331 | Sources/VibeVoiceTTS/Models/AcousticTokenizerConfiguration.swift:99-110 — `Sources/CanaryASR/Configuration.swift` and `Sources/ParakeetASR/Configuration.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 3 separate duplicated blocks between them, totalling at least 35 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 `Sources/AudioCommon/HindiEmotionTTSCatalog.swift:86` 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 (10–12 lines × 3) · ×2
  • Duplicated block (10–12 lines × 3) Sources/ChatterboxTTS/S3GenVocoder.swift:418 — Sources/ChatterboxTTS/S3GenVocoder.swift:418-428 | Sources/CosyVoiceTTS/HiFiGAN.swift:538-549 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:614-623 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:418` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
  • Duplicated block (10–12 lines × 3) Sources/Qwen3ASR/CoreMLASRModel.swift:234 — Sources/Qwen3ASR/CoreMLASRModel.swift:234-243 | Sources/Qwen3ASR/CoreMLASRModel.swift:354-363 | Sources/Qwen3ASR/Qwen3ASR.swift:552-563 — 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 `Sources/Qwen3ASR/CoreMLASRModel.swift:234` 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 (8–12 lines × 3) · ×2
  • Duplicated block (8–12 lines × 3) Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:129 — Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:129-136 | Sources/ParakeetASR/TDTGreedyDecoder.swift:175-186 | Sources/ParakeetStreamingASR/RNNTGreedyDecoder.swift:145-154 — `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift` and `Sources/ParakeetStreamingASR/RNNTGreedyDecoder.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 5 separate duplicated blocks between them, totalling at least 62 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/ParakeetASR/TDTGreedyDecoder.swift:187` calls `Float` and `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:137` 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–12 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:277 — Sources/PersonaPlex/PersonaPlex.swift:277-288 | Sources/PersonaPlex/PersonaPlex.swift:733-740 | Sources/PersonaPlex/PersonaPlex.swift:1432-1439 — 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 `Sources/PersonaPlex/PersonaPlex.swift:277` 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 × 4) · ×2
  • Duplicated block (9–11 lines × 4) Sources/Qwen3ASR/FloatTextDecoder.swift:82 — Sources/Qwen3ASR/FloatTextDecoder.swift:82-90 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:70-80 | Sources/Qwen3Chat/Qwen35Model.swift:377-387 | Sources/Qwen3TTS/CodePredictor.swift:65-73 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 before the matched lines, `Sources/Qwen3ASR/FloatTextDecoder.swift:81` calls `reshaped` and `Sources/Qwen3Chat/Qwen35Model.swift:374` 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–11 lines × 4) Sources/Qwen3ASR/StreamingASR.swift:124 — Sources/Qwen3ASR/StreamingASR.swift:124-134 | Sources/Qwen3ASR/StreamingASR.swift:183-193 | Sources/Qwen3ASR/StreamingASR.swift:213-223 | Sources/Qwen3ASR/StreamingASR.swift:243-251 — 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 `Sources/Qwen3ASR/StreamingASR.swift:124` 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 (4–11 lines × 3) · ×2
  • Duplicated block (4–11 lines × 3) Sources/CosyVoiceTTS/CosyVoiceTTS.swift:103 — Sources/CosyVoiceTTS/CosyVoiceTTS.swift:103-106 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:59-69 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:122-131 — 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 `Sources/CosyVoiceTTS/CosyVoiceTTS.swift:103` 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 (4–11 lines × 3) Sources/Qwen3TTSCoreML/SpeechDecoderCoreML.swift:38 — Sources/Qwen3TTSCoreML/SpeechDecoderCoreML.swift:38-41 | Sources/SpeechEnhancement/SpeechEnhancement.swift:501-511 | Sources/SpeechRestoration/SpeechRestoration.swift:280-288 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3TTSCoreML/SpeechDecoderCoreML.swift:38` 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–10 lines × 4) · ×2
  • Duplicated block (8–10 lines × 4) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:187 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:187-194 | Sources/Qwen3ASR/AudioPreprocessing.swift:267-276 | Sources/Qwen3ASR/AudioPreprocessing.swift:424-432 | Sources/SpeechVAD/MelFeatureExtractor.swift:193-201 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/Qwen3ASR/AudioPreprocessing.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (8–10 lines × 4) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:382 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:382-390 | Sources/ParakeetASR/ParakeetASR.swift:539-548 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:224-232 | Sources/SpeechWakeWord/SpeechWakeWord.swift:327-334 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/NemotronStreamingASR.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.
D4 · Code Duplication · Duplicated block (8 lines × 4) · ×2
  • Duplicated block (8 lines × 4) Sources/CosyVoiceTTS/CamPlusPlusSpeaker.swift:63 — Sources/CosyVoiceTTS/CamPlusPlusSpeaker.swift:63-70 | Sources/SpeechVAD/FireRedVAD.swift:83-90 | Sources/SpeechVAD/SileroVAD.swift:302-309 | Sources/SpeechVAD/WeSpeaker.swift:152-159 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD.swift` and `Sources/SpeechVAD/WeSpeaker.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
  • Duplicated block (8 lines × 4) Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:70 — Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:70-77 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:93-100 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:118-125 | Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:143-150 — 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 `Examples/iOSBenchmark/iOSBenchmark/BenchmarkCore.swift:70` 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 (7–8 lines × 4) · ×2
  • Duplicated block (7–8 lines × 4) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:134 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:134-140 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:145-152 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:263-269 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:351-358 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:362` calls `min` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:156` 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 (7–8 lines × 4) Sources/Qwen3ASR/FloatTextDecoder.swift:77 — Sources/Qwen3ASR/FloatTextDecoder.swift:77-83 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:64-71 | Sources/Qwen3TTS/CodePredictor.swift:60-66 | Sources/VoxCPM2TTS/MiniCPM4.swift:268-274 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (6–8 lines × 2) · ×2
  • Duplicated block (6–8 lines × 2) Sources/MAGNeTMusicGen/MAGNeTLM.swift:48 — Sources/MAGNeTMusicGen/MAGNeTLM.swift:48-55 | Sources/Qwen3ASR/AudioEncoder.swift:117-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MAGNeTMusicGen/MAGNeTLM.swift:48` 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–8 lines × 2) Sources/Qwen3Chat/Gemma4WeightLoading.swift:56 — Sources/Qwen3Chat/Gemma4WeightLoading.swift:56-63 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:43-48 — before extracting anything, compare `Sources/Qwen3Chat/Gemma4WeightLoading.swift` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift` as WHOLE FILES: this scan already matched 5 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 `Sources/Qwen3Chat/Gemma4WeightLoading.swift:56` 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, `Sources/Qwen3Chat/Gemma4WeightLoading.swift:65` calls `applyRMSNormWeights` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:51` 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 (7 lines × 5) · ×2
  • Duplicated block (7 lines × 5) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:187 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:187-193 | Sources/Qwen3ASR/AudioPreprocessing.swift:267-275 | Sources/Qwen3ASR/AudioPreprocessing.swift:424-431 | Sources/SpeechVAD/MelFeatureExtractor.swift:193-200 | Sources/SpeechVAD/SortformerMelExtractor.swift:202-211 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/Qwen3ASR/AudioPreprocessing.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
  • Duplicated block (7 lines × 5) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:66 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:66-72 | Sources/ParakeetASR/MelPreprocessor.swift:59-66 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:70-76 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:200-206 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:292-298 — before extracting anything, compare `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetASR/MelPreprocessor.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:66` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (6–7 lines × 3) · ×2
  • Duplicated block (6–7 lines × 3) Examples/SpeechDemo/SpeechDemo/EchoViewModel.swift:256 — Examples/SpeechDemo/SpeechDemo/EchoViewModel.swift:256-261 | Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:534-540 | Sources/AudioCommon/AudioIO.swift:158-164 — 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.
  • Duplicated block (6–7 lines × 3) Sources/MagpieTTSCoreML/Decoder.swift:177 — Sources/MagpieTTSCoreML/Decoder.swift:177-183 | Sources/MagpieTTSCoreML/Decoder.swift:293-298 | Sources/MagpieTTSCoreML/StatefulDecoder.swift:94-99 — 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 `Sources/MagpieTTSCoreML/Decoder.swift:177` 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 (6 lines × 5) · ×2
  • Duplicated block (6 lines × 5) Sources/CSM/CSMModel.swift:92 — Sources/CSM/CSMModel.swift:92-97 | Sources/HibikiTranslate/HibikiDepformer.swift:140-145 | Sources/HibikiTranslate/HibikiTemporalTransformer.swift:72-77 | Sources/PersonaPlex/Depformer.swift:116-121 | Sources/PersonaPlex/TemporalTransformer.swift:74-79 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CSM/CSMModel.swift:92` 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 × 5) Sources/Qwen3ASR/FloatTextDecoder.swift:85 — Sources/Qwen3ASR/FloatTextDecoder.swift:85-90 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:74-80 | Sources/Qwen3Chat/Qwen35Model.swift:381-387 | Sources/Qwen3TTS/CodePredictor.swift:68-73 | Sources/Qwen3TTS/Talker.swift:77-83 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 before the matched lines, `Sources/Qwen3ASR/FloatTextDecoder.swift:81` calls `reshaped` and `Sources/Qwen3Chat/Qwen35Model.swift:374` 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 × 4) · ×2
  • Duplicated block (6 lines × 4) Sources/AsrBenchmark/EngineNemotron.swift:19 — Sources/AsrBenchmark/EngineNemotron.swift:19-24 | Sources/AsrBenchmark/EngineNemotron.swift:70-78 | Sources/AsrBenchmark/EngineOmnilingual.swift:19-24 | Sources/AsrBenchmark/EngineParakeet.swift:23-28 — 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `language` to `String?) async throws -> (text: String` in one and `String? ) async throws -> (text: String` 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 × 4) Sources/AudioCLILib/DiarizeCommand.swift:83 — Sources/AudioCLILib/DiarizeCommand.swift:83-88 | Sources/AudioCLILib/EmbedSpeakerCommand.swift:24-29 | Sources/AudioCLILib/VadCommand.swift:44-49 | Sources/AudioCLILib/VadStreamCommand.swift:47-52 — 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 `Sources/AudioCLILib/DiarizeCommand.swift:83` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (5 lines × 8) · ×2
  • Duplicated block (5 lines × 8) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:176 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:176-180 | Sources/ParakeetASR/MelPreprocessor.swift:128-133 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:134-138 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:342-346 | Sources/Qwen3ASR/AudioPreprocessing.swift:244-250 | Sources/Qwen3ASR/AudioPreprocessing.swift:408-412 | Sources/SpeechVAD/MelFeatureExtractor.swift:182-186 | Sources/SpeechVAD/SortformerMelExtractor.swift:191-195 — there are 8 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 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:176` 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, `Sources/Qwen3ASR/AudioPreprocessing.swift:254` calls `fatalError` and `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:183` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
  • Duplicated block (5 lines × 8) Sources/IndicMioTTS/IndicMioWavLM.swift:438 — Sources/IndicMioTTS/IndicMioWavLM.swift:438-444 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:558-564 | Sources/MLXCommon/WeightLoading.swift:79-86 | Sources/MLXCommon/WeightLoading.swift:238-245 | Sources/MLXCommon/WeightLoading.swift:257-264 | Sources/MLXCommon/WeightLoading.swift:295-302 | Sources/MLXCommon/WeightLoading.swift:317-324 | Sources/Qwen3TTS/TTSWeightLoading+Encoder.swift:89-93 — there are 8 copies across 4 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 8 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndicMioTTS/IndicMioWavLM.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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/MLXCommon/WeightLoading.swift:292` calls `transposed` and `Sources/IndicMioTTS/IndicMioWavLM.swift:435` 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.
D6 · Cohesion (LCOM4) · Low cohesion · ×2
  • Low cohesion: CoreMLTextDecoder (LCOM4 5) Sources/Qwen3ASR/CoreMLTextDecoder.swift:32 — CoreMLTextDecoder's methods fall into 5 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 5 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: AudioVAE (LCOM4 4) Sources/VoxCPM2TTS/AudioVAE.swift:566 — AudioVAE's methods fall into 4 groups that share no field and call none of each other, against a bar of more than 3 for this run (LCOM4, configurable — your repository's bar is the one quoted here). Each group is a set of methods reachable from one another through shared fields or direct calls, so 4 groups means the type has that many internally-connected clusters with nothing tying them together. Types whose shape makes a high count expected — and which would otherwise dominate this list — are excluded before this row is raised, so this is a genuine split candidate rather than a metric reading. It is still a shape, not a defect: confirm the groups match responsibilities you can name before splitting.
AX2 · Stateful singletons · Stateful handler dependency · ×1
  • Stateful handler dependency: Gemma4Chat Sources/Qwen3Chat/Gemma4Chat.swift:14 — `Gemma4Chat` is written on every request (`resetState` is reached per request from the Hummingbird route closure `NativeInferenceService.registerRoutes`, and every request shares the instance it runs on and every static it writes) but writes that shared state outside any lock (state; e.g. `state` in `resetState` at line 103). Handlers run concurrently — SwiftNIO serves one event loop per core and async handlers run on the cooperative thread pool — and unsynchronised concurrent writes are a data race in Swift: an update is lost, and a concurrent Array or Dictionary write corrupts its storage.
D1 · Cyclomatic Complexity · SpeakCommand.validate (cyclomatic 128) · ×1
  • SpeakCommand.validate (cyclomatic 128) Sources/AudioCLILib/SpeakCommand.swift:391 — SpeakCommand.validate has cyclomatic complexity 128 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · AudioServer.swift.handleRealtimeWS (cyclomatic 105) · ×1
  • AudioServer.swift.handleRealtimeWS (cyclomatic 105) Sources/AudioServer/AudioServer.swift:968 — AudioServer.swift.handleRealtimeWS has cyclomatic complexity 105 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GermanPhonemizer.normalizeNumbers (cyclomatic 91) · ×1
  • GermanPhonemizer.normalizeNumbers (cyclomatic 91) Sources/KokoroTTS/GermanPhonemizer.swift:901 — GermanPhonemizer.normalizeNumbers has cyclomatic complexity 91 (threshold 15). Of this number, 85 points are the body's own statements and 6 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · GermanPhonemizer.mapConsonants (cyclomatic 71) · ×1
  • GermanPhonemizer.mapConsonants (cyclomatic 71) Sources/KokoroTTS/GermanPhonemizer.swift:514 — GermanPhonemizer.mapConsonants 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 · PersonaPlexModel.respond (cyclomatic 69) · ×1
  • PersonaPlexModel.respond (cyclomatic 69) Sources/PersonaPlex/PersonaPlex.swift:127 — PersonaPlexModel.respond 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 · VoiceChatSession.advance (cyclomatic 68) · ×1
  • VoiceChatSession.advance (cyclomatic 68) Sources/VoiceChat/VoiceChatSession.swift:946 — VoiceChatSession.advance has cyclomatic complexity 68 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · PersonaPlexModel.respondStream (cyclomatic 65) · ×1
  • PersonaPlexModel.respondStream (cyclomatic 65) Sources/PersonaPlex/PersonaPlex.swift:618 — PersonaPlexModel.respondStream has cyclomatic complexity 65 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · FishAudioDrama3Config.parse (cyclomatic 59) · ×1
  • FishAudioDrama3Config.parse (cyclomatic 59) Sources/FishAudioTTS/FishAudioDrama3Config.swift:39 — FishAudioDrama3Config.parse has cyclomatic complexity 59 (threshold 15). Of this number, 45 points are the body's own statements and 14 belong to 5 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 · JSONSchemaMatcher.feedString (cyclomatic 55) · ×1
  • JSONSchemaMatcher.feedString (cyclomatic 55) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:282 — JSONSchemaMatcher.feedString has cyclomatic complexity 55 (threshold 15). Of this number, 49 points are the body's own statements and 6 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 · VoiceChatBench.runFullDuplexToolScenario (cyclomatic 55) · ×1
  • VoiceChatBench.runFullDuplexToolScenario (cyclomatic 55) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:886 — VoiceChatBench.runFullDuplexToolScenario has cyclomatic complexity 55 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages. This shape REPEATS in the file: one other method here (VoiceChatBench.runFullDuplexToolScenario::observe) 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 · BreezeTTSConfig.validate (cyclomatic 53) · ×1
  • BreezeTTSConfig.validate (cyclomatic 53) Sources/BreezeTTS/Options.swift:70 — BreezeTTSConfig.validate 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.
D1 · Cyclomatic Complexity · PersonaPlexModel.respondDiagnostic (cyclomatic 49) · ×1
  • PersonaPlexModel.respondDiagnostic (cyclomatic 49) Sources/PersonaPlex/PersonaPlex.swift:1332 — PersonaPlexModel.respondDiagnostic 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.
D1 · Cyclomatic Complexity · PersonaPlexModel.respondRealtime (cyclomatic 47) · ×1
  • PersonaPlexModel.respondRealtime (cyclomatic 47) Sources/PersonaPlex/PersonaPlex.swift:1012 — PersonaPlexModel.respondRealtime has cyclomatic complexity 47 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · GermanPhonemizer.vowelPhoneme (cyclomatic 46) · ×1
  • GermanPhonemizer.vowelPhoneme (cyclomatic 46) Sources/KokoroTTS/GermanPhonemizer.swift:448 — GermanPhonemizer.vowelPhoneme 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 · Qwen3TTSCoreMLModel.synthesize (cyclomatic 46) · ×1
  • Qwen3TTSCoreMLModel.synthesize (cyclomatic 46) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:220 — Qwen3TTSCoreMLModel.synthesize has cyclomatic complexity 46 (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 · VoiceChatCommand.validate (cyclomatic 42) · ×1
  • VoiceChatCommand.validate (cyclomatic 42) Sources/AudioCLILib/VoiceChatCommand.swift:140 — VoiceChatCommand.validate has cyclomatic complexity 42 (threshold 15). To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · NemotronMLXConfiguration.validate (cyclomatic 41) · ×1
  • NemotronMLXConfiguration.validate (cyclomatic 41) Sources/NemotronStreamingASR/NemotronMLXConfiguration.swift:181 — NemotronMLXConfiguration.validate has cyclomatic complexity 41 (threshold 15). To reduce it, name the conditions: bind each compound test to a well-named local or a small predicate function, so the body reads as a sequence of named decisions rather than a chain of operators.
D1 · Cyclomatic Complexity · JSONSchemaMatcher.feed (cyclomatic 41) · ×1
  • JSONSchemaMatcher.feed (cyclomatic 41) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:73 — JSONSchemaMatcher.feed 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 · RespondCommand.run (cyclomatic 40) · ×1
  • RespondCommand.run (cyclomatic 40) Sources/AudioCLILib/RespondCommand.swift:94 — RespondCommand.run 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 · AudioServer.buildRouter (cyclomatic 39) · ×1
  • AudioServer.buildRouter (cyclomatic 39) Sources/AudioServer/AudioServer.swift:90 — AudioServer.buildRouter has cyclomatic complexity 39 (threshold 15). Of this number, 38 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VoiceChatCommand.runMicrophone (cyclomatic 38) · ×1
  • VoiceChatCommand.runMicrophone (cyclomatic 38) Sources/AudioCLILib/VoiceChatCommand.swift:473 — VoiceChatCommand.runMicrophone 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 · VoxCPM2TTSModel.generateVoxCPM2 (cyclomatic 38) · ×1
  • VoxCPM2TTSModel.generateVoxCPM2 (cyclomatic 38) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1149 — VoxCPM2TTSModel.generateVoxCPM2 has cyclomatic complexity 38 (threshold 15). Of this number, 35 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization (cyclomatic 37) · ×1
  • PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization (cyclomatic 37) Sources/SpeechVAD/DiarizationPipeline.swift:310 — PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization 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 · NativeInferenceRequest.validate (cyclomatic 35) · ×1
  • NativeInferenceRequest.validate (cyclomatic 35) Sources/AudioServer/NativeInference.swift:46 — NativeInferenceRequest.validate has cyclomatic complexity 35 (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 · VibeVoiceQuantizer.quantizeAndSave (cyclomatic 34) · ×1
  • VibeVoiceQuantizer.quantizeAndSave (cyclomatic 34) Sources/VibeVoiceTTS/Quantization/VibeVoiceQuantization.swift:117 — VibeVoiceQuantizer.quantizeAndSave 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 · SpeakCommand.runCosyVoice (cyclomatic 33) · ×1
  • SpeakCommand.runCosyVoice (cyclomatic 33) Sources/AudioCLILib/SpeakCommand.swift:1898 — SpeakCommand.runCosyVoice 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 · ChatSampler.sample (cyclomatic 33) · ×1
  • ChatSampler.sample (cyclomatic 33) Sources/Qwen3Chat/ChatSampler.swift:31 — ChatSampler.sample 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 · GermanPhonemizer.g2pLower (cyclomatic 31) · ×1
  • GermanPhonemizer.g2pLower (cyclomatic 31) Sources/KokoroTTS/GermanPhonemizer.swift:655 — GermanPhonemizer.g2pLower 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 · MagpieCoreMLDecoder.step (cyclomatic 31) · ×1
  • MagpieCoreMLDecoder.step (cyclomatic 31) Sources/MagpieTTSCoreML/Decoder.swift:275 — MagpieCoreMLDecoder.step 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 · KokoroPhonemizer.bartG2P (cyclomatic 30) · ×1
  • KokoroPhonemizer.bartG2P (cyclomatic 30) Sources/KokoroTTS/Phonemizer.swift:510 — KokoroPhonemizer.bartG2P 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 · MossMLXConfiguration.validate (cyclomatic 30) · ×1
  • MossMLXConfiguration.validate (cyclomatic 30) Sources/MossTranscribe/MossMLXConfiguration.swift:97 — MossMLXConfiguration.validate 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 · TranscribeCommand.validate (cyclomatic 29) · ×1
  • TranscribeCommand.validate (cyclomatic 29) Sources/AudioCLILib/TranscribeCommand.swift:73 — TranscribeCommand.validate 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 · HibikiTranslateModel.translate (cyclomatic 29) · ×1
  • HibikiTranslateModel.translate (cyclomatic 29) Sources/HibikiTranslate/HibikiTranslate.swift:41 — HibikiTranslateModel.translate 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 · Parser.parseValue (cyclomatic 29) · ×1
  • Parser.parseValue (cyclomatic 29) Sources/Qwen3Chat/Gemma4Tools.swift:303 — Parser.parseValue 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 · FullDuplexAcousticAnalyzer.analyze (cyclomatic 29) · ×1
  • FullDuplexAcousticAnalyzer.analyze (cyclomatic 29) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:621 — FullDuplexAcousticAnalyzer.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 · VoiceChatTerminalRenderer.render (cyclomatic 28) · ×1
  • VoiceChatTerminalRenderer.render (cyclomatic 28) Sources/AudioCLILib/VoiceChatDemoSupport.swift:873 — VoiceChatTerminalRenderer.render 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 · JSONSchemaGrammar.compileType (cyclomatic 28) · ×1
  • JSONSchemaGrammar.compileType (cyclomatic 28) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:189 — JSONSchemaGrammar.compileType has cyclomatic complexity 28 (threshold 15). Of this number, 22 points are the body's own statements and 6 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 · Qwen3TTSCoreMLModel.fromPretrained (cyclomatic 28) · ×1
  • Qwen3TTSCoreMLModel.fromPretrained (cyclomatic 28) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:40 — Qwen3TTSCoreMLModel.fromPretrained has cyclomatic complexity 28 (threshold 15). Most of this is not in the body itself: 13 of the 28 points are its own statements and the rest belongs to 4 function items inside it that branch (loadML, route, loadML::require, …). 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 · FishDrama3Benchmark.run (cyclomatic 28) · ×1
  • FishDrama3Benchmark.run (cyclomatic 28) scripts/profiling/FishDrama3Benchmark.swift:43 — FishDrama3Benchmark.run has cyclomatic complexity 28 (threshold 15). Of this number, 26 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 · PocketBenchmark.run (cyclomatic 27) · ×1
  • PocketBenchmark.run (cyclomatic 27) Sources/PocketTTSBenchmark/main.swift:15 — PocketBenchmark.run 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 · StreamingASR.transcribeStream (cyclomatic 27) · ×1
  • StreamingASR.transcribeStream (cyclomatic 27) Sources/Qwen3ASR/StreamingASR.swift:85 — StreamingASR.transcribeStream 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 · Gemma4ToolCodec.prompt (cyclomatic 27) · ×1
  • Gemma4ToolCodec.prompt (cyclomatic 27) Sources/Qwen3Chat/Gemma4Tools.swift:153 — Gemma4ToolCodec.prompt 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 · WienerFilter.emWiener (cyclomatic 27) · ×1
  • WienerFilter.emWiener (cyclomatic 27) Sources/SourceSeparation/WienerFilter.swift:73 — WienerFilter.emWiener has cyclomatic complexity 27 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · MossTTSNanoTokenizer.encode (cyclomatic 26) · ×1
  • MossTTSNanoTokenizer.encode (cyclomatic 26) Sources/MossTTSNano/MossTTSNanoTokenizer.swift:102 — MossTTSNanoTokenizer.encode has cyclomatic complexity 26 (threshold 15). Most of this is not in the body itself: 12 of the 26 points are its own statements and the rest belongs to 4 function items inside it that branch (pop, enqueue, push, …). 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 · JSONSchemaMatcher.feedObject (cyclomatic 26) · ×1
  • JSONSchemaMatcher.feedObject (cyclomatic 26) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:188 — JSONSchemaMatcher.feedObject 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 · TTSSampler.sample (cyclomatic 26) · ×1
  • TTSSampler.sample (cyclomatic 26) Sources/Qwen3TTSCoreML/Sampler.swift:21 — TTSSampler.sample 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 · VoiceChatSession.validate (cyclomatic 26) · ×1
  • VoiceChatSession.validate (cyclomatic 26) Sources/VoiceChat/VoiceChatSession.swift:371 — VoiceChatSession.validate 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 · FullDuplexToolScenario.load (cyclomatic 26) · ×1
  • FullDuplexToolScenario.load (cyclomatic 26) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:22 — FullDuplexToolScenario.load 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · convert_coreml.main (cyclomatic 26) · ×1
  • convert_coreml.main (cyclomatic 26) scripts/qwen3_tts_coreml/convert_coreml.py:562 — convert_coreml.main 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 · FullDuplexAudioIO.start (cyclomatic 25) · ×1
  • FullDuplexAudioIO.start (cyclomatic 25) Sources/AudioCommon/FullDuplexAudioIO.swift:117 — FullDuplexAudioIO.start 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 · VoiceChatSession.runFunctionFastPath (cyclomatic 25) · ×1
  • VoiceChatSession.runFunctionFastPath (cyclomatic 25) Sources/VoiceChat/VoiceChatSession.swift:1576 — VoiceChatSession.runFunctionFastPath 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 · AudioFileLoader.loadWAV (cyclomatic 24) · ×1
  • AudioFileLoader.loadWAV (cyclomatic 24) Sources/AudioCommon/AudioFileLoader.swift:126 — AudioFileLoader.loadWAV 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 · KokoroPhonemizer.phonemizeWithDict (cyclomatic 24) · ×1
  • KokoroPhonemizer.phonemizeWithDict (cyclomatic 24) Sources/KokoroTTS/Phonemizer.swift:249 — KokoroPhonemizer.phonemizeWithDict 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 · KyutaiSTTConfig.init (cyclomatic 24) · ×1
  • KyutaiSTTConfig.init (cyclomatic 24) Sources/KyutaiSTT/Configuration.swift:84 — KyutaiSTTConfig.init 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, name the conditions: bind each compound test to a 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 · Gemma4UnifiedChat.generateResponse (cyclomatic 24) · ×1
  • Gemma4UnifiedChat.generateResponse (cyclomatic 24) Sources/Qwen3Chat/Gemma4UnifiedChat.swift:149 — Gemma4UnifiedChat.generateResponse 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 · HTDemucs.init (cyclomatic 24) · ×1
  • HTDemucs.init (cyclomatic 24) Sources/SourceSeparation/HTDemucs/HTDemucs.swift:35 — HTDemucs.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 · VoiceChatRNNTTurnTakingState.selectToken (cyclomatic 24) · ×1
  • VoiceChatRNNTTurnTakingState.selectToken (cyclomatic 24) Sources/VoiceChat/VoiceChatTurnTaking.swift:168 — VoiceChatRNNTTurnTakingState.selectToken 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 · VoiceChatMCPRuntime.callProvider (cyclomatic 23) · ×1
  • VoiceChatMCPRuntime.callProvider (cyclomatic 23) Sources/AudioCLILib/VoiceChatMCP.swift:437 — VoiceChatMCPRuntime.callProvider 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 · VoiceChatMCPToolCoordinator.validate (cyclomatic 23) · ×1
  • VoiceChatMCPToolCoordinator.validate (cyclomatic 23) Sources/AudioCLILib/VoiceChatMCP.swift:1582 — VoiceChatMCPToolCoordinator.validate 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 · AudioIO.startMicrophoneTimestamped (cyclomatic 23) · ×1
  • AudioIO.startMicrophoneTimestamped (cyclomatic 23) Sources/AudioCommon/AudioIO.swift:80 — AudioIO.startMicrophoneTimestamped 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 · IndexTTS2PauseCompressor.compress (cyclomatic 23) · ×1
  • IndexTTS2PauseCompressor.compress (cyclomatic 23) Sources/IndexTTS2TTS/IndexTTS2Synthesis.swift:75 — IndexTTS2PauseCompressor.compress 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 · LatinPhonemizer.frenchToIPA (cyclomatic 23) · ×1
  • LatinPhonemizer.frenchToIPA (cyclomatic 23) Sources/KokoroTTS/LatinPhonemizer.swift:143 — LatinPhonemizer.frenchToIPA 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 · Gemma4Tokenizer.bpeEncode (cyclomatic 23) · ×1
  • Gemma4Tokenizer.bpeEncode (cyclomatic 23) Sources/Qwen3Chat/Gemma4Tokenizer.swift:185 — Gemma4Tokenizer.bpeEncode 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 · RegexParser.escape (cyclomatic 23) · ×1
  • RegexParser.escape (cyclomatic 23) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:289 — RegexParser.escape 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 · JSONSchemaGrammar.compile (cyclomatic 23) · ×1
  • JSONSchemaGrammar.compile (cyclomatic 23) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:86 — JSONSchemaGrammar.compile 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 · JSONSchemaGrammar.compileObject (cyclomatic 23) · ×1
  • JSONSchemaGrammar.compileObject (cyclomatic 23) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:253 — JSONSchemaGrammar.compileObject 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 · Parser.value (cyclomatic 23) · ×1
  • Parser.value (cyclomatic 23) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:94 — Parser.value 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 · Sampling.swift.sampleToken (cyclomatic 23) · ×1
  • Sampling.swift.sampleToken (cyclomatic 23) Sources/Qwen3TTS/Sampling.swift:36 — Sampling.swift.sampleToken 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 · SortformerStateUpdater.topKIndices (cyclomatic 23) · ×1
  • SortformerStateUpdater.topKIndices (cyclomatic 23) Sources/SpeechVAD/SortformerStateUpdater.swift:471 — SortformerStateUpdater.topKIndices 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 · VoiceChatSpeechDecoder.init (cyclomatic 23) · ×1
  • VoiceChatSpeechDecoder.init (cyclomatic 23) Sources/VoiceChat/VoiceChatSpeechDecoder.swift:91 — VoiceChatSpeechDecoder.init 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 · FullDuplexExpectedArguments.parse (cyclomatic 23) · ×1
  • FullDuplexExpectedArguments.parse (cyclomatic 23) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:337 — FullDuplexExpectedArguments.parse has cyclomatic complexity 23 (threshold 15). Of this number, 19 points are the body's own statements and 4 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · VoiceChatBench.run (cyclomatic 23) · ×1
  • VoiceChatBench.run (cyclomatic 23) Sources/VoiceChatBenchmark/VoiceChatBench.swift:175 — VoiceChatBench.run 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 · export_breeze_mlx.export (cyclomatic 23) · ×1
  • export_breeze_mlx.export (cyclomatic 23) scripts/export_breeze_mlx.py:47 — export_breeze_mlx.export 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 · validate_coreml.check (cyclomatic 23) · ×1
  • validate_coreml.check (cyclomatic 23) scripts/qwen3_tts_coreml/validate_coreml.py:73 — validate_coreml.check 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 · MultipartParser.parse (cyclomatic 22) · ×1
  • MultipartParser.parse (cyclomatic 22) Sources/AudioServer/OpenAITranscriptions.swift:263 — MultipartParser.parse 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 · ChatterboxFlashT3Graphs.generateSpeechTokens (cyclomatic 22) · ×1
  • ChatterboxFlashT3Graphs.generateSpeechTokens (cyclomatic 22) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:435 — ChatterboxFlashT3Graphs.generateSpeechTokens 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 · ChinesePhonemizer.syllableToIPA (cyclomatic 22) · ×1
  • ChinesePhonemizer.syllableToIPA (cyclomatic 22) Sources/KokoroTTS/ChinesePhonemizer.swift:146 — ChinesePhonemizer.syllableToIPA 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: ChinesePhonemizer.extractTone (cyclomatic 26) 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 · GermanPhonemizer.normalize (cyclomatic 22) · ×1
  • GermanPhonemizer.normalize (cyclomatic 22) Sources/KokoroTTS/GermanPhonemizer.swift:28 — GermanPhonemizer.normalize 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 · MossTTSNanoSampler.sample (cyclomatic 22) · ×1
  • MossTTSNanoSampler.sample (cyclomatic 22) Sources/MossTTSNano/MossTTSNanoSampling.swift:53 — MossTTSNanoSampler.sample 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 · Gemma4Chat.decode (cyclomatic 22) · ×1
  • Gemma4Chat.decode (cyclomatic 22) Sources/Qwen3Chat/Gemma4Chat.swift:253 — Gemma4Chat.decode has cyclomatic complexity 22 (threshold 15). To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Qwen3TTSModel.runStreamingGeneration (cyclomatic 22) · ×1
  • Qwen3TTSModel.runStreamingGeneration (cyclomatic 22) Sources/Qwen3TTS/Qwen3TTS.swift:411 — Qwen3TTSModel.runStreamingGeneration 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 · SupertonicTokenizer.preprocess (cyclomatic 22) · ×1
  • SupertonicTokenizer.preprocess (cyclomatic 22) Sources/SupertonicTTS/SupertonicTokenizer.swift:77 — SupertonicTokenizer.preprocess 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 · CosyVoiceTTSModel.fromPretrained (cyclomatic 21) · ×1
  • CosyVoiceTTSModel.fromPretrained (cyclomatic 21) Sources/CosyVoiceTTS/CosyVoiceTTS.swift:62 — CosyVoiceTTSModel.fromPretrained 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 · GermanPhonemizer.phonemize (cyclomatic 21) · ×1
  • GermanPhonemizer.phonemize (cyclomatic 21) Sources/KokoroTTS/GermanPhonemizer.swift:97 — GermanPhonemizer.phonemize has cyclomatic complexity 21 (threshold 15). Of this number, 19 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 · MossMLXModel.transcribeLocked (cyclomatic 21) · ×1
  • MossMLXModel.transcribeLocked (cyclomatic 21) Sources/MossTranscribe/MossMLXRuntime.swift:380 — MossMLXModel.transcribeLocked 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 · Sampling.swift.sampleTokensBatch (cyclomatic 21) · ×1
  • Sampling.swift.sampleTokensBatch (cyclomatic 21) Sources/Qwen3TTS/Sampling.swift:175 — Sampling.swift.sampleTokensBatch 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 · NpzReader.parseNpy (cyclomatic 21) · ×1
  • NpzReader.parseNpy (cyclomatic 21) Sources/SpeechEnhancement/WeightLoading.swift:145 — NpzReader.parseNpy 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 · StreamingVADProcessor.processProb (cyclomatic 21) · ×1
  • StreamingVADProcessor.processProb (cyclomatic 21) Sources/SpeechVAD/StreamingVADProcessor.swift:286 — StreamingVADProcessor.processProb 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 · WeightLoader.swift.loadStagesWeightsForDecoder (cyclomatic 21) · ×1
  • WeightLoader.swift.loadStagesWeightsForDecoder (cyclomatic 21) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:257 — WeightLoader.swift.loadStagesWeightsForDecoder 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 · VoiceChatBench.runCompletePipeline (cyclomatic 21) · ×1
  • VoiceChatBench.runCompletePipeline (cyclomatic 21) Sources/VoiceChatBenchmark/VoiceChatBench.swift:354 — VoiceChatBench.runCompletePipeline has cyclomatic complexity 21 (threshold 15). Of this number, 19 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 · VoiceChatBench.runFullDuplexToolScenario · ×1
  • VoiceChatBench.runFullDuplexToolScenario::observe (cyclomatic 21) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:1009 — VoiceChatBench.runFullDuplexToolScenario::observe 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 shape REPEATS in the file: one other method here (VoiceChatBench.runFullDuplexToolScenario) 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 · fish_drama3_reference.main (cyclomatic 21) · ×1
  • fish_drama3_reference.main (cyclomatic 21) scripts/fish_drama3_reference.py:20 — fish_drama3_reference.main 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 · VoiceChatDemoState.ingest (cyclomatic 20) · ×1
  • VoiceChatDemoState.ingest (cyclomatic 20) Sources/AudioCLILib/VoiceChatDemoSupport.swift:454 — VoiceChatDemoState.ingest 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 · VoiceChatMCPRuntime.appleEventKitProviderCall (cyclomatic 20) · ×1
  • VoiceChatMCPRuntime.appleEventKitProviderCall (cyclomatic 20) Sources/AudioCLILib/VoiceChatMCP.swift:742 — VoiceChatMCPRuntime.appleEventKitProviderCall 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 · BreezeTTSModel.generateStreaming (cyclomatic 20) · ×1
  • BreezeTTSModel.generateStreaming (cyclomatic 20) Sources/BreezeTTS/BreezeTTSModel.swift:159 — BreezeTTSModel.generateStreaming 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 · IndexTTS2Tokenizer.encode (cyclomatic 20) · ×1
  • IndexTTS2Tokenizer.encode (cyclomatic 20) Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:94 — IndexTTS2Tokenizer.encode 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 · Qwen3ASRModel.pickNextToken (cyclomatic 20) · ×1
  • Qwen3ASRModel.pickNextToken (cyclomatic 20) Sources/Qwen3ASR/Qwen3ASR.swift:1098 — Qwen3ASRModel.pickNextToken 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 · TimestampCorrection.enforceMonotonicity (cyclomatic 20) · ×1
  • TimestampCorrection.enforceMonotonicity (cyclomatic 20) Sources/Qwen3ASR/TimestampCorrection.swift:15 — TimestampCorrection.enforceMonotonicity 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 · Parser.string (cyclomatic 20) · ×1
  • Parser.string (cyclomatic 20) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:162 — Parser.string 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 · Community1Clustering.vbx (cyclomatic 20) · ×1
  • Community1Clustering.vbx (cyclomatic 20) Sources/SpeechVAD/Community1Clustering.swift:471 — Community1Clustering.vbx has cyclomatic complexity 20 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · FullDuplexExpectedAudio.parse (cyclomatic 20) · ×1
  • FullDuplexExpectedAudio.parse (cyclomatic 20) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:153 — FullDuplexExpectedAudio.parse has cyclomatic complexity 20 (threshold 15). Of this number, 12 points are the body's own statements and 8 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 · AsrBench.run (cyclomatic 19) · ×1
  • AsrBench.run (cyclomatic 19) Sources/AsrBenchmark/AsrBench.swift:44 — AsrBench.run 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 · WER.compute (cyclomatic 19) · ×1
  • WER.compute (cyclomatic 19) Sources/AsrBenchmark/WER.swift:30 — WER.compute 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 · StreamingAudioPlayer.startCompletionPolling (cyclomatic 19) · ×1
  • StreamingAudioPlayer.startCompletionPolling (cyclomatic 19) Sources/AudioCommon/StreamingAudioPlayer.swift:345 — StreamingAudioPlayer.startCompletionPolling 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 · ChatterboxFlashT3Graphs.denoiseBlockStep (cyclomatic 19) · ×1
  • ChatterboxFlashT3Graphs.denoiseBlockStep (cyclomatic 19) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:686 — ChatterboxFlashT3Graphs.denoiseBlockStep 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 · IndicMioSampler.sample (cyclomatic 19) · ×1
  • IndicMioSampler.sample (cyclomatic 19) Sources/IndicMioTTS/IndicMioSampler.swift:4 — IndicMioSampler.sample 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 · GermanPhonemizer.compound (cyclomatic 19) · ×1
  • GermanPhonemizer.compound (cyclomatic 19) Sources/KokoroTTS/GermanPhonemizer.swift:1122 — GermanPhonemizer.compound 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 · JapanesePhonemizer.phonemize (cyclomatic 19) · ×1
  • JapanesePhonemizer.phonemize (cyclomatic 19) Sources/KokoroTTS/JapanesePhonemizer.swift:85 — JapanesePhonemizer.phonemize 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 · MossTTSNanoTokenizer.init (cyclomatic 19) · ×1
  • MossTTSNanoTokenizer.init (cyclomatic 19) Sources/MossTTSNano/MossTTSNanoTokenizer.swift:19 — MossTTSNanoTokenizer.init 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 · PocketTtsMimiKeys.discover (cyclomatic 19) · ×1
  • PocketTtsMimiKeys.discover (cyclomatic 19) Sources/PocketTTS/PocketTtsMimiKeys.swift:58 — PocketTtsMimiKeys.discover 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 · Community1Clustering.centroidLinkageLabels (cyclomatic 19) · ×1
  • Community1Clustering.centroidLinkageLabels (cyclomatic 19) Sources/SpeechVAD/Community1Clustering.swift:333 — Community1Clustering.centroidLinkageLabels has cyclomatic complexity 19 (threshold 15). Of this number, 16 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · Nemotron3ArtifactConfiguration.validate (cyclomatic 19) · ×1
  • Nemotron3ArtifactConfiguration.validate (cyclomatic 19) Sources/SpeechVAD/Nemotron3Diarizer.swift:63 — Nemotron3ArtifactConfiguration.validate 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 · SupertonicTokenizer.bisect (cyclomatic 19) · ×1
  • SupertonicTokenizer.bisect (cyclomatic 19) Sources/SupertonicTTS/SupertonicTokenizer.swift:249 — SupertonicTokenizer.bisect 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 · AudioServer.swift.dispatchSynthesize (cyclomatic 18) · ×1
  • AudioServer.swift.dispatchSynthesize (cyclomatic 18) Sources/AudioServer/AudioServer.swift:1793 — AudioServer.swift.dispatchSynthesize 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 · OpenAISpeech.swift.handleOpenAISpeech (cyclomatic 18) · ×1
  • OpenAISpeech.swift.handleOpenAISpeech (cyclomatic 18) Sources/AudioServer/OpenAISpeech.swift:133 — OpenAISpeech.swift.handleOpenAISpeech 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 · OpenAITranscriptions.swift.handleOpenAITranscriptions (cyclomatic 18) · ×1
  • OpenAITranscriptions.swift.handleOpenAITranscriptions (cyclomatic 18) Sources/AudioServer/OpenAITranscriptions.swift:22 — OpenAITranscriptions.swift.handleOpenAITranscriptions 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 · ChatterboxFlashNumpy.parseFloat32Vector (cyclomatic 18) · ×1
  • ChatterboxFlashNumpy.parseFloat32Vector (cyclomatic 18) Sources/ChatterboxTTS/ChatterboxFlashNumpy.swift:9 — ChatterboxFlashNumpy.parseFloat32Vector 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 · SortformerTuning.init (cyclomatic 18) · ×1
  • SortformerTuning.init (cyclomatic 18) Sources/DiarizationBenchmark/DiarizationBench.swift:225 — SortformerTuning.init 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: DiarizationBench.swift.makeDiarizationEngine (cyclomatic 19) 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 · FishAudioDrama3Prompt.build (cyclomatic 18) · ×1
  • FishAudioDrama3Prompt.build (cyclomatic 18) Sources/FishAudioTTS/FishAudioDrama3Prompt.swift:36 — FishAudioDrama3Prompt.build has cyclomatic complexity 18 (threshold 15). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (appendCodes, appendText). 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 · FishAudioSampler.sample (cyclomatic 18) · ×1
  • FishAudioSampler.sample (cyclomatic 18) Sources/FishAudioTTS/FishAudioGeneration.swift:48 — FishAudioSampler.sample 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 · HiggsTTSCodec.init (cyclomatic 18) · ×1
  • HiggsTTSCodec.init (cyclomatic 18) Sources/HiggsTTS/HiggsTTSCodec.swift:23 — HiggsTTSCodec.init 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 · GermanPhonemizer.findNuclei (cyclomatic 18) · ×1
  • GermanPhonemizer.findNuclei (cyclomatic 18) Sources/KokoroTTS/GermanPhonemizer.swift:410 — GermanPhonemizer.findNuclei 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 · MADLADTranslator.swift.sampleWithTemperature (cyclomatic 18) · ×1
  • MADLADTranslator.swift.sampleWithTemperature (cyclomatic 18) Sources/MADLADTranslation/MADLADTranslator.swift:303 — MADLADTranslator.swift.sampleWithTemperature 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 · PocketSession.frame (cyclomatic 18) · ×1
  • PocketSession.frame (cyclomatic 18) Sources/PocketTTS/PocketTTSModel.swift:198 — PocketSession.frame 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 · Gemma4Tokenizer.load (cyclomatic 18) · ×1
  • Gemma4Tokenizer.load (cyclomatic 18) Sources/Qwen3Chat/Gemma4Tokenizer.swift:39 — Gemma4Tokenizer.load 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 · EmbeddingFile.read (cyclomatic 18) · ×1
  • EmbeddingFile.read (cyclomatic 18) Sources/Qwen3TTSCoreML/BundleConfiguration.swift:68 — EmbeddingFile.read has cyclomatic complexity 18 (threshold 15). Of this number, 15 points are the body's own statements and 3 belong to one function item inside it that branches. To reduce it, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · StreamingKwsDecoder.step (cyclomatic 18) · ×1
  • StreamingKwsDecoder.step (cyclomatic 18) Sources/SpeechWakeWord/StreamingKwsDecoder.swift:166 — StreamingKwsDecoder.step 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 · SupertonicTokenizer.chunk (cyclomatic 18) · ×1
  • SupertonicTokenizer.chunk (cyclomatic 18) Sources/SupertonicTTS/SupertonicTokenizer.swift:171 — SupertonicTokenizer.chunk has cyclomatic complexity 18 (threshold 15). Of this number, 11 points are the body's own statements and 7 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 · VibeVoiceTTSModel.encodeVoice (cyclomatic 18) · ×1
  • VibeVoiceTTSModel.encodeVoice (cyclomatic 18) Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:201 — VibeVoiceTTSModel.encodeVoice 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 · BreezeTTSBenchmark.run (cyclomatic 18) · ×1
  • BreezeTTSBenchmark.run (cyclomatic 18) scripts/profiling/BreezeTTSBenchmark.swift:32 — BreezeTTSBenchmark.run has cyclomatic complexity 18 (threshold 15). Of this number, 16 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 · profile_gliner_memory.main (cyclomatic 18) · ×1
  • profile_gliner_memory.main (cyclomatic 18) scripts/profile_gliner_memory.py:70 — profile_gliner_memory.main 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 · profile_fish_drama3.main (cyclomatic 18) · ×1
  • profile_fish_drama3.main (cyclomatic 18) scripts/profiling/profile_fish_drama3.py:152 — profile_fish_drama3.main 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 · SpeakCommand.runFishDrama3 (cyclomatic 17) · ×1
  • SpeakCommand.runFishDrama3 (cyclomatic 17) Sources/AudioCLILib/SpeakCommand.swift:1216 — SpeakCommand.runFishDrama3 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 · VoiceChatCommand.runFile (cyclomatic 17) · ×1
  • VoiceChatCommand.runFile (cyclomatic 17) Sources/AudioCLILib/VoiceChatCommand.swift:370 — VoiceChatCommand.runFile 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 · AudioFileLoader.convertDrained (cyclomatic 17) · ×1
  • AudioFileLoader.convertDrained (cyclomatic 17) Sources/AudioCommon/AudioFileLoader.swift:354 — AudioFileLoader.convertDrained 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 · AudioFileChunkReader.produceSamples (cyclomatic 17) · ×1
  • AudioFileChunkReader.produceSamples (cyclomatic 17) Sources/AudioCommon/AudioFileStream.swift:182 — AudioFileChunkReader.produceSamples 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 · SystemAudioTap.handleInput (cyclomatic 17) · ×1
  • SystemAudioTap.handleInput (cyclomatic 17) Sources/AudioCommon/SystemAudioTap.swift:346 — SystemAudioTap.handleInput 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 · AudioServer.swift.parseRealtimeTurnDetection (cyclomatic 17) · ×1
  • AudioServer.swift.parseRealtimeTurnDetection (cyclomatic 17) Sources/AudioServer/AudioServer.swift:860 — AudioServer.swift.parseRealtimeTurnDetection 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 · CosyVoiceTTSModel.synthesize (cyclomatic 17) · ×1
  • CosyVoiceTTSModel.synthesize (cyclomatic 17) Sources/CosyVoiceTTS/CosyVoiceTTS.swift:283 — CosyVoiceTTSModel.synthesize 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 · CosyVoiceTTSModel.splitForLongForm (cyclomatic 17) · ×1
  • CosyVoiceTTSModel.splitForLongForm (cyclomatic 17) Sources/CosyVoiceTTS/VoiceCloning.swift:309 — CosyVoiceTTSModel.splitForLongForm 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 · DiarizationBench.swift.maximumJaccardAssignment (cyclomatic 17) · ×1
  • DiarizationBench.swift.maximumJaccardAssignment (cyclomatic 17) Sources/DiarizationBenchmark/DiarizationBench.swift:900 — DiarizationBench.swift.maximumJaccardAssignment has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top. This is NOT this file's highest cyclomatic complexity: DiarizationBench.swift.makeDiarizationEngine (cyclomatic 19) 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 · BenchmarkOptions.parse (cyclomatic 17) · ×1
  • BenchmarkOptions.parse (cyclomatic 17) Sources/GLiNERBenchmark/Options.swift:11 — BenchmarkOptions.parse 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 · GermanPhonemizer.expandAbbreviations (cyclomatic 17) · ×1
  • GermanPhonemizer.expandAbbreviations (cyclomatic 17) Sources/KokoroTTS/GermanPhonemizer.swift:867 — GermanPhonemizer.expandAbbreviations 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 · MagpieTTSCoreML.synthesize (cyclomatic 17) · ×1
  • MagpieTTSCoreML.synthesize (cyclomatic 17) Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:180 — MagpieTTSCoreML.synthesize 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 · MossTTSNanoModel.encodeReference (cyclomatic 17) · ×1
  • MossTTSNanoModel.encodeReference (cyclomatic 17) Sources/MossTTSNano/MossTTSNanoModel.swift:60 — MossTTSNanoModel.encodeReference 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 · MossTranscribeModel.transcribeLocked (cyclomatic 17) · ×1
  • MossTranscribeModel.transcribeLocked (cyclomatic 17) Sources/MossTranscribe/MossCoreMLRuntime.swift:605 — MossTranscribeModel.transcribeLocked 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 · NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting (cyclomatic 17) · ×1
  • NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting (cyclomatic 17) Sources/NemotronStreamingASR/SentencePieceUnigramTokenizer.swift:63 — NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting 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 · Mimi.sanitizeWeights (cyclomatic 17) · ×1
  • Mimi.sanitizeWeights (cyclomatic 17) Sources/PersonaPlex/MimiCodec.swift:113 — Mimi.sanitizeWeights 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 · CoreMLForcedAligner.align (cyclomatic 17) · ×1
  • CoreMLForcedAligner.align (cyclomatic 17) Sources/Qwen3ASR/CoreMLForcedAligner.swift:163 — CoreMLForcedAligner.align 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 · ChatSampler.sampleOnDevice (cyclomatic 17) · ×1
  • ChatSampler.sampleOnDevice (cyclomatic 17) Sources/Qwen3Chat/ChatSamplerMLX.swift:43 — ChatSampler.sampleOnDevice 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 · JSONPattern.compile (cyclomatic 17) · ×1
  • JSONPattern.compile (cyclomatic 17) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:62 — JSONPattern.compile 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 · RegexParser.bracket (cyclomatic 17) · ×1
  • RegexParser.bracket (cyclomatic 17) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:327 — RegexParser.bracket 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 · Parser.number (cyclomatic 17) · ×1
  • Parser.number (cyclomatic 17) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:139 — Parser.number has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · Qwen3TTSModel.synthesizeWithVoiceCloneICL (cyclomatic 17) · ×1
  • Qwen3TTSModel.synthesizeWithVoiceCloneICL (cyclomatic 17) Sources/Qwen3TTS/Qwen3TTS+ICL.swift:77 — Qwen3TTSModel.synthesizeWithVoiceCloneICL 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 · LanguageIDModelConfiguration.validate (cyclomatic 17) · ×1
  • LanguageIDModelConfiguration.validate (cyclomatic 17) Sources/SpeechLanguageID/LanguageIDTypes.swift:128 — LanguageIDModelConfiguration.validate 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 · Community1PLDA.load (cyclomatic 17) · ×1
  • Community1PLDA.load (cyclomatic 17) Sources/SpeechVAD/Community1Clustering.swift:15 — Community1PLDA.load has cyclomatic complexity 17 (threshold 15). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (tensor). 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 · DERScoring.swift.maximumWeightAssignment (cyclomatic 17) · ×1
  • DERScoring.swift.maximumWeightAssignment (cyclomatic 17) Sources/SpeechVAD/DERScoring.swift:346 — DERScoring.swift.maximumWeightAssignment has cyclomatic complexity 17 (threshold 15). Of this number, 15 points are the body's own statements and 2 belong to one function item inside it that branches. To reduce it, separate the cases: extract each independent branch into its own named function, and where the body has guards that only reject input, fold those into early returns at the top.
D1 · Cyclomatic Complexity · DPMSolverMultistepScheduler.step (cyclomatic 17) · ×1
  • DPMSolverMultistepScheduler.step (cyclomatic 17) Sources/VibeVoiceTTS/Inference/DPMSolver.swift:250 — DPMSolverMultistepScheduler.step 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 · VoiceChatMCPConfiguration.selectedServers (cyclomatic 16) · ×1
  • VoiceChatMCPConfiguration.selectedServers (cyclomatic 16) Sources/AudioCLILib/VoiceChatMCP.swift:122 — VoiceChatMCPConfiguration.selectedServers 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 · AudioFileChunkReader.init (cyclomatic 16) · ×1
  • AudioFileChunkReader.init (cyclomatic 16) Sources/AudioCommon/AudioFileStream.swift:98 — AudioFileChunkReader.init 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 · S3GenVocoder.swift.s3Istft (cyclomatic 16) · ×1
  • S3GenVocoder.swift.s3Istft (cyclomatic 16) Sources/ChatterboxTTS/S3GenVocoder.swift:397 — S3GenVocoder.swift.s3Istft 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 · DiarizationBench.runEngine (cyclomatic 16) · ×1
  • DiarizationBench.runEngine (cyclomatic 16) Sources/DiarizationBenchmark/DiarizationBench.swift:83 — DiarizationBench.runEngine 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: DiarizationBench.swift.makeDiarizationEngine (cyclomatic 19) 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 · GermanPhonemizer.intToDe (cyclomatic 16) · ×1
  • GermanPhonemizer.intToDe (cyclomatic 16) Sources/KokoroTTS/GermanPhonemizer.swift:731 — GermanPhonemizer.intToDe 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 · MagpieJapaneseG2P.phonemes (cyclomatic 16) · ×1
  • MagpieJapaneseG2P.phonemes (cyclomatic 16) Sources/MagpieTTS/JapaneseG2P.swift:74 — MagpieJapaneseG2P.phonemes 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 · LanguageGuideContext.makeMask (cyclomatic 16) · ×1
  • LanguageGuideContext.makeMask (cyclomatic 16) Sources/NemotronStreamingASR/LanguageGuide.swift:59 — LanguageGuideContext.makeMask 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 · NemotronVocabulary.encodingsForWordBoosting (cyclomatic 16) · ×1
  • NemotronVocabulary.encodingsForWordBoosting (cyclomatic 16) Sources/NemotronStreamingASR/Vocabulary.swift:132 — NemotronVocabulary.encodingsForWordBoosting has cyclomatic complexity 16 (threshold 15). Most of this is not in the body itself: 7 of the 16 points are its own statements and the rest belongs to one function item inside it that branches (collect). 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 · StreamingSession.processChunk (cyclomatic 16) · ×1
  • StreamingSession.processChunk (cyclomatic 16) Sources/ParakeetStreamingASR/StreamingSession.swift:255 — StreamingSession.processChunk 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 · PocketTTSTokenizer.encode (cyclomatic 16) · ×1
  • PocketTTSTokenizer.encode (cyclomatic 16) Sources/PocketTTS/PocketTTSTokenizer.swift:22 — PocketTTSTokenizer.encode 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 · Gemma4ToolCodec.response (cyclomatic 16) · ×1
  • Gemma4ToolCodec.response (cyclomatic 16) Sources/Qwen3Chat/Gemma4Tools.swift:220 — Gemma4ToolCodec.response 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 · TextChunker.findNaturalBreak (cyclomatic 16) · ×1
  • TextChunker.findNaturalBreak (cyclomatic 16) Sources/Qwen3TTS/TextChunker.swift:52 — TextChunker.findNaturalBreak 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 · NpzReader.read (cyclomatic 16) · ×1
  • NpzReader.read (cyclomatic 16) Sources/SpeechEnhancement/WeightLoading.swift:86 — NpzReader.read 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 · DiarizationHelpers.constrainedAgglomerativeClustering (cyclomatic 16) · ×1
  • DiarizationHelpers.constrainedAgglomerativeClustering (cyclomatic 16) Sources/SpeechVAD/DiarizationHelpers.swift:113 — DiarizationHelpers.constrainedAgglomerativeClustering has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D1 · Cyclomatic Complexity · FullDuplexExpectedReply.parse (cyclomatic 16) · ×1
  • FullDuplexExpectedReply.parse (cyclomatic 16) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:259 — FullDuplexExpectedReply.parse 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, split the body: these branches sit side by side rather than nested inside one another, so extracting each one on its own would leave a function per branch. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D1 · Cyclomatic Complexity · RuntimeOwnershipStress.main (cyclomatic 16) · ×1
  • RuntimeOwnershipStress.main (cyclomatic 16) scripts/profiling/RuntimeOwnershipStress.swift:16 — RuntimeOwnershipStress.main has cyclomatic complexity 16 (threshold 15). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D15 · Churn × Complexity Hotspots · Repeated repair · ×1
  • Repeated repair: Sources/Qwen3ASR/CoreMLEncoder.swift Sources/Qwen3ASR/CoreMLEncoder.swift:148 — Sources/Qwen3ASR/CoreMLEncoder.swift changed 5 times in last 90 days and 4 of those changes were fix/bug commits, so repair is the majority of this file's churn. Its max cyclomatic complexity is 7 (its worst body is CoreMLASREncoder.encodeRaw at line 148), UNDER the 15 threshold, so this is deliberately not filed as a churn × complexity hotspot — the difficulty here is in the behaviour the file has to get right, not in its control flow, and refactoring it for complexity would be the wrong move. The repairs counted were: “fix(qwen3-asr): make cooperative cancellation an explicit throwing API”; “fix(qwen3-asr): stop dtype fallbacks reinterpreting CoreML buffers”; “test(qwen3-asr): pin the CoreML embedding fixes against regression”; “fix(qwen3-asr): read CoreML audio embeddings as Float16”. Each one is a case this code did not handle. Before the next change lands here, check that every one of them is pinned by a test that fails without its fix; where the same area keeps coming back, the durable fix is usually at the interface that keeps being misused rather than at the line that was last corrected. Counted over 2026-07-29..2026-10-27, the 90 days ending at the analysed commit. Reproduce with `git log --since='2026-07-29 10:39:33 +01:00' --until='2026-10-27 10:39:33 +01:00' --full-history --no-merges -- Sources/Qwen3ASR/CoreMLEncoder.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.
D2 · Cognitive Complexity · AudioServer.swift.handleRealtimeWS (cognitive 309) · ×1
  • AudioServer.swift.handleRealtimeWS (cognitive 309) Sources/AudioServer/AudioServer.swift:968 — AudioServer.swift.handleRealtimeWS has cognitive complexity 309 (threshold 15). Drivers by points: if/else 50 (210 pts), loops 9 (40 pts), match/switch 5 (25 pts), boolean chains 23, error handling 3 (6 pts), ternaries 1 (5 pts) (nesting depth added 218). 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 · PersonaPlexModel.respondStream (cognitive 196) · ×1
  • PersonaPlexModel.respondStream (cognitive 196) Sources/PersonaPlex/PersonaPlex.swift:618 — PersonaPlexModel.respondStream has cognitive complexity 196 (threshold 15). Drivers by points: if/else 29 (94 pts), loops 25 (73 pts), ternaries 5 (20 pts), boolean chains 6, error handling 2 (3 pts) (nesting depth added 129). 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 · SpeakCommand.validate (cognitive 185) · ×1
  • SpeakCommand.validate (cognitive 185) Sources/AudioCLILib/SpeakCommand.swift:391 — SpeakCommand.validate has cognitive complexity 185 (threshold 15). Drivers by points: if/else 70 (127 pts), boolean chains 51, match/switch 1 (4 pts), loops 1 (3 pts) (nesting depth added 62). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GermanPhonemizer.normalizeNumbers (cognitive 168) · ×1
  • GermanPhonemizer.normalizeNumbers (cognitive 168) Sources/KokoroTTS/GermanPhonemizer.swift:901 — GermanPhonemizer.normalizeNumbers has cognitive complexity 168 (threshold 15). Drivers by points: if/else 29 (84 pts), boolean chains 53, loops 7 (20 pts), ternaries 3 (11 pts) (nesting depth added 76). Of this number, 162 points are the body's own statements and 6 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 · PersonaPlexModel.respond (cognitive 140) · ×1
  • PersonaPlexModel.respond (cognitive 140) Sources/PersonaPlex/PersonaPlex.swift:127 — PersonaPlexModel.respond has cognitive complexity 140 (threshold 15). Drivers by points: if/else 32 (68 pts), loops 26 (49 pts), ternaries 5 (15 pts), boolean chains 7, error handling 1 (nesting depth added 69). 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 · PersonaPlexModel.respondRealtime (cognitive 130) · ×1
  • PersonaPlexModel.respondRealtime (cognitive 130) Sources/PersonaPlex/PersonaPlex.swift:1012 — PersonaPlexModel.respondRealtime has cognitive complexity 130 (threshold 15). Drivers by points: loops 22 (65 pts), if/else 14 (39 pts), ternaries 5 (18 pts), boolean chains 4, error handling 3 (4 pts) (nesting depth added 82). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · GermanPhonemizer.mapConsonants (cognitive 110) · ×1
  • GermanPhonemizer.mapConsonants (cognitive 110) Sources/KokoroTTS/GermanPhonemizer.swift:514 — GermanPhonemizer.mapConsonants has cognitive complexity 110 (threshold 15). Drivers by points: if/else 26 (49 pts), ternaries 11 (34 pts), boolean chains 23, loops 2, match/switch 1 (2 pts) (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceChatSession.advance (cognitive 98) · ×1
  • VoiceChatSession.advance (cognitive 98) Sources/VoiceChat/VoiceChatSession.swift:946 — VoiceChatSession.advance has cognitive complexity 98 (threshold 15). Drivers by points: if/else 40 (62 pts), boolean chains 24, ternaries 8 (12 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 · PersonaPlexModel.respondDiagnostic (cognitive 96) · ×1
  • PersonaPlexModel.respondDiagnostic (cognitive 96) Sources/PersonaPlex/PersonaPlex.swift:1332 — PersonaPlexModel.respondDiagnostic has cognitive complexity 96 (threshold 15). Drivers by points: loops 24 (44 pts), if/else 14 (34 pts), ternaries 4 (11 pts), boolean chains 6, error handling 1 (nesting depth added 47). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization (cognitive 94) · ×1
  • PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization (cognitive 94) Sources/SpeechVAD/DiarizationPipeline.swift:310 — PyannoteDiarizationPipeline.runEmbeddingClusteredDiarization has cognitive complexity 94 (threshold 15). Drivers by points: if/else 19 (53 pts), loops 14 (32 pts), ternaries 4 (8 pts), boolean chains 1 (nesting depth added 56). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONSchemaMatcher.feedString (cognitive 80) · ×1
  • JSONSchemaMatcher.feedString (cognitive 80) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:282 — JSONSchemaMatcher.feedString has cognitive complexity 80 (threshold 15). Drivers by points: if/else 28 (59 pts), match/switch 4 (8 pts), boolean chains 7, ternaries 2 (6 pts) (nesting depth added 39). Of this number, 73 points are the body's own statements and 7 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONSchemaMatcher.feed (cognitive 73) · ×1
  • JSONSchemaMatcher.feed (cognitive 73) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:73 — JSONSchemaMatcher.feed has cognitive complexity 73 (threshold 15). Drivers by points: if/else 25 (60 pts), loops 3 (6 pts), boolean chains 4, match/switch 2 (3 pts) (nesting depth added 39). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WienerFilter.emWiener (cognitive 73) · ×1
  • WienerFilter.emWiener (cognitive 73) Sources/SourceSeparation/WienerFilter.swift:73 — WienerFilter.emWiener has cognitive complexity 73 (threshold 15). Drivers by points: loops 19 (47 pts), ternaries 4 (16 pts), if/else 3 (10 pts) (nesting depth added 47). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · KokoroPhonemizer.bartG2P (cognitive 72) · ×1
  • KokoroPhonemizer.bartG2P (cognitive 72) Sources/KokoroTTS/Phonemizer.swift:510 — KokoroPhonemizer.bartG2P has cognitive complexity 72 (threshold 15). Drivers by points: if/else 14 (32 pts), loops 10 (28 pts), ternaries 2 (7 pts), boolean chains 4, error handling 1 (nesting depth added 41). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3TTSCoreMLModel.synthesize (cognitive 72) · ×1
  • Qwen3TTSCoreMLModel.synthesize (cognitive 72) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:220 — Qwen3TTSCoreMLModel.synthesize has cognitive complexity 72 (threshold 15). Drivers by points: loops 13 (26 pts), if/else 16 (24 pts), boolean chains 16, ternaries 3 (6 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 · StreamingASR.transcribeStream (cognitive 70) · ×1
  • StreamingASR.transcribeStream (cognitive 70) Sources/Qwen3ASR/StreamingASR.swift:85 — StreamingASR.transcribeStream has cognitive complexity 70 (threshold 15). Drivers by points: if/else 19 (60 pts), loops 3 (4 pts), boolean chains 3, match/switch 1 (3 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 · ChatSampler.sample (cognitive 69) · ×1
  • ChatSampler.sample (cognitive 69) Sources/Qwen3Chat/ChatSampler.swift:31 — ChatSampler.sample has cognitive complexity 69 (threshold 15). Drivers by points: if/else 17 (39 pts), loops 11 (22 pts), ternaries 3 (5 pts), boolean chains 3 (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 · VoiceChatCommand.runMicrophone (cognitive 68) · ×1
  • VoiceChatCommand.runMicrophone (cognitive 68) Sources/AudioCLILib/VoiceChatCommand.swift:473 — VoiceChatCommand.runMicrophone has cognitive complexity 68 (threshold 15). Drivers by points: if/else 20 (45 pts), boolean chains 14, loops 2 (5 pts), ternaries 1 (3 pts), error handling 1 (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 · VoiceChatBench.runFullDuplexToolScenario (cognitive 68) · ×1
  • VoiceChatBench.runFullDuplexToolScenario (cognitive 68) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:886 — VoiceChatBench.runFullDuplexToolScenario has cognitive complexity 68 (threshold 15). Drivers by points: if/else 50 (63 pts), boolean chains 28, loops 3, ternaries 1 (3 pts) (nesting depth added 15). 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. This shape REPEATS in the file: one other method here (VoiceChatBench.runFullDuplexToolScenario::observe) 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 · SpeakCommand.runCosyVoice (cognitive 67) · ×1
  • SpeakCommand.runCosyVoice (cognitive 67) Sources/AudioCLILib/SpeakCommand.swift:1898 — SpeakCommand.runCosyVoice has cognitive complexity 67 (threshold 15). Drivers by points: if/else 28 (50 pts), loops 5 (12 pts), boolean chains 5 (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 · BreezeTTSConfig.validate (cognitive 59) · ×1
  • BreezeTTSConfig.validate (cognitive 59) Sources/BreezeTTS/Options.swift:70 — BreezeTTSConfig.validate has cognitive complexity 59 (threshold 15). Drivers by points: boolean chains 40, if/else 9 (16 pts), loops 3 (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 · RespondCommand.run (cognitive 58) · ×1
  • RespondCommand.run (cognitive 58) Sources/AudioCLILib/RespondCommand.swift:94 — RespondCommand.run has cognitive complexity 58 (threshold 15). Drivers by points: if/else 34 (45 pts), loops 5 (10 pts), boolean chains 2, ternaries 1 (nesting depth added 16). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · FishAudioDrama3Config.parse (cognitive 58) · ×1
  • FishAudioDrama3Config.parse (cognitive 58) Sources/FishAudioTTS/FishAudioDrama3Config.swift:39 — FishAudioDrama3Config.parse has cognitive complexity 58 (threshold 15). Drivers by points: boolean chains 47, if/else 9, loops 2. Of this number, 44 points are the body's own statements and 14 belong to 5 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 · GermanPhonemizer.vowelPhoneme (cognitive 56) · ×1
  • GermanPhonemizer.vowelPhoneme (cognitive 56) Sources/KokoroTTS/GermanPhonemizer.swift:448 — GermanPhonemizer.vowelPhoneme has cognitive complexity 56 (threshold 15). Drivers by points: boolean chains 25, if/else 18 (25 pts), ternaries 2 (6 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 · VibeVoiceQuantizer.quantizeAndSave (cognitive 56) · ×1
  • VibeVoiceQuantizer.quantizeAndSave (cognitive 56) Sources/VibeVoiceTTS/Quantization/VibeVoiceQuantization.swift:117 — VibeVoiceQuantizer.quantizeAndSave has cognitive complexity 56 (threshold 15). Drivers by points: if/else 20 (40 pts), boolean chains 11, loops 3 (4 pts), error handling 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioServer.buildRouter (cognitive 54) · ×1
  • AudioServer.buildRouter (cognitive 54) Sources/AudioServer/AudioServer.swift:90 — AudioServer.buildRouter has cognitive complexity 54 (threshold 15). Drivers by points: if/else 28 (35 pts), boolean chains 8, error handling 8, ternaries 1 (2 pts), match/switch 1 (nesting depth added 8). Of this number, 53 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · Gemma4ToolCodec.prompt (cognitive 53) · ×1
  • Gemma4ToolCodec.prompt (cognitive 53) Sources/Qwen3Chat/Gemma4Tools.swift:153 — Gemma4ToolCodec.prompt has cognitive complexity 53 (threshold 15). Drivers by points: if/else 15 (34 pts), loops 4 (9 pts), boolean chains 7, ternaries 2 (3 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 · HibikiTranslateModel.translate (cognitive 47) · ×1
  • HibikiTranslateModel.translate (cognitive 47) Sources/HibikiTranslate/HibikiTranslate.swift:41 — HibikiTranslateModel.translate has cognitive complexity 47 (threshold 15). Drivers by points: if/else 13 (22 pts), loops 9 (13 pts), ternaries 4 (9 pts), boolean chains 3 (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 · SortformerStateUpdater.topKIndices (cognitive 47) · ×1
  • SortformerStateUpdater.topKIndices (cognitive 47) Sources/SpeechVAD/SortformerStateUpdater.swift:471 — SortformerStateUpdater.topKIndices has cognitive complexity 47 (threshold 15). Drivers by points: if/else 9 (23 pts), loops 9 (16 pts), boolean chains 6, ternaries 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.
D2 · Cognitive Complexity · VoxCPM2TTSModel.generateVoxCPM2 (cognitive 47) · ×1
  • VoxCPM2TTSModel.generateVoxCPM2 (cognitive 47) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1149 — VoxCPM2TTSModel.generateVoxCPM2 has cognitive complexity 47 (threshold 15). Drivers by points: if/else 23 (31 pts), boolean chains 8, ternaries 5, loops 2 (3 pts) (nesting depth added 9). Of this number, 44 points are the body's own statements and 3 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 · JSONSchemaMatcher.feedObject (cognitive 46) · ×1
  • JSONSchemaMatcher.feedObject (cognitive 46) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:188 — JSONSchemaMatcher.feedObject has cognitive complexity 46 (threshold 15). Drivers by points: if/else 20 (42 pts), boolean chains 3, match/switch 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 · ChatterboxFlashT3Graphs.generateSpeechTokens (cognitive 45) · ×1
  • ChatterboxFlashT3Graphs.generateSpeechTokens (cognitive 45) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:435 — ChatterboxFlashT3Graphs.generateSpeechTokens has cognitive complexity 45 (threshold 15). Drivers by points: if/else 13 (34 pts), loops 3 (6 pts), boolean chains 5 (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 · HTDemucs.init (cognitive 45) · ×1
  • HTDemucs.init (cognitive 45) Sources/SourceSeparation/HTDemucs/HTDemucs.swift:35 — HTDemucs.init has cognitive complexity 45 (threshold 15). Drivers by points: ternaries 11 (24 pts), if/else 11 (18 pts), boolean chains 2, loops 1 (nesting depth added 20). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Community1Clustering.vbx (cognitive 45) · ×1
  • Community1Clustering.vbx (cognitive 45) Sources/SpeechVAD/Community1Clustering.swift:471 — Community1Clustering.vbx has cognitive complexity 45 (threshold 15). Drivers by points: loops 16 (40 pts), if/else 1 (2 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 26). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TranscribeCommand.validate (cognitive 44) · ×1
  • TranscribeCommand.validate (cognitive 44) Sources/AudioCLILib/TranscribeCommand.swift:73 — TranscribeCommand.validate has cognitive complexity 44 (threshold 15). Drivers by points: if/else 19 (35 pts), boolean chains 9 (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 · GermanPhonemizer.g2pLower (cognitive 44) · ×1
  • GermanPhonemizer.g2pLower (cognitive 44) Sources/KokoroTTS/GermanPhonemizer.swift:655 — GermanPhonemizer.g2pLower has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (27 pts), boolean chains 12, loops 2 (3 pts), ternaries 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 · Parser.parseValue (cognitive 44) · ×1
  • Parser.parseValue (cognitive 44) Sources/Qwen3Chat/Gemma4Tools.swift:303 — Parser.parseValue has cognitive complexity 44 (threshold 15). Drivers by points: if/else 15 (25 pts), boolean chains 10, loops 4 (9 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 · VoiceChatCommand.validate (cognitive 43) · ×1
  • VoiceChatCommand.validate (cognitive 43) Sources/AudioCLILib/VoiceChatCommand.swift:140 — VoiceChatCommand.validate has cognitive complexity 43 (threshold 15). Drivers by points: if/else 21 (23 pts), boolean chains 20 (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 · FishDrama3Benchmark.run (cognitive 43) · ×1
  • FishDrama3Benchmark.run (cognitive 43) scripts/profiling/FishDrama3Benchmark.swift:43 — FishDrama3Benchmark.run has cognitive complexity 43 (threshold 15). Drivers by points: if/else 14 (26 pts), ternaries 7 (9 pts), boolean chains 7, loops 1 (nesting depth added 14). Of this number, 41 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 · KokoroPhonemizer.phonemizeWithDict (cognitive 42) · ×1
  • KokoroPhonemizer.phonemizeWithDict (cognitive 42) Sources/KokoroTTS/Phonemizer.swift:249 — KokoroPhonemizer.phonemizeWithDict has cognitive complexity 42 (threshold 15). Drivers by points: if/else 11 (25 pts), loops 6 (10 pts), boolean chains 7 (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 · FullDuplexAcousticAnalyzer.analyze (cognitive 42) · ×1
  • FullDuplexAcousticAnalyzer.analyze (cognitive 42) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:621 — FullDuplexAcousticAnalyzer.analyze has cognitive complexity 42 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 6 (12 pts), boolean chains 7, ternaries 7 (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 · convert_coreml.main (cognitive 42) · ×1
  • convert_coreml.main (cognitive 42) scripts/qwen3_tts_coreml/convert_coreml.py:562 — convert_coreml.main has cognitive complexity 42 (threshold 15). Drivers by points: if/else 19 (27 pts), loops 4 (8 pts), ternaries 4 (6 pts), boolean chains 1 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CosyVoiceTTSModel.fromPretrained (cognitive 41) · ×1
  • CosyVoiceTTSModel.fromPretrained (cognitive 41) Sources/CosyVoiceTTS/CosyVoiceTTS.swift:62 — CosyVoiceTTSModel.fromPretrained has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (28 pts), match/switch 2 (8 pts), boolean chains 4, ternaries 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 · MagpieCoreMLDecoder.step (cognitive 41) · ×1
  • MagpieCoreMLDecoder.step (cognitive 41) Sources/MagpieTTSCoreML/Decoder.swift:275 — MagpieCoreMLDecoder.step has cognitive complexity 41 (threshold 15). Drivers by points: if/else 12 (19 pts), boolean chains 9, loops 4 (6 pts), error handling 2 (4 pts), ternaries 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 · PocketBenchmark.run (cognitive 41) · ×1
  • PocketBenchmark.run (cognitive 41) Sources/PocketTTSBenchmark/main.swift:15 — PocketBenchmark.run has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (31 pts), boolean chains 8, loops 2 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Gemma4UnifiedChat.generateResponse (cognitive 41) · ×1
  • Gemma4UnifiedChat.generateResponse (cognitive 41) Sources/Qwen3Chat/Gemma4UnifiedChat.swift:149 — Gemma4UnifiedChat.generateResponse has cognitive complexity 41 (threshold 15). Drivers by points: if/else 14 (26 pts), loops 3 (6 pts), ternaries 3 (5 pts), boolean chains 4 (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 · WeightLoader.swift.loadStagesWeightsForDecoder (cognitive 41) · ×1
  • WeightLoader.swift.loadStagesWeightsForDecoder (cognitive 41) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:257 — WeightLoader.swift.loadStagesWeightsForDecoder has cognitive complexity 41 (threshold 15). Drivers by points: if/else 17 (34 pts), error handling 2 (6 pts), loops 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NemotronMLXConfiguration.validate (cognitive 40) · ×1
  • NemotronMLXConfiguration.validate (cognitive 40) Sources/NemotronStreamingASR/NemotronMLXConfiguration.swift:181 — NemotronMLXConfiguration.validate has cognitive complexity 40 (threshold 15). Drivers by points: boolean chains 35, 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 · VoiceChatSession.runFunctionFastPath (cognitive 40) · ×1
  • VoiceChatSession.runFunctionFastPath (cognitive 40) Sources/VoiceChat/VoiceChatSession.swift:1576 — VoiceChatSession.runFunctionFastPath has cognitive complexity 40 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 9, error handling 3 (6 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 · GermanPhonemizer.phonemize (cognitive 39) · ×1
  • GermanPhonemizer.phonemize (cognitive 39) Sources/KokoroTTS/GermanPhonemizer.swift:97 — GermanPhonemizer.phonemize has cognitive complexity 39 (threshold 15). Drivers by points: if/else 7 (16 pts), boolean chains 10, loops 3 (7 pts), ternaries 1 (4 pts), match/switch 1 (2 pts) (nesting depth added 17). 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 · profile_gliner_memory.main (cognitive 39) · ×1
  • profile_gliner_memory.main (cognitive 39) scripts/profile_gliner_memory.py:70 — profile_gliner_memory.main has cognitive complexity 39 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 5 (9 pts), error handling 1 (5 pts), ternaries 2 (4 pts), boolean chains 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 · TTSSampler.sample (cognitive 38) · ×1
  • TTSSampler.sample (cognitive 38) Sources/Qwen3TTSCoreML/Sampler.swift:21 — TTSSampler.sample has cognitive complexity 38 (threshold 15). Drivers by points: if/else 11 (20 pts), loops 7 (10 pts), boolean chains 8 (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 · JapanesePhonemizer.phonemize (cognitive 37) · ×1
  • JapanesePhonemizer.phonemize (cognitive 37) Sources/KokoroTTS/JapanesePhonemizer.swift:85 — JapanesePhonemizer.phonemize has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 4 (7 pts), boolean chains 2 (nesting depth added 19). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LatinPhonemizer.frenchToIPA (cognitive 37) · ×1
  • LatinPhonemizer.frenchToIPA (cognitive 37) Sources/KokoroTTS/LatinPhonemizer.swift:143 — LatinPhonemizer.frenchToIPA has cognitive complexity 37 (threshold 15). Drivers by points: if/else 10 (22 pts), boolean chains 5, match/switch 1 (4 pts), loops 2 (3 pts), 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 · Gemma4Tokenizer.bpeEncode (cognitive 37) · ×1
  • Gemma4Tokenizer.bpeEncode (cognitive 37) Sources/Qwen3Chat/Gemma4Tokenizer.swift:185 — Gemma4Tokenizer.bpeEncode has cognitive complexity 37 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 7 (11 pts), boolean chains 4, ternaries 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 · fish_drama3_reference.main (cognitive 37) · ×1
  • fish_drama3_reference.main (cognitive 37) scripts/fish_drama3_reference.py:20 — fish_drama3_reference.main has cognitive complexity 37 (threshold 15). Drivers by points: if/else 7 (18 pts), loops 9 (13 pts), boolean chains 3, ternaries 1 (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 · NativeInferenceRequest.validate (cognitive 36) · ×1
  • NativeInferenceRequest.validate (cognitive 36) Sources/AudioServer/NativeInference.swift:46 — NativeInferenceRequest.validate has cognitive complexity 36 (threshold 15). Drivers by points: boolean chains 17, if/else 9 (15 pts), match/switch 2, ternaries 1 (2 pts) (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 · GermanPhonemizer.compound (cognitive 36) · ×1
  • GermanPhonemizer.compound (cognitive 36) Sources/KokoroTTS/GermanPhonemizer.swift:1122 — GermanPhonemizer.compound has cognitive complexity 36 (threshold 15). Drivers by points: if/else 10 (22 pts), ternaries 2 (6 pts), boolean chains 5, 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 · Parser.value (cognitive 36) · ×1
  • Parser.value (cognitive 36) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:94 — Parser.value has cognitive complexity 36 (threshold 15). Drivers by points: if/else 12 (28 pts), loops 2 (4 pts), boolean chains 3, match/switch 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 · Gemma4Chat.decode (cognitive 35) · ×1
  • Gemma4Chat.decode (cognitive 35) Sources/Qwen3Chat/Gemma4Chat.swift:253 — Gemma4Chat.decode has cognitive complexity 35 (threshold 15). Drivers by points: if/else 14 (24 pts), boolean chains 4, ternaries 2 (4 pts), loops 2 (3 pts) (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · export_breeze_mlx.export (cognitive 35) · ×1
  • export_breeze_mlx.export (cognitive 35) scripts/export_breeze_mlx.py:47 — export_breeze_mlx.export has cognitive complexity 35 (threshold 15). Drivers by points: if/else 12 (22 pts), ternaries 5, boolean chains 4, loops 3 (4 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceChatTerminalRenderer.render (cognitive 34) · ×1
  • VoiceChatTerminalRenderer.render (cognitive 34) Sources/AudioCLILib/VoiceChatDemoSupport.swift:873 — VoiceChatTerminalRenderer.render has cognitive complexity 34 (threshold 15). Drivers by points: if/else 13 (16 pts), boolean chains 11, ternaries 3 (4 pts), match/switch 1 (2 pts), loops 1 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, 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 · VoiceChatMCPRuntime.appleEventKitProviderCall (cognitive 34) · ×1
  • VoiceChatMCPRuntime.appleEventKitProviderCall (cognitive 34) Sources/AudioCLILib/VoiceChatMCP.swift:742 — VoiceChatMCPRuntime.appleEventKitProviderCall has cognitive complexity 34 (threshold 15). Drivers by points: if/else 16 (32 pts), boolean chains 1, 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 · OpenAISpeech.swift.handleOpenAISpeech (cognitive 34) · ×1
  • OpenAISpeech.swift.handleOpenAISpeech (cognitive 34) Sources/AudioServer/OpenAISpeech.swift:133 — OpenAISpeech.swift.handleOpenAISpeech has cognitive complexity 34 (threshold 15). Drivers by points: if/else 7 (16 pts), error handling 7 (15 pts), match/switch 1 (2 pts), boolean chains 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 · CosyVoiceTTSModel.splitForLongForm (cognitive 34) · ×1
  • CosyVoiceTTSModel.splitForLongForm (cognitive 34) Sources/CosyVoiceTTS/VoiceCloning.swift:309 — CosyVoiceTTSModel.splitForLongForm has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (26 pts), loops 4 (6 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MagpieJapaneseG2P.phonemes (cognitive 34) · ×1
  • MagpieJapaneseG2P.phonemes (cognitive 34) Sources/MagpieTTS/JapaneseG2P.swift:74 — MagpieJapaneseG2P.phonemes has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (25 pts), loops 4 (8 pts), boolean chains 1 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Mimi.sanitizeWeights (cognitive 34) · ×1
  • Mimi.sanitizeWeights (cognitive 34) Sources/PersonaPlex/MimiCodec.swift:113 — Mimi.sanitizeWeights has cognitive complexity 34 (threshold 15). Drivers by points: if/else 12 (27 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 17). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3ASRModel.pickNextToken (cognitive 34) · ×1
  • Qwen3ASRModel.pickNextToken (cognitive 34) Sources/Qwen3ASR/Qwen3ASR.swift:1098 — Qwen3ASRModel.pickNextToken has cognitive complexity 34 (threshold 15). Drivers by points: if/else 8 (17 pts), loops 4 (8 pts), boolean chains 6, ternaries 1 (3 pts) (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · NpzReader.read (cognitive 34) · ×1
  • NpzReader.read (cognitive 34) Sources/SpeechEnhancement/WeightLoading.swift:86 — NpzReader.read has cognitive complexity 34 (threshold 15). Drivers by points: if/else 10 (29 pts), boolean chains 4, loops 1 (nesting depth added 19). 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 · ContextGraph.build (cognitive 34) · ×1
  • ContextGraph.build (cognitive 34) Sources/SpeechWakeWord/ContextGraph.swift:73 — ContextGraph.build has cognitive complexity 34 (threshold 15). Drivers by points: ternaries 6 (20 pts), if/else 4 (10 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 21). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsrBench.run (cognitive 33) · ×1
  • AsrBench.run (cognitive 33) Sources/AsrBenchmark/AsrBench.swift:44 — AsrBench.run has cognitive complexity 33 (threshold 15). Drivers by points: if/else 8 (15 pts), ternaries 3 (6 pts), error handling 2 (5 pts), loops 3 (4 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 · ChatterboxFlashT3Graphs.denoiseBlockStep (cognitive 33) · ×1
  • ChatterboxFlashT3Graphs.denoiseBlockStep (cognitive 33) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:686 — ChatterboxFlashT3Graphs.denoiseBlockStep has cognitive complexity 33 (threshold 15). Drivers by points: if/else 14 (20 pts), loops 6 (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 · DiarizationBench.swift.maximumJaccardAssignment (cognitive 33) · ×1
  • DiarizationBench.swift.maximumJaccardAssignment (cognitive 33) Sources/DiarizationBenchmark/DiarizationBench.swift:900 — DiarizationBench.swift.maximumJaccardAssignment has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 6 (12 pts), boolean chains 4 (nesting depth added 16). Of this number, 31 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 · MADLADTranslator.swift.sampleWithTemperature (cognitive 33) · ×1
  • MADLADTranslator.swift.sampleWithTemperature (cognitive 33) Sources/MADLADTranslation/MADLADTranslator.swift:303 — MADLADTranslator.swift.sampleWithTemperature has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 6 (12 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DERScoring.swift.maximumWeightAssignment (cognitive 33) · ×1
  • DERScoring.swift.maximumWeightAssignment (cognitive 33) Sources/SpeechVAD/DERScoring.swift:346 — DERScoring.swift.maximumWeightAssignment has cognitive complexity 33 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 6 (12 pts), boolean chains 4 (nesting depth added 16). Of this number, 31 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 · profile_gliner_memory.check_reference (cognitive 33) · ×1
  • profile_gliner_memory.check_reference (cognitive 33) scripts/profile_gliner_memory.py:44 — profile_gliner_memory.check_reference has cognitive complexity 33 (threshold 15). Drivers by points: if/else 9 (24 pts), loops 3 (8 pts), boolean chains 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 · VoiceChatMCPRuntime.connect (cognitive 32) · ×1
  • VoiceChatMCPRuntime.connect (cognitive 32) Sources/AudioCLILib/VoiceChatMCP.swift:545 — VoiceChatMCPRuntime.connect has cognitive complexity 32 (threshold 15). Drivers by points: if/else 8 (19 pts), loops 3 (7 pts), ternaries 1 (4 pts), error handling 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GermanPhonemizer.expandAbbreviations (cognitive 32) · ×1
  • GermanPhonemizer.expandAbbreviations (cognitive 32) Sources/KokoroTTS/GermanPhonemizer.swift:867 — GermanPhonemizer.expandAbbreviations has cognitive complexity 32 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 4 (10 pts), boolean chains 8 (nesting depth added 14). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · TimestampCorrection.enforceMonotonicity (cognitive 32) · ×1
  • TimestampCorrection.enforceMonotonicity (cognitive 32) Sources/Qwen3ASR/TimestampCorrection.swift:15 — TimestampCorrection.enforceMonotonicity has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 2 (6 pts), loops 4 (5 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 · Qwen3TTSCoreMLModel.fromPretrained (cognitive 32) · ×1
  • Qwen3TTSCoreMLModel.fromPretrained (cognitive 32) Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:40 — Qwen3TTSCoreMLModel.fromPretrained has cognitive complexity 32 (threshold 15). Drivers by points: if/else 17 (20 pts), boolean chains 7, ternaries 2 (3 pts), loops 1, match/switch 1 (nesting depth added 4). Of this number, 17 points are the body's own statements and 15 belong to 4 function items inside it that branch. To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · WeightLoader.swift.loadUpsampleLayersWeightsForDecoder (cognitive 32) · ×1
  • WeightLoader.swift.loadUpsampleLayersWeightsForDecoder (cognitive 32) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:328 — WeightLoader.swift.loadUpsampleLayersWeightsForDecoder has cognitive complexity 32 (threshold 15). Drivers by points: if/else 12 (30 pts), loops 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_coreml.check (cognitive 32) · ×1
  • validate_coreml.check (cognitive 32) scripts/qwen3_tts_coreml/validate_coreml.py:73 — validate_coreml.check has cognitive complexity 32 (threshold 15). Drivers by points: if/else 9 (15 pts), ternaries 5 (9 pts), boolean chains 7, 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 · MultipartParser.parse (cognitive 31) · ×1
  • MultipartParser.parse (cognitive 31) Sources/AudioServer/OpenAITranscriptions.swift:263 — MultipartParser.parse has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (19 pts), boolean chains 8, loops 3 (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 · IndexTTS2Tokenizer.encode (cognitive 31) · ×1
  • IndexTTS2Tokenizer.encode (cognitive 31) Sources/IndexTTS2TTS/IndexTTS2Tokenizer.swift:94 — IndexTTS2Tokenizer.encode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (22 pts), boolean chains 5, 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 · GermanPhonemizer.normalize (cognitive 31) · ×1
  • GermanPhonemizer.normalize (cognitive 31) Sources/KokoroTTS/GermanPhonemizer.swift:28 — GermanPhonemizer.normalize has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 6, loops 6, match/switch 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 · MossTTSNanoTokenizer.encode (cognitive 31) · ×1
  • MossTTSNanoTokenizer.encode (cognitive 31) Sources/MossTTSNano/MossTTSNanoTokenizer.swift:102 — MossTTSNanoTokenizer.encode has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 7, loops 5, ternaries 2 (3 pts) (nesting depth added 6). Most of this is not in the body itself: 14 of the 31 points are its own statements and the rest belongs to 4 function items inside it that branch (pop, enqueue, push, …). 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 · Gemma4ToolCodec.schema · ×1
  • Gemma4ToolCodec.schema::resolve (cognitive 31) Sources/Qwen3Chat/Gemma4Tools.swift:102 — Gemma4ToolCodec.schema::resolve has cognitive complexity 31 (threshold 15). Drivers by points: if/else 9 (23 pts), boolean chains 4, loops 1 (3 pts), match/switch 1 (nesting depth added 16). 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 · JSONSchemaGrammar.compile (cognitive 31) · ×1
  • JSONSchemaGrammar.compile (cognitive 31) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:86 — JSONSchemaGrammar.compile has cognitive complexity 31 (threshold 15). Drivers by points: if/else 11 (16 pts), loops 4 (7 pts), boolean chains 5, ternaries 1 (2 pts), 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 · StreamingVADProcessor.processProb (cognitive 31) · ×1
  • StreamingVADProcessor.processProb (cognitive 31) Sources/SpeechVAD/StreamingVADProcessor.swift:286 — StreamingVADProcessor.processProb has cognitive complexity 31 (threshold 15). Drivers by points: if/else 17 (30 pts), match/switch 1 (nesting depth added 13). The drivers above price the dispatch low by construction — a dispatch is charged once however many cases it lists, while each branch inside an arm is charged in full — so most of this count is what the case bodies hold, and the arms are where it can be reduced. To reduce it, keep the dispatch but shrink the arms: move each non-trivial case body into its own named function (or onto the value being matched) so the dispatch reads one line per case, and group related cases into a sub-dispatch. Keep every case explicit, and make the behaviour for cases you do not list a deliberate choice rather than an accident.
D2 · Cognitive Complexity · ContextGraph.fillFailAndOutput (cognitive 31) · ×1
  • ContextGraph.fillFailAndOutput (cognitive 31) Sources/SpeechWakeWord/ContextGraph.swift:126 — ContextGraph.fillFailAndOutput has cognitive complexity 31 (threshold 15). Drivers by points: if/else 6 (18 pts), loops 5 (11 pts), boolean chains 2 (nesting depth added 18). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VibeVoiceStreamInference.generateWithVoiceCacheCore (cognitive 31) · ×1
  • VibeVoiceStreamInference.generateWithVoiceCacheCore (cognitive 31) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:427 — VibeVoiceStreamInference.generateWithVoiceCacheCore has cognitive complexity 31 (threshold 15). Drivers by points: if/else 10 (27 pts), loops 2 (3 pts), boolean chains 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 · AudioFileChunkReader.produceSamples (cognitive 30) · ×1
  • AudioFileChunkReader.produceSamples (cognitive 30) Sources/AudioCommon/AudioFileStream.swift:182 — AudioFileChunkReader.produceSamples has cognitive complexity 30 (threshold 15). Drivers by points: if/else 13 (26 pts), error handling 1 (2 pts), boolean chains 1, 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 · Benchmark.main (cognitive 30) · ×1
  • Benchmark.main (cognitive 30) Sources/GLiNERBenchmark/GLiNERBench.swift:76 — Benchmark.main has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (20 pts), loops 4 (8 pts), ternaries 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 · IndexTTS2PauseCompressor.compress (cognitive 30) · ×1
  • IndexTTS2PauseCompressor.compress (cognitive 30) Sources/IndexTTS2TTS/IndexTTS2Synthesis.swift:75 — IndexTTS2PauseCompressor.compress has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (18 pts), boolean chains 7, loops 4 (5 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 · NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting (cognitive 30) · ×1
  • NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting (cognitive 30) Sources/NemotronStreamingASR/SentencePieceUnigramTokenizer.swift:63 — NemotronSentencePieceUnigramTokenizer.encodeForWordBoosting has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (22 pts), loops 3 (4 pts), boolean chains 3, 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 · PocketTTSTokenizer.encode (cognitive 30) · ×1
  • PocketTTSTokenizer.encode (cognitive 30) Sources/PocketTTS/PocketTTSTokenizer.swift:22 — PocketTTSTokenizer.encode has cognitive complexity 30 (threshold 15). Drivers by points: if/else 10 (23 pts), loops 3 (4 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 · JSONSchemaGrammar.compileObject (cognitive 30) · ×1
  • JSONSchemaGrammar.compileObject (cognitive 30) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:253 — JSONSchemaGrammar.compileObject has cognitive complexity 30 (threshold 15). Drivers by points: if/else 11 (19 pts), loops 4 (5 pts), match/switch 3, ternaries 1 (2 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 · SortformerStateUpdater.boostTopK (cognitive 30) · ×1
  • SortformerStateUpdater.boostTopK (cognitive 30) Sources/SpeechVAD/SortformerStateUpdater.swift:411 — SortformerStateUpdater.boostTopK has cognitive complexity 30 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 5 (13 pts), boolean chains 4 (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 · VoiceChatCommand.runFile (cognitive 29) · ×1
  • VoiceChatCommand.runFile (cognitive 29) Sources/AudioCLILib/VoiceChatCommand.swift:370 — VoiceChatCommand.runFile has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), loops 6 (11 pts), boolean chains 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioIO.startMicrophoneTimestamped (cognitive 29) · ×1
  • AudioIO.startMicrophoneTimestamped (cognitive 29) Sources/AudioCommon/AudioIO.swift:80 — AudioIO.startMicrophoneTimestamped has cognitive complexity 29 (threshold 15). Drivers by points: if/else 15 (18 pts), ternaries 3 (6 pts), boolean chains 2, error handling 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 · FullDuplexAudioIO.start (cognitive 29) · ×1
  • FullDuplexAudioIO.start (cognitive 29) Sources/AudioCommon/FullDuplexAudioIO.swift:117 — FullDuplexAudioIO.start has cognitive complexity 29 (threshold 15). Drivers by points: if/else 8 (12 pts), boolean chains 11, ternaries 2 (3 pts), error handling 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexTTS2SemanticGPT.beamSampleSemanticCodes (cognitive 29) · ×1
  • IndexTTS2SemanticGPT.beamSampleSemanticCodes (cognitive 29) Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:233 — IndexTTS2SemanticGPT.beamSampleSemanticCodes has cognitive complexity 29 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 4 (8 pts), boolean chains 2 (nesting depth added 16). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChinesePhonemizer.syllableToIPA (cognitive 29) · ×1
  • ChinesePhonemizer.syllableToIPA (cognitive 29) Sources/KokoroTTS/ChinesePhonemizer.swift:146 — ChinesePhonemizer.syllableToIPA has cognitive complexity 29 (threshold 15). Drivers by points: if/else 16 (22 pts), boolean chains 5, 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 · MossMLXConfiguration.validate (cognitive 29) · ×1
  • MossMLXConfiguration.validate (cognitive 29) Sources/MossTranscribe/MossMLXConfiguration.swift:97 — MossMLXConfiguration.validate has cognitive complexity 29 (threshold 15). Drivers by points: boolean chains 20, 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 · RegexParser.bracket (cognitive 29) · ×1
  • RegexParser.bracket (cognitive 29) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:327 — RegexParser.bracket has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (21 pts), boolean chains 6, loops 1, 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 · JSONSchemaGrammar.compileType (cognitive 29) · ×1
  • JSONSchemaGrammar.compileType (cognitive 29) Sources/Qwen3Chat/JSONSchema/JSONSchemaGrammar.swift:189 — JSONSchemaGrammar.compileType has cognitive complexity 29 (threshold 15). Drivers by points: if/else 9 (17 pts), boolean chains 5, match/switch 3 (5 pts), loops 1 (2 pts) (nesting depth added 11). Of this number, 21 points are the body's own statements and 8 belong to one function item inside it that branches. 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 · SortformerStateUpdater.compressSpkcache (cognitive 29) · ×1
  • SortformerStateUpdater.compressSpkcache (cognitive 29) Sources/SpeechVAD/SortformerStateUpdater.swift:260 — SortformerStateUpdater.compressSpkcache has cognitive complexity 29 (threshold 15). Drivers by points: loops 7 (16 pts), if/else 6 (13 pts) (nesting depth added 16). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · StreamingKwsDecoder.step (cognitive 29) · ×1
  • StreamingKwsDecoder.step (cognitive 29) Sources/SpeechWakeWord/StreamingKwsDecoder.swift:166 — StreamingKwsDecoder.step has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (20 pts), boolean chains 5, loops 3 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VoiceChatRNNTTurnTakingState.selectToken (cognitive 29) · ×1
  • VoiceChatRNNTTurnTakingState.selectToken (cognitive 29) Sources/VoiceChat/VoiceChatTurnTaking.swift:168 — VoiceChatRNNTTurnTakingState.selectToken has cognitive complexity 29 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 13 (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 · FullDuplexToolScenario.load (cognitive 29) · ×1
  • FullDuplexToolScenario.load (cognitive 29) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:22 — FullDuplexToolScenario.load has cognitive complexity 29 (threshold 15). Drivers by points: if/else 18 (20 pts), boolean chains 8, ternaries 1 (nesting depth added 2). Of this number, 27 points are the body's own statements and 2 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, 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 · VoiceChatBench.run (cognitive 29) · ×1
  • VoiceChatBench.run (cognitive 29) Sources/VoiceChatBenchmark/VoiceChatBench.swift:175 — VoiceChatBench.run has cognitive complexity 29 (threshold 15). Drivers by points: if/else 12 (16 pts), loops 4 (7 pts), boolean chains 4, ternaries 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.
D2 · Cognitive Complexity · TranscribeBatchCommand.runQwen3Batch (cognitive 28) · ×1
  • TranscribeBatchCommand.runQwen3Batch (cognitive 28) Sources/AudioCLILib/TranscribeBatchCommand.swift:50 — TranscribeBatchCommand.runQwen3Batch has cognitive complexity 28 (threshold 15). Drivers by points: if/else 9 (18 pts), loops 3 (5 pts), error handling 1 (3 pts), boolean chains 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 · BreezeTTSModel.generateStreaming (cognitive 28) · ×1
  • BreezeTTSModel.generateStreaming (cognitive 28) Sources/BreezeTTS/BreezeTTSModel.swift:159 — BreezeTTSModel.generateStreaming has cognitive complexity 28 (threshold 15). Drivers by points: if/else 12 (18 pts), ternaries 3 (5 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiarizationHelpers.constrainedAgglomerativeClustering (cognitive 28) · ×1
  • DiarizationHelpers.constrainedAgglomerativeClustering (cognitive 28) Sources/SpeechVAD/DiarizationHelpers.swift:113 — DiarizationHelpers.constrainedAgglomerativeClustering has cognitive complexity 28 (threshold 15). Drivers by points: loops 9 (16 pts), if/else 4 (8 pts), ternaries 1 (3 pts), boolean chains 1 (nesting depth added 13). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · FullDuplexExpectedArguments.parse (cognitive 28) · ×1
  • FullDuplexExpectedArguments.parse (cognitive 28) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:337 — FullDuplexExpectedArguments.parse has cognitive complexity 28 (threshold 15). Drivers by points: if/else 14 (18 pts), boolean chains 8, loops 1 (2 pts) (nesting depth added 5). Of this number, 24 points are the body's own statements and 4 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, 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 · VoiceChatBench.runFullDuplexToolScenario · ×1
  • VoiceChatBench.runFullDuplexToolScenario::observe (cognitive 28) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:1009 — VoiceChatBench.runFullDuplexToolScenario::observe has cognitive complexity 28 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 11, 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. This shape REPEATS in the file: one other method here (VoiceChatBench.runFullDuplexToolScenario) 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 · SpeakCommand.runFishDrama3 (cognitive 27) · ×1
  • SpeakCommand.runFishDrama3 (cognitive 27) Sources/AudioCLILib/SpeakCommand.swift:1216 — SpeakCommand.runFishDrama3 has cognitive complexity 27 (threshold 15). Drivers by points: if/else 14 (20 pts), boolean chains 3, loops 1 (2 pts), ternaries 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 · AudioFileLoader.loadWAV (cognitive 27) · ×1
  • AudioFileLoader.loadWAV (cognitive 27) Sources/AudioCommon/AudioFileLoader.swift:126 — AudioFileLoader.loadWAV has cognitive complexity 27 (threshold 15). Drivers by points: if/else 12 (17 pts), boolean chains 5, loops 3 (4 pts), match/switch 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FlashSRAudioSRUnet.init (cognitive 27) · ×1
  • FlashSRAudioSRUnet.init (cognitive 27) Sources/FlashSR/UNet.swift:377 — FlashSRAudioSRUnet.init has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (20 pts), loops 4 (6 pts), boolean chains 1 (nesting depth added 15). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndicMioSampler.sample (cognitive 27) · ×1
  • IndicMioSampler.sample (cognitive 27) Sources/IndicMioTTS/IndicMioSampler.swift:4 — IndicMioSampler.sample has cognitive complexity 27 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 7 (10 pts), ternaries 2 (4 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 · MagpieTTSCoreML.synthesize (cognitive 27) · ×1
  • MagpieTTSCoreML.synthesize (cognitive 27) Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:180 — MagpieTTSCoreML.synthesize has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (16 pts), ternaries 5 (9 pts), boolean chains 1, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PocketSession.frame (cognitive 27) · ×1
  • PocketSession.frame (cognitive 27) Sources/PocketTTS/PocketTTSModel.swift:198 — PocketSession.frame has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (17 pts), boolean chains 7, loops 2 (3 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3ASRModel.generateTextBatchedBulkSync (cognitive 27) · ×1
  • Qwen3ASRModel.generateTextBatchedBulkSync (cognitive 27) Sources/Qwen3ASR/Qwen3ASR.swift:729 — Qwen3ASRModel.generateTextBatchedBulkSync has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 4 (7 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 · Gemma4ToolCodec.response (cognitive 27) · ×1
  • Gemma4ToolCodec.response (cognitive 27) Sources/Qwen3Chat/Gemma4Tools.swift:220 — Gemma4ToolCodec.response has cognitive complexity 27 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (6 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 · SupertonicTokenizer.preprocess (cognitive 27) · ×1
  • SupertonicTokenizer.preprocess (cognitive 27) Sources/SupertonicTTS/SupertonicTokenizer.swift:77 — SupertonicTokenizer.preprocess has cognitive complexity 27 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 8, 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 · SupertonicTokenizer.bisect (cognitive 27) · ×1
  • SupertonicTokenizer.bisect (cognitive 27) Sources/SupertonicTTS/SupertonicTokenizer.swift:249 — SupertonicTokenizer.bisect has cognitive complexity 27 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 7, loops 3 (5 pts), ternaries 1 (3 pts) (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · WER.compute (cognitive 26) · ×1
  • WER.compute (cognitive 26) Sources/AsrBenchmark/WER.swift:30 — WER.compute has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 5 (6 pts), boolean chains 4, ternaries 1 (3 pts), match/switch 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 · VoiceChatDemoState.ingest (cognitive 26) · ×1
  • VoiceChatDemoState.ingest (cognitive 26) Sources/AudioCLILib/VoiceChatDemoSupport.swift:454 — VoiceChatDemoState.ingest has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (18 pts), boolean chains 5, ternaries 1 (2 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 · VoiceChatMCPToolCoordinator.validate (cognitive 26) · ×1
  • VoiceChatMCPToolCoordinator.validate (cognitive 26) Sources/AudioCLILib/VoiceChatMCP.swift:1582 — VoiceChatMCPToolCoordinator.validate has cognitive complexity 26 (threshold 15). Drivers by points: if/else 9 (15 pts), boolean chains 7, loops 2, 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 · S3GenVocoder.swift.s3Istft (cognitive 26) · ×1
  • S3GenVocoder.swift.s3Istft (cognitive 26) Sources/ChatterboxTTS/S3GenVocoder.swift:397 — S3GenVocoder.swift.s3Istft has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 6 (8 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 · DiarizationBench.runEngine (cognitive 26) · ×1
  • DiarizationBench.runEngine (cognitive 26) Sources/DiarizationBenchmark/DiarizationBench.swift:83 — DiarizationBench.runEngine has cognitive complexity 26 (threshold 15). Drivers by points: ternaries 9 (15 pts), if/else 3 (7 pts), error handling 1 (2 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 · HindiPhonemizer.phonemize (cognitive 26) · ×1
  • HindiPhonemizer.phonemize (cognitive 26) Sources/KokoroTTS/HindiPhonemizer.swift:49 — HindiPhonemizer.phonemize has cognitive complexity 26 (threshold 15). Drivers by points: if/else 10 (19 pts), loops 4 (7 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 · PocketTtsMimiKeys.discover (cognitive 26) · ×1
  • PocketTtsMimiKeys.discover (cognitive 26) Sources/PocketTTS/PocketTtsMimiKeys.swift:58 — PocketTtsMimiKeys.discover has cognitive complexity 26 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 4, 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 · CoreMLTextDecoder.argmaxImpl (cognitive 26) · ×1
  • CoreMLTextDecoder.argmaxImpl (cognitive 26) Sources/Qwen3ASR/CoreMLTextDecoder.swift:499 — CoreMLTextDecoder.argmaxImpl has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 15). 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 · Qwen35CoreMLChat.generateStream (cognitive 26) · ×1
  • Qwen35CoreMLChat.generateStream (cognitive 26) Sources/Qwen3Chat/Qwen35CoreMLChat.swift:250 — Qwen35CoreMLChat.generateStream has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 4, loops 2 (4 pts), error handling 1 (nesting depth added 12). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parser.string (cognitive 26) · ×1
  • Parser.string (cognitive 26) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:162 — Parser.string has cognitive complexity 26 (threshold 15). Drivers by points: if/else 6 (17 pts), match/switch 2 (5 pts), boolean chains 3, 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 · Community1Clustering.centroidLinkageLabels (cognitive 26) · ×1
  • Community1Clustering.centroidLinkageLabels (cognitive 26) Sources/SpeechVAD/Community1Clustering.swift:333 — Community1Clustering.centroidLinkageLabels has cognitive complexity 26 (threshold 15). Drivers by points: loops 11 (14 pts), if/else 6 (11 pts), boolean chains 1 (nesting depth added 8). Of this number, 23 points are the body's own statements and 3 belong to 2 function items inside it that branch. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Nemotron3StreamingSession.consumeNewProbabilities (cognitive 26) · ×1
  • Nemotron3StreamingSession.consumeNewProbabilities (cognitive 26) Sources/SpeechVAD/Nemotron3Diarizer.swift:447 — Nemotron3StreamingSession.consumeNewProbabilities has cognitive complexity 26 (threshold 15). Drivers by points: if/else 8 (21 pts), loops 2 (3 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 · DERScoring.swift.assignedOptimalMapping (cognitive 26) · ×1
  • DERScoring.swift.assignedOptimalMapping (cognitive 26) Sources/SpeechVAD/DERScoring.swift:269 — DERScoring.swift.assignedOptimalMapping has cognitive complexity 26 (threshold 15). Drivers by points: loops 7 (15 pts), if/else 4 (10 pts), ternaries 1 (nesting depth added 14). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · VoiceChatSession.validate (cognitive 26) · ×1
  • VoiceChatSession.validate (cognitive 26) Sources/VoiceChat/VoiceChatSession.swift:371 — VoiceChatSession.validate has cognitive complexity 26 (threshold 15). Drivers by points: boolean chains 14, if/else 11 (12 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 · WhisperCoreMLRuntime.argmax (cognitive 26) · ×1
  • WhisperCoreMLRuntime.argmax (cognitive 26) Sources/WhisperASR/WhisperCoreMLRuntime.swift:330 — WhisperCoreMLRuntime.argmax has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (19 pts), loops 3 (6 pts), match/switch 1 (nesting depth added 15). 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 · BreezeTTSBenchmark.run (cognitive 26) · ×1
  • BreezeTTSBenchmark.run (cognitive 26) scripts/profiling/BreezeTTSBenchmark.swift:32 — BreezeTTSBenchmark.run has cognitive complexity 26 (threshold 15). Drivers by points: if/else 7 (12 pts), ternaries 5 (9 pts), boolean chains 4, loops 1 (nesting depth added 9). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · CosyVoiceTTSModel.synthesize (cognitive 25) · ×1
  • CosyVoiceTTSModel.synthesize (cognitive 25) Sources/CosyVoiceTTS/CosyVoiceTTS.swift:283 — CosyVoiceTTSModel.synthesize has cognitive complexity 25 (threshold 15). Drivers by points: if/else 15 (19 pts), ternaries 3 (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 · HiFiGAN.swift.istft (cognitive 25) · ×1
  • HiFiGAN.swift.istft (cognitive 25) Sources/CosyVoiceTTS/HiFiGAN.swift:508 — HiFiGAN.swift.istft has cognitive complexity 25 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 6 (8 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 · FishAudioSampler.sample (cognitive 25) · ×1
  • FishAudioSampler.sample (cognitive 25) Sources/FishAudioTTS/FishAudioGeneration.swift:48 — FishAudioSampler.sample has cognitive complexity 25 (threshold 15). Drivers by points: if/else 9 (13 pts), loops 4 (6 pts), boolean chains 3, 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 · StreamingSession.processChunk (cognitive 25) · ×1
  • StreamingSession.processChunk (cognitive 25) Sources/ParakeetStreamingASR/StreamingSession.swift:255 — StreamingSession.processChunk has cognitive complexity 25 (threshold 15). Drivers by points: if/else 19 (25 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 · Gemma4Tokenizer.load (cognitive 25) · ×1
  • Gemma4Tokenizer.load (cognitive 25) Sources/Qwen3Chat/Gemma4Tokenizer.swift:39 — Gemma4Tokenizer.load has cognitive complexity 25 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 4, 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 · TextChunker.findNaturalBreak (cognitive 25) · ×1
  • TextChunker.findNaturalBreak (cognitive 25) Sources/Qwen3TTS/TextChunker.swift:52 — TextChunker.findNaturalBreak has cognitive complexity 25 (threshold 15). Drivers by points: if/else 13 (23 pts), 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 · Sampling.swift.sampleToken (cognitive 25) · ×1
  • Sampling.swift.sampleToken (cognitive 25) Sources/Qwen3TTS/Sampling.swift:36 — Sampling.swift.sampleToken has cognitive complexity 25 (threshold 15). Drivers by points: boolean chains 12, if/else 8 (9 pts), loops 1 (2 pts), ternaries 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 · SpeakCommand.runVoxtral (cognitive 24) · ×1
  • SpeakCommand.runVoxtral (cognitive 24) Sources/AudioCLILib/SpeakCommand.swift:1487 — SpeakCommand.runVoxtral has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 2 (4 pts), boolean chains 1, 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 · SpeakCommand.runMossNano (cognitive 24) · ×1
  • SpeakCommand.runMossNano (cognitive 24) Sources/AudioCLILib/SpeakCommand+MossNano.swift:7 — SpeakCommand.runMossNano has cognitive complexity 24 (threshold 15). Drivers by points: if/else 11 (16 pts), boolean chains 3, ternaries 2 (3 pts), loops 1 (2 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioFileLoader.convertDrained (cognitive 24) · ×1
  • AudioFileLoader.convertDrained (cognitive 24) Sources/AudioCommon/AudioFileLoader.swift:354 — AudioFileLoader.convertDrained has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GermanPhonemizer.findNuclei (cognitive 24) · ×1
  • GermanPhonemizer.findNuclei (cognitive 24) Sources/KokoroTTS/GermanPhonemizer.swift:410 — GermanPhonemizer.findNuclei has cognitive complexity 24 (threshold 15). Drivers by points: if/else 6 (13 pts), boolean chains 10, 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 · Qwen3ASRModel.generateTextBatched (cognitive 24) · ×1
  • Qwen3ASRModel.generateTextBatched (cognitive 24) Sources/Qwen3ASR/Qwen3ASR.swift:825 — Qwen3ASRModel.generateTextBatched has cognitive complexity 24 (threshold 15). Drivers by points: if/else 7 (14 pts), loops 6 (9 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 · Qwen35MLXChat.generateStream (cognitive 24) · ×1
  • Qwen35MLXChat.generateStream (cognitive 24) Sources/Qwen3Chat/MLXGenerator.swift:347 — Qwen35MLXChat.generateStream has cognitive complexity 24 (threshold 15). Drivers by points: if/else 8 (20 pts), loops 1 (2 pts), boolean chains 1, error handling 1 (nesting depth added 13). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONSchemaMatcher.feedInteger (cognitive 24) · ×1
  • JSONSchemaMatcher.feedInteger (cognitive 24) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:416 — JSONSchemaMatcher.feedInteger has cognitive complexity 24 (threshold 15). Drivers by points: if/else 10 (18 pts), boolean chains 5, 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 · Qwen3TTSModel.runStreamingGeneration (cognitive 24) · ×1
  • Qwen3TTSModel.runStreamingGeneration (cognitive 24) Sources/Qwen3TTS/Qwen3TTS.swift:411 — Qwen3TTSModel.runStreamingGeneration has cognitive complexity 24 (threshold 15). Drivers by points: if/else 14 (15 pts), boolean chains 5, loops 2 (3 pts), ternaries 1 (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · DiarizationHelpers.agglomerativeClustering (cognitive 24) · ×1
  • DiarizationHelpers.agglomerativeClustering (cognitive 24) Sources/SpeechVAD/DiarizationHelpers.swift:223 — DiarizationHelpers.agglomerativeClustering has cognitive complexity 24 (threshold 15). Drivers by points: loops 8 (15 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 11). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · VibeVoiceTTSModel.encodeVoice (cognitive 24) · ×1
  • VibeVoiceTTSModel.encodeVoice (cognitive 24) Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:201 — VibeVoiceTTSModel.encodeVoice has cognitive complexity 24 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 5, boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · validate_coreml.fixtures (cognitive 24) · ×1
  • validate_coreml.fixtures (cognitive 24) scripts/qwen3_tts_coreml/validate_coreml.py:16 — validate_coreml.fixtures has cognitive complexity 24 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 3 (6 pts), loops 2 (4 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · VadStreamCommand.run (cognitive 23) · ×1
  • VadStreamCommand.run (cognitive 23) Sources/AudioCLILib/VadStreamCommand.swift:47 — VadStreamCommand.run has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (15 pts), loops 4 (6 pts), ternaries 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 · VoiceChatMCPRuntime.callProvider (cognitive 23) · ×1
  • VoiceChatMCPRuntime.callProvider (cognitive 23) Sources/AudioCLILib/VoiceChatMCP.swift:437 — VoiceChatMCPRuntime.callProvider has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 8, if/else 7 (8 pts), ternaries 2 (3 pts), match/switch 1 (2 pts), error handling 1, 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 · VoiceChatMCPToolCoordinator.handleFunctionCall (cognitive 23) · ×1
  • VoiceChatMCPToolCoordinator.handleFunctionCall (cognitive 23) Sources/AudioCLILib/VoiceChatMCP.swift:1282 — VoiceChatMCPToolCoordinator.handleFunctionCall has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (17 pts), boolean chains 3, match/switch 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 · HuggingFaceDownloader.downloadRanged (cognitive 23) · ×1
  • HuggingFaceDownloader.downloadRanged (cognitive 23) Sources/AudioCommon/HuggingFaceTransfer.swift:161 — HuggingFaceDownloader.downloadRanged has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 3 (7 pts), error handling 2 (4 pts), boolean chains 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SystemAudioTap.handleInput (cognitive 23) · ×1
  • SystemAudioTap.handleInput (cognitive 23) Sources/AudioCommon/SystemAudioTap.swift:346 — SystemAudioTap.handleInput has cognitive complexity 23 (threshold 15). Drivers by points: if/else 14 (19 pts), loops 2 (3 pts), boolean chains 1 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FunctionGemma.runPrefill (cognitive 23) · ×1
  • FunctionGemma.runPrefill (cognitive 23) Sources/FunctionGemma/FunctionGemma.swift:205 — FunctionGemma.runPrefill has cognitive complexity 23 (threshold 15). Drivers by points: ternaries 4 (12 pts), loops 5 (6 pts), if/else 3 (5 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 · HibikiWeightLoader.sanitizeDepformerWeights (cognitive 23) · ×1
  • HibikiWeightLoader.sanitizeDepformerWeights (cognitive 23) Sources/HibikiTranslate/HibikiWeightLoading.swift:149 — HibikiWeightLoader.sanitizeDepformerWeights has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (7 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 · HiggsTTSCodec.init (cognitive 23) · ×1
  • HiggsTTSCodec.init (cognitive 23) Sources/HiggsTTS/HiggsTTSCodec.swift:23 — HiggsTTSCodec.init has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 7, ternaries 1 (3 pts), loops 2 (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexTTS2SemanticGPT.beamSearchSemanticCodes (cognitive 23) · ×1
  • IndexTTS2SemanticGPT.beamSearchSemanticCodes (cognitive 23) Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift:153 — IndexTTS2SemanticGPT.beamSearchSemanticCodes has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (16 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 · KyutaiSTTConfig.init (cognitive 23) · ×1
  • KyutaiSTTConfig.init (cognitive 23) Sources/KyutaiSTT/Configuration.swift:84 — KyutaiSTTConfig.init has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 17, if/else 4, loops 2. 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, name the conditions: bind each compound test to a 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 · MagpieTTSCoreML.topKThreshold (cognitive 23) · ×1
  • MagpieTTSCoreML.topKThreshold (cognitive 23) Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:551 — MagpieTTSCoreML.topKThreshold has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (15 pts), loops 4 (6 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 · MossTTSNanoSampler.sample (cognitive 23) · ×1
  • MossTTSNanoSampler.sample (cognitive 23) Sources/MossTTSNano/MossTTSNanoSampling.swift:53 — MossTTSNanoSampler.sample has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 5 (6 pts), loops 3, 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 · MossMLXModel.transcribeLocked (cognitive 23) · ×1
  • MossMLXModel.transcribeLocked (cognitive 23) Sources/MossTranscribe/MossMLXRuntime.swift:380 — MossMLXModel.transcribeLocked has cognitive complexity 23 (threshold 15). Drivers by points: if/else 9 (11 pts), loops 5 (6 pts), boolean chains 4, 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.
D2 · Cognitive Complexity · PersonaPlexWeightLoader.sanitizeDepformerWeights (cognitive 23) · ×1
  • PersonaPlexWeightLoader.sanitizeDepformerWeights (cognitive 23) Sources/PersonaPlex/WeightLoading.swift:160 — PersonaPlexWeightLoader.sanitizeDepformerWeights has cognitive complexity 23 (threshold 15). Drivers by points: if/else 6 (16 pts), loops 4 (7 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 · Sampling.swift.sampleTokensBatch (cognitive 23) · ×1
  • Sampling.swift.sampleTokensBatch (cognitive 23) Sources/Qwen3TTS/Sampling.swift:175 — Sampling.swift.sampleTokensBatch has cognitive complexity 23 (threshold 15). Drivers by points: boolean chains 11, if/else 9 (10 pts), 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 · HTDemucs.callAsFunction (cognitive 23) · ×1
  • HTDemucs.callAsFunction (cognitive 23) Sources/SourceSeparation/HTDemucs/HTDemucs.swift:139 — HTDemucs.callAsFunction has cognitive complexity 23 (threshold 15). Drivers by points: if/else 12 (20 pts), loops 2, boolean chains 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Community1Clustering.cluster (cognitive 23) · ×1
  • Community1Clustering.cluster (cognitive 23) Sources/SpeechVAD/Community1Clustering.swift:220 — Community1Clustering.cluster has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 3 (6 pts), boolean chains 2, 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 · Community1DiarizationPipeline.reconstruct (cognitive 23) · ×1
  • Community1DiarizationPipeline.reconstruct (cognitive 23) Sources/SpeechVAD/Community1DiarizationPipeline.swift:253 — Community1DiarizationPipeline.reconstruct has cognitive complexity 23 (threshold 15). Drivers by points: loops 6 (12 pts), if/else 3 (9 pts), boolean chains 2 (nesting depth added 12). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SortformerStateUpdater.update (cognitive 23) · ×1
  • SortformerStateUpdater.update (cognitive 23) Sources/SpeechVAD/SortformerStateUpdater.swift:114 — SortformerStateUpdater.update has cognitive complexity 23 (threshold 15). Drivers by points: if/else 13 (22 pts), 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 · BPETokenizer.encodeViterbi (cognitive 23) · ×1
  • BPETokenizer.encodeViterbi (cognitive 23) Sources/SpeechWakeWord/BPETokenizer.swift:88 — BPETokenizer.encodeViterbi has cognitive complexity 23 (threshold 15). Drivers by points: if/else 8 (18 pts), loops 3 (4 pts), boolean chains 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 · SupertonicTokenizer.chunk (cognitive 23) · ×1
  • SupertonicTokenizer.chunk (cognitive 23) Sources/SupertonicTTS/SupertonicTokenizer.swift:171 — SupertonicTokenizer.chunk has cognitive complexity 23 (threshold 15). Drivers by points: if/else 7 (13 pts), boolean chains 4, loops 4, ternaries 2 (nesting depth added 6). Of this number, 16 points are the body's own statements and 7 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 · RuntimeOwnershipStress.main (cognitive 23) · ×1
  • RuntimeOwnershipStress.main (cognitive 23) scripts/profiling/RuntimeOwnershipStress.swift:16 — RuntimeOwnershipStress.main has cognitive complexity 23 (threshold 15). Drivers by points: loops 10 (14 pts), if/else 2 (4 pts), error handling 1 (3 pts), boolean chains 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · SpeakCommand.runMagpieCoreML (cognitive 22) · ×1
  • SpeakCommand.runMagpieCoreML (cognitive 22) Sources/AudioCLILib/SpeakCommand.swift:777 — SpeakCommand.runMagpieCoreML has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (18 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 · SpeakCommand.runPocket (cognitive 22) · ×1
  • SpeakCommand.runPocket (cognitive 22) Sources/AudioCLILib/SpeakCommand.swift:1544 — SpeakCommand.runPocket has cognitive complexity 22 (threshold 15). Drivers by points: if/else 13 (18 pts), loops 1 (2 pts), 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 · OpenAITranscriptions.swift.handleOpenAITranscriptions (cognitive 22) · ×1
  • OpenAITranscriptions.swift.handleOpenAITranscriptions (cognitive 22) Sources/AudioServer/OpenAITranscriptions.swift:22 — OpenAITranscriptions.swift.handleOpenAITranscriptions has cognitive complexity 22 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 3, error handling 3, match/switch 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChinesePhonemizer.phonemize (cognitive 22) · ×1
  • ChinesePhonemizer.phonemize (cognitive 22) Sources/KokoroTTS/ChinesePhonemizer.swift:94 — ChinesePhonemizer.phonemize has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (19 pts), boolean chains 2, loops 1 (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · GermanPhonemizer.intToDe (cognitive 22) · ×1
  • GermanPhonemizer.intToDe (cognitive 22) Sources/KokoroTTS/GermanPhonemizer.swift:731 — GermanPhonemizer.intToDe has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 7 (14 pts), if/else 7, 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 · NemotronVocabulary.encodingsForWordBoosting (cognitive 22) · ×1
  • NemotronVocabulary.encodingsForWordBoosting (cognitive 22) Sources/NemotronStreamingASR/Vocabulary.swift:132 — NemotronVocabulary.encodingsForWordBoosting has cognitive complexity 22 (threshold 15). Drivers by points: if/else 11 (17 pts), loops 3 (4 pts), boolean chains 1 (nesting depth added 7). Most of this is not in the body itself: 8 of the 22 points are its own statements and the rest belongs to one function item inside it that branches (collect). 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 · ChatTokenizer.loadFromTokenizerJson (cognitive 22) · ×1
  • ChatTokenizer.loadFromTokenizerJson (cognitive 22) Sources/Qwen3Chat/ChatTokenizer.swift:46 — ChatTokenizer.loadFromTokenizerJson has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (6 pts), boolean chains 3 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · JSONPattern.compile (cognitive 22) · ×1
  • JSONPattern.compile (cognitive 22) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:62 — JSONPattern.compile has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (7 pts), boolean chains 4, 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 · Qwen3TTSModel.synthesizeWithVoiceCloneICL (cognitive 22) · ×1
  • Qwen3TTSModel.synthesizeWithVoiceCloneICL (cognitive 22) Sources/Qwen3TTS/Qwen3TTS+ICL.swift:77 — Qwen3TTSModel.synthesizeWithVoiceCloneICL has cognitive complexity 22 (threshold 15). Drivers by points: if/else 12, ternaries 4 (6 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 · Community1DiarizationPipeline.toSegments (cognitive 22) · ×1
  • Community1DiarizationPipeline.toSegments (cognitive 22) Sources/SpeechVAD/Community1DiarizationPipeline.swift:307 — Community1DiarizationPipeline.toSegments has cognitive complexity 22 (threshold 15). Drivers by points: if/else 7 (15 pts), boolean chains 4, 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 · VoiceChatLanguageModel.load (cognitive 22) · ×1
  • VoiceChatLanguageModel.load (cognitive 22) Sources/VoiceChat/VoiceChatLanguageModel.swift:88 — VoiceChatLanguageModel.load has cognitive complexity 22 (threshold 15). Drivers by points: if/else 9 (16 pts), boolean chains 4, 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 · VoiceChatSpeechDecoder.init (cognitive 22) · ×1
  • VoiceChatSpeechDecoder.init (cognitive 22) Sources/VoiceChat/VoiceChatSpeechDecoder.swift:91 — VoiceChatSpeechDecoder.init has cognitive complexity 22 (threshold 15). Drivers by points: boolean chains 20, 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 · profile_fish_drama3.main (cognitive 22) · ×1
  • profile_fish_drama3.main (cognitive 22) scripts/profiling/profile_fish_drama3.py:152 — profile_fish_drama3.main has cognitive complexity 22 (threshold 15). Drivers by points: ternaries 5 (7 pts), if/else 5 (6 pts), loops 4 (6 pts), boolean chains 3 (nesting depth added 5). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · Dataset.loadLibriSpeech (cognitive 21) · ×1
  • Dataset.loadLibriSpeech (cognitive 21) Sources/AsrBenchmark/Dataset.swift:19 — Dataset.loadLibriSpeech has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 3 (5 pts), boolean chains 3 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · StreamingAudioPlayer.startCompletionPolling (cognitive 21) · ×1
  • StreamingAudioPlayer.startCompletionPolling (cognitive 21) Sources/AudioCommon/StreamingAudioPlayer.swift:345 — StreamingAudioPlayer.startCompletionPolling has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, 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 · NativeInferenceService.perform (cognitive 21) · ×1
  • NativeInferenceService.perform (cognitive 21) Sources/AudioServer/NativeInference.swift:224 — NativeInferenceService.perform has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (17 pts), match/switch 1 (2 pts), boolean chains 1, 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 · NativeInferenceService.registerRoutes (cognitive 21) · ×1
  • NativeInferenceService.registerRoutes (cognitive 21) Sources/AudioServer/NativeInference.swift:278 — NativeInferenceService.registerRoutes has cognitive complexity 21 (threshold 15). Drivers by points: error handling 5 (10 pts), if/else 4 (7 pts), boolean chains 3, 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 · CamPlusPlusMelExtractor.extractRaw (cognitive 21) · ×1
  • CamPlusPlusMelExtractor.extractRaw (cognitive 21) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114 — CamPlusPlusMelExtractor.extractRaw has cognitive complexity 21 (threshold 15). Drivers by points: loops 11 (19 pts), if/else 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · KokoroTTSModel.runModel (cognitive 21) · ×1
  • KokoroTTSModel.runModel (cognitive 21) Sources/KokoroTTS/KokoroTTS.swift:203 — KokoroTTSModel.runModel has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 6 (7 pts), boolean chains 1, ternaries 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · MossTTSNanoModel.synthesizeImpl (cognitive 21) · ×1
  • MossTTSNanoModel.synthesizeImpl (cognitive 21) Sources/MossTTSNano/MossTTSNanoModel.swift:139 — MossTTSNanoModel.synthesizeImpl has cognitive complexity 21 (threshold 15). Drivers by points: if/else 10 (16 pts), loops 3 (4 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 · MossTranscribeModel.transcribeLocked (cognitive 21) · ×1
  • MossTranscribeModel.transcribeLocked (cognitive 21) Sources/MossTranscribe/MossCoreMLRuntime.swift:605 — MossTranscribeModel.transcribeLocked has cognitive complexity 21 (threshold 15). Drivers by points: if/else 13 (16 pts), loops 4, 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 · CoreMLForcedAligner.argmaxAtPositions (cognitive 21) · ×1
  • CoreMLForcedAligner.argmaxAtPositions (cognitive 21) Sources/Qwen3ASR/CoreMLForcedAligner.swift:375 — CoreMLForcedAligner.argmaxAtPositions has cognitive complexity 21 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 4 (10 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 · CoreMLTextDecoder.writeChunk (cognitive 21) · ×1
  • CoreMLTextDecoder.writeChunk (cognitive 21) Sources/Qwen3ASR/CoreMLTextDecoder.swift:369 — CoreMLTextDecoder.writeChunk has cognitive complexity 21 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 4 (8 pts), boolean chains 1 (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · NpzReader.parseNpy (cognitive 21) · ×1
  • NpzReader.parseNpy (cognitive 21) Sources/SpeechEnhancement/WeightLoading.swift:145 — NpzReader.parseNpy has cognitive complexity 21 (threshold 15). Drivers by points: boolean chains 12, if/else 6 (7 pts), match/switch 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 · MelFeatureExtractor.extractRaw (cognitive 21) · ×1
  • MelFeatureExtractor.extractRaw (cognitive 21) Sources/SpeechVAD/MelFeatureExtractor.swift:120 — MelFeatureExtractor.extractRaw has cognitive complexity 21 (threshold 15). Drivers by points: loops 11 (19 pts), if/else 2 (nesting depth added 8). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · DERScoring.swift.computeDER (cognitive 21) · ×1
  • DERScoring.swift.computeDER (cognitive 21) Sources/SpeechVAD/DERScoring.swift:79 — DERScoring.swift.computeDER has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (11 pts), loops 4 (9 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 · VoiceChatBench.runCompletePipeline (cognitive 21) · ×1
  • VoiceChatBench.runCompletePipeline (cognitive 21) Sources/VoiceChatBenchmark/VoiceChatBench.swift:354 — VoiceChatBench.runCompletePipeline has cognitive complexity 21 (threshold 15). Drivers by points: if/else 9, boolean chains 6, loops 3 (4 pts), ternaries 2 (nesting depth added 1). Of this number, 19 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 · Pipeline.synthesize (cognitive 21) · ×1
  • Pipeline.synthesize (cognitive 21) scripts/qwen3_tts_coreml/run_coreml.py:94 — Pipeline.synthesize has cognitive complexity 21 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 4 (7 pts), ternaries 2 (4 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpeakCommand.runQwen3 (cognitive 20) · ×1
  • SpeakCommand.runQwen3 (cognitive 20) Sources/AudioCLILib/SpeakCommand.swift:895 — SpeakCommand.runQwen3 has cognitive complexity 20 (threshold 15). Drivers by points: if/else 10 (11 pts), ternaries 1 (4 pts), loops 1 (3 pts), boolean chains 1, 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 · RequestParams.parse (cognitive 20) · ×1
  • RequestParams.parse (cognitive 20) Sources/AudioServer/AudioServer.swift:1965 — RequestParams.parse has cognitive complexity 20 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 1 (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 · AudioServer.swift.parseRealtimeTurnDetection (cognitive 20) · ×1
  • AudioServer.swift.parseRealtimeTurnDetection (cognitive 20) Sources/AudioServer/AudioServer.swift:860 — AudioServer.swift.parseRealtimeTurnDetection has cognitive complexity 20 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 4 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · IndexTTS2TextNormalizer.zhCardinal (cognitive 20) · ×1
  • IndexTTS2TextNormalizer.zhCardinal (cognitive 20) Sources/IndexTTS2TTS/IndexTTS2TextNormalizer.swift:72 — IndexTTS2TextNormalizer.zhCardinal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (13 pts), ternaries 2 (4 pts), boolean chains 2, 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 · KokoroTextChunker.pack (cognitive 20) · ×1
  • KokoroTextChunker.pack (cognitive 20) Sources/KokoroTTS/TextChunker.swift:133 — KokoroTextChunker.pack has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (16 pts), ternaries 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MossTTSNanoTokenizer.init (cognitive 20) · ×1
  • MossTTSNanoTokenizer.init (cognitive 20) Sources/MossTTSNano/MossTTSNanoTokenizer.swift:19 — MossTTSNanoTokenizer.init has cognitive complexity 20 (threshold 15). Drivers by points: boolean chains 12, if/else 5 (7 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 · MossTTSNanoTokenizer.normalize (cognitive 20) · ×1
  • MossTTSNanoTokenizer.normalize (cognitive 20) Sources/MossTTSNano/MossTTSNanoTokenizer.swift:77 — MossTTSNanoTokenizer.normalize has cognitive complexity 20 (threshold 15). Drivers by points: if/else 6 (11 pts), loops 5 (8 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 · TalkerGenerator.forwardInternal (cognitive 20) · ×1
  • TalkerGenerator.forwardInternal (cognitive 20) Sources/Qwen3TTSCoreML/TalkerGenerator.swift:68 — TalkerGenerator.forwardInternal has cognitive complexity 20 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 3, loops 3, ternaries 1 (2 pts) (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SourceSeparator.separate (cognitive 20) · ×1
  • SourceSeparator.separate (cognitive 20) Sources/SourceSeparation/SourceSeparation.swift:42 — SourceSeparator.separate has cognitive complexity 20 (threshold 15). Drivers by points: loops 7 (13 pts), if/else 6, boolean chains 1 (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · VibeVoiceTTSModel.generateLongForm (cognitive 20) · ×1
  • VibeVoiceTTSModel.generateLongForm (cognitive 20) Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:404 — VibeVoiceTTSModel.generateLongForm has cognitive complexity 20 (threshold 15). Drivers by points: if/else 11 (15 pts), boolean chains 3, 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 · VibeVoiceStreamInference.generate (cognitive 20) · ×1
  • VibeVoiceStreamInference.generate (cognitive 20) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:528 — VibeVoiceStreamInference.generate has cognitive complexity 20 (threshold 15). Drivers by points: if/else 7 (17 pts), loops 2 (3 pts) (nesting depth added 11). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpeakCommand.runBreeze (cognitive 19) · ×1
  • SpeakCommand.runBreeze (cognitive 19) Sources/AudioCLILib/SpeakCommand.swift:1607 — SpeakCommand.runBreeze has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (15 pts), loops 1 (2 pts), boolean chains 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 · VoiceChatMCPConfiguration.selectedServers (cognitive 19) · ×1
  • VoiceChatMCPConfiguration.selectedServers (cognitive 19) Sources/AudioCLILib/VoiceChatMCP.swift:122 — VoiceChatMCPConfiguration.selectedServers has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (16 pts), boolean chains 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 · VoiceChatMCPRuntime.appleEventKitReminderRecords (cognitive 19) · ×1
  • VoiceChatMCPRuntime.appleEventKitReminderRecords (cognitive 19) Sources/AudioCLILib/VoiceChatMCP.swift:911 — VoiceChatMCPRuntime.appleEventKitReminderRecords has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (14 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). Of this number, 17 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 · VoiceChatMCPRuntime.normalizedEventKitDueDate (cognitive 19) · ×1
  • VoiceChatMCPRuntime.normalizedEventKitDueDate (cognitive 19) Sources/AudioCLILib/VoiceChatMCP.swift:982 — VoiceChatMCPRuntime.normalizedEventKitDueDate has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (13 pts), loops 4 (5 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 · StreamingAudioPlayer.play (cognitive 19) · ×1
  • StreamingAudioPlayer.play (cognitive 19) Sources/AudioCommon/StreamingAudioPlayer.swift:279 — StreamingAudioPlayer.play has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10 (17 pts), boolean chains 2 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatterboxT3.sampleToken (cognitive 19) · ×1
  • ChatterboxT3.sampleToken (cognitive 19) Sources/ChatterboxTTS/T3Model.swift:150 — ChatterboxT3.sampleToken has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (10 pts), loops 5 (9 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 · WhisperMelExtractor.setupMelFilterbank (cognitive 19) · ×1
  • WhisperMelExtractor.setupMelFilterbank (cognitive 19) Sources/CosyVoiceTTS/WhisperMelExtractor.swift:47 — WhisperMelExtractor.setupMelFilterbank has cognitive complexity 19 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 4 (6 pts), boolean chains 2 (nesting depth added 5). Of this number, 17 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · BenchmarkOptions.parse (cognitive 19) · ×1
  • BenchmarkOptions.parse (cognitive 19) Sources/GLiNERBenchmark/Options.swift:11 — BenchmarkOptions.parse 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 · MioCodecWaveDecoder.swift.istftSame (cognitive 19) · ×1
  • MioCodecWaveDecoder.swift.istftSame (cognitive 19) Sources/IndicMioTTS/MioCodecWaveDecoder.swift:593 — MioCodecWaveDecoder.swift.istftSame has cognitive complexity 19 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 6 (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 · GermanPhonemizer.splitPrefix (cognitive 19) · ×1
  • GermanPhonemizer.splitPrefix (cognitive 19) Sources/KokoroTTS/GermanPhonemizer.swift:382 — GermanPhonemizer.splitPrefix has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (11 pts), boolean chains 7, 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 · KokoroPhonemizer.phonemizeWithDict (cognitive 19) · ×1
  • KokoroPhonemizer.phonemizeWithDict (cognitive 19) Sources/KokoroTTS/Phonemizer.swift:314 — KokoroPhonemizer.phonemizeWithDict has cognitive complexity 19 (threshold 15). Drivers by points: if/else 5 (12 pts), loops 3 (5 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KokoroPhonemizer.stemS (cognitive 19) · ×1
  • KokoroPhonemizer.stemS (cognitive 19) Sources/KokoroTTS/Phonemizer.swift:438 — KokoroPhonemizer.stemS has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 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 · MagpieCoreMLLocalTransformer.forward (cognitive 19) · ×1
  • MagpieCoreMLLocalTransformer.forward (cognitive 19) Sources/MagpieTTSCoreML/LocalTransformer.swift:47 — MagpieCoreMLLocalTransformer.forward has cognitive complexity 19 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 4 (7 pts), boolean chains 3 (nesting depth added 7). This file's own header attributes it to another copyright holder, so it is code this repository carries rather than code it wrote: restructuring the body in place forks it from upstream and turns every future re-sync into a manual merge. The performable moves are to leave the body as close to its upstream form as possible and keep it behind a narrow interface of your own, and to re-sync it when upstream changes — or, if it has already diverged far enough that you maintain it here, adopt it deliberately and then split the body into named stages.
D2 · Cognitive Complexity · Qwen3AudioEncoder.callAsFunction (cognitive 19) · ×1
  • Qwen3AudioEncoder.callAsFunction (cognitive 19) Sources/Qwen3ASR/AudioEncoder.swift:362 — Qwen3AudioEncoder.callAsFunction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 7 (9 pts), loops 7, ternaries 1 (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 · Qwen3ForcedAligner.alignLong (cognitive 19) · ×1
  • Qwen3ForcedAligner.alignLong (cognitive 19) Sources/Qwen3ASR/ForcedAligner.swift:111 — Qwen3ForcedAligner.alignLong has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (16 pts), boolean chains 2, 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 · JSONSchemaMatcher.integerFeasible (cognitive 19) · ×1
  • JSONSchemaMatcher.integerFeasible (cognitive 19) Sources/Qwen3Chat/JSONSchema/JSONSchemaMatcher.swift:467 — JSONSchemaMatcher.integerFeasible has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (10 pts), if/else 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 · Parser.number (cognitive 19) · ×1
  • Parser.number (cognitive 19) Sources/Qwen3Chat/JSONSchema/OrderedJSON.swift:139 — Parser.number has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (11 pts), boolean chains 7, loops 1 (nesting depth added 3). Of this number, 17 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 · HDecLayer.callAsFunction (cognitive 19) · ×1
  • HDecLayer.callAsFunction (cognitive 19) Sources/SourceSeparation/HTDemucs/HTDemucsLayers.swift:254 — HDecLayer.callAsFunction has cognitive complexity 19 (threshold 15). Drivers by points: if/else 12 (18 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 · VadBench.runEngine (cognitive 19) · ×1
  • VadBench.runEngine (cognitive 19) Sources/VadBenchmark/VadBench.swift:96 — VadBench.runEngine has cognitive complexity 19 (threshold 15). Drivers by points: ternaries 5 (8 pts), if/else 2 (4 pts), match/switch 1 (3 pts), error handling 1 (2 pts), boolean chains 1, loops 1 (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · FullDuplexExpectedAudio.parse (cognitive 19) · ×1
  • FullDuplexExpectedAudio.parse (cognitive 19) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:153 — FullDuplexExpectedAudio.parse has cognitive complexity 19 (threshold 15). Drivers by points: if/else 10, boolean chains 9. Of this number, 11 points are the body's own statements and 8 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 · VoxCPM2TTSModel.loadWeights (cognitive 19) · ×1
  • VoxCPM2TTSModel.loadWeights (cognitive 19) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:742 — VoxCPM2TTSModel.loadWeights has cognitive complexity 19 (threshold 15). Drivers by points: if/else 9 (18 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 · RuntimeOwnershipProfile.micro (cognitive 19) · ×1
  • RuntimeOwnershipProfile.micro (cognitive 19) scripts/profiling/RuntimeOwnershipProfile.swift:133 — RuntimeOwnershipProfile.micro has cognitive complexity 19 (threshold 15). Drivers by points: loops 12 (16 pts), if/else 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · benchmark_qwen3_batch_decode.benchmark_one (cognitive 19) · ×1
  • benchmark_qwen3_batch_decode.benchmark_one (cognitive 19) scripts/benchmark_qwen3_batch_decode.py:264 — benchmark_qwen3_batch_decode.benchmark_one has cognitive complexity 19 (threshold 15). Drivers by points: if/else 8 (13 pts), loops 2 (3 pts), error handling 1 (2 pts), boolean chains 1 (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AsrBench.runIsolated (cognitive 18) · ×1
  • AsrBench.runIsolated (cognitive 18) Sources/AsrBenchmark/AsrBench.swift:244 — AsrBench.runIsolated has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 2, loops 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatterboxFlashNumpy.parseFloat32Vector (cognitive 18) · ×1
  • ChatterboxFlashNumpy.parseFloat32Vector (cognitive 18) Sources/ChatterboxTTS/ChatterboxFlashNumpy.swift:9 — ChatterboxFlashNumpy.parseFloat32Vector has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9, boolean chains 8, loops 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 · MTLTokenizer.normalizeJapaneseToHiragana (cognitive 18) · ×1
  • MTLTokenizer.normalizeJapaneseToHiragana (cognitive 18) Sources/ChatterboxTTS/MTLTokenizer.swift:250 — MTLTokenizer.normalizeJapaneseToHiragana has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 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 · HiFiGANGenerator.callAsFunction (cognitive 18) · ×1
  • HiFiGANGenerator.callAsFunction (cognitive 18) Sources/CosyVoiceTTS/HiFiGAN.swift:769 — HiFiGANGenerator.callAsFunction has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 2 (3 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 · FishAudioDrama3Prompt.build (cognitive 18) · ×1
  • FishAudioDrama3Prompt.build (cognitive 18) Sources/FishAudioTTS/FishAudioDrama3Prompt.swift:36 — FishAudioDrama3Prompt.build has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 8, if/else 4 (5 pts), loops 4, ternaries 1 (nesting depth added 1). Most of this is not in the body itself: 7 of the 18 points are its own statements and the rest belongs to 2 function items inside it that branch (appendCodes, appendText). 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 · HiggsTTSCodec.sincResample (cognitive 18) · ×1
  • HiggsTTSCodec.sincResample (cognitive 18) Sources/HiggsTTS/HiggsTTSCodecEncoder.swift:223 — HiggsTTSCodec.sincResample has cognitive complexity 18 (threshold 15). Drivers by points: loops 5 (9 pts), if/else 2 (4 pts), ternaries 2 (4 pts), boolean chains 1 (nesting depth added 8). Of this number, 17 points are the body's own statements and 1 belongs to one function item inside it that branches. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · IndexTTS2BigVGAN.prepareWeights (cognitive 18) · ×1
  • IndexTTS2BigVGAN.prepareWeights (cognitive 18) Sources/IndexTTS2TTS/IndexTTS2BigVGAN.swift:236 — IndexTTS2BigVGAN.prepareWeights has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (11 pts), ternaries 2 (5 pts), boolean chains 1, loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LatinPhonemizer.spanishToIPA (cognitive 18) · ×1
  • LatinPhonemizer.spanishToIPA (cognitive 18) Sources/KokoroTTS/LatinPhonemizer.swift:228 — LatinPhonemizer.spanishToIPA has cognitive complexity 18 (threshold 15). Drivers by points: if/else 5 (13 pts), loops 2 (3 pts), boolean chains 2 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · KokoroTextChunker.boundaryRank (cognitive 18) · ×1
  • KokoroTextChunker.boundaryRank (cognitive 18) Sources/KokoroTTS/TextChunker.swift:206 — KokoroTextChunker.boundaryRank has cognitive complexity 18 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 4, 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 · Qwen35MLXChat.generate (cognitive 18) · ×1
  • Qwen35MLXChat.generate (cognitive 18) Sources/Qwen3Chat/MLXGenerator.swift:240 — Qwen35MLXChat.generate has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (14 pts), boolean chains 2, 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 · RegexParser.quantified (cognitive 18) · ×1
  • RegexParser.quantified (cognitive 18) Sources/Qwen3Chat/JSONSchema/JSONPattern.swift:215 — RegexParser.quantified has cognitive complexity 18 (threshold 15). Drivers by points: if/else 9 (14 pts), ternaries 1 (2 pts), boolean chains 1, 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 · Qwen3TTSModel.resolveLocalConfiguration (cognitive 18) · ×1
  • Qwen3TTSModel.resolveLocalConfiguration (cognitive 18) Sources/Qwen3TTS/LocalModelConfiguration.swift:10 — Qwen3TTSModel.resolveLocalConfiguration has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 3, error handling 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 · EmbeddingFile.read (cognitive 18) · ×1
  • EmbeddingFile.read (cognitive 18) Sources/Qwen3TTSCoreML/BundleConfiguration.swift:68 — EmbeddingFile.read has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 8, match/switch 1 (nesting depth added 1). Of this number, 15 points are the body's own statements and 3 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 · SpeechEnhancer.enhanceCore (cognitive 18) · ×1
  • SpeechEnhancer.enhanceCore (cognitive 18) Sources/SpeechEnhancement/SpeechEnhancement.swift:149 — SpeechEnhancer.enhanceCore has cognitive complexity 18 (threshold 15). Drivers by points: loops 7 (12 pts), if/else 5 (6 pts) (nesting depth added 6). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · Nemotron3ArtifactConfiguration.validate (cognitive 18) · ×1
  • Nemotron3ArtifactConfiguration.validate (cognitive 18) Sources/SpeechVAD/Nemotron3Diarizer.swift:63 — Nemotron3ArtifactConfiguration.validate has cognitive complexity 18 (threshold 15). Drivers by points: boolean chains 15, 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 · StableAudio3WeightLoading.swift.sa3RewriteDiTMediumKeys (cognitive 18) · ×1
  • StableAudio3WeightLoading.swift.sa3RewriteDiTMediumKeys (cognitive 18) Sources/StableAudio3MusicGen/StableAudio3WeightLoading.swift:52 — StableAudio3WeightLoading.swift.sa3RewriteDiTMediumKeys has cognitive complexity 18 (threshold 15). Drivers by points: if/else 8 (16 pts), loops 2 (nesting depth added 8). Most of this is not in the body itself: 1 of the 18 points is its own statement and the rest belongs to 2 function items inside it that branch (rewrite, rewrite::mapList). 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 · WeightLoader.swift.loadEncoderManually (cognitive 18) · ×1
  • WeightLoader.swift.loadEncoderManually (cognitive 18) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:219 — WeightLoader.swift.loadEncoderManually has cognitive complexity 18 (threshold 15). Drivers by points: if/else 11 (16 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 · AudioVAE.sanitize (cognitive 18) · ×1
  • AudioVAE.sanitize (cognitive 18) Sources/VoxCPM2TTS/AudioVAE.swift:655 — AudioVAE.sanitize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (13 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 · VoxCPM2TTSModel.fromPretrained (cognitive 18) · ×1
  • VoxCPM2TTSModel.fromPretrained (cognitive 18) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:158 — VoxCPM2TTSModel.fromPretrained has cognitive complexity 18 (threshold 15). Drivers by points: if/else 10 (12 pts), boolean chains 4, error handling 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 · profile_fish_drama3.summarize (cognitive 18) · ×1
  • profile_fish_drama3.summarize (cognitive 18) scripts/profiling/profile_fish_drama3.py:58 — profile_fish_drama3.summarize has cognitive complexity 18 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 4, loops 2 (3 pts) (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · DiarizeCommand.runPyannote (cognitive 17) · ×1
  • DiarizeCommand.runPyannote (cognitive 17) Sources/AudioCLILib/DiarizeCommand.swift:319 — DiarizeCommand.runPyannote has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 1 (4 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 · SpeakCommand.runMagpie (cognitive 17) · ×1
  • SpeakCommand.runMagpie (cognitive 17) Sources/AudioCLILib/SpeakCommand.swift:709 — SpeakCommand.runMagpie has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (15 pts), loops 1 (2 pts) (nesting depth added 8). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioFileChunkReader.init (cognitive 17) · ×1
  • AudioFileChunkReader.init (cognitive 17) Sources/AudioCommon/AudioFileStream.swift:98 — AudioFileChunkReader.init has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (10 pts), boolean chains 5, match/switch 1 (2 pts) (nesting depth added 2). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · Qwen3Tokenizer.bpe (cognitive 17) · ×1
  • Qwen3Tokenizer.bpe (cognitive 17) Sources/AudioCommon/Tokenizer.swift:251 — Qwen3Tokenizer.bpe has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 3 (5 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 · BenchmarkManifest.load (cognitive 17) · ×1
  • BenchmarkManifest.load (cognitive 17) Sources/BenchmarkSupport/BenchmarkSupport.swift:39 — BenchmarkManifest.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (11 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 · FlowMelExtractor.setupMelFilterbank (cognitive 17) · ×1
  • FlowMelExtractor.setupMelFilterbank (cognitive 17) Sources/CosyVoiceTTS/FlowMelExtractor.swift:83 — FlowMelExtractor.setupMelFilterbank has cognitive complexity 17 (threshold 15). Drivers by points: loops 8 (11 pts), if/else 2 (4 pts), boolean chains 2 (nesting depth added 5). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · IndexTTS2TextSegmenter.split (cognitive 17) · ×1
  • IndexTTS2TextSegmenter.split (cognitive 17) Sources/IndexTTS2TTS/IndexTTS2TextSegmenter.swift:21 — IndexTTS2TextSegmenter.split 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 · IndicMioSampler.topKIndices (cognitive 17) · ×1
  • IndicMioSampler.topKIndices (cognitive 17) Sources/IndicMioTTS/IndicMioSampler.swift:89 — IndicMioSampler.topKIndices has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), loops 3, boolean chains 2 (nesting depth added 5). Most of this is not in the body itself: 4 of the 17 points are its own statements and the rest belongs to 2 function items inside it that branch (siftDown, siftUp). 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 · LatinPhonemizer.tokenize (cognitive 17) · ×1
  • LatinPhonemizer.tokenize (cognitive 17) Sources/KokoroTTS/LatinPhonemizer.swift:51 — LatinPhonemizer.tokenize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 4, 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 · T5Attention.callAsFunction (cognitive 17) · ×1
  • T5Attention.callAsFunction (cognitive 17) Sources/MADLADTranslation/MADLADModel.swift:201 — T5Attention.callAsFunction has cognitive complexity 17 (threshold 15). Drivers by points: if/else 10 (14 pts), ternaries 1 (2 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MADLADTranslator.translateStream (cognitive 17) · ×1
  • MADLADTranslator.translateStream (cognitive 17) Sources/MADLADTranslation/MADLADTranslator.swift:224 — MADLADTranslator.translateStream has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (10 pts), ternaries 1 (3 pts), loops 1 (2 pts), boolean chains 1, 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 · MagpieWeightLoader.loadAndDequantize (cognitive 17) · ×1
  • MagpieWeightLoader.loadAndDequantize (cognitive 17) Sources/MagpieTTS/WeightLoader.swift:79 — MagpieWeightLoader.loadAndDequantize has cognitive complexity 17 (threshold 15). Drivers by points: if/else 9 (12 pts), boolean chains 2, loops 2, error handling 1 (nesting depth added 3). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MossTTSNanoModel.encodeReference (cognitive 17) · ×1
  • MossTTSNanoModel.encodeReference (cognitive 17) Sources/MossTTSNano/MossTTSNanoModel.swift:60 — MossTTSNanoModel.encodeReference has cognitive complexity 17 (threshold 15). Drivers by points: boolean chains 7, if/else 6, loops 2 (3 pts), ternaries 1 (nesting depth added 1). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ParakeetVocabulary.decodeWords (cognitive 17) · ×1
  • ParakeetVocabulary.decodeWords (cognitive 17) Sources/ParakeetASR/Vocabulary.swift:126 — ParakeetVocabulary.decodeWords has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (12 pts), boolean chains 3, loops 1, ternaries 1 (nesting depth added 5). Of this number, 14 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 · CoreMLForcedAligner.align (cognitive 17) · ×1
  • CoreMLForcedAligner.align (cognitive 17) Sources/Qwen3ASR/CoreMLForcedAligner.swift:163 — CoreMLForcedAligner.align has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 8, if/else 6 (7 pts), loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · ChatSampler.sampleOnDevice (cognitive 17) · ×1
  • ChatSampler.sampleOnDevice (cognitive 17) Sources/Qwen3Chat/ChatSamplerMLX.swift:43 — ChatSampler.sampleOnDevice has cognitive complexity 17 (threshold 15). Drivers by points: if/else 11 (12 pts), boolean chains 4, 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 · Qwen3TTSModel.generateBatchWithCodePredictor (cognitive 17) · ×1
  • Qwen3TTSModel.generateBatchWithCodePredictor (cognitive 17) Sources/Qwen3TTS/Qwen3TTS.swift:904 — Qwen3TTSModel.generateBatchWithCodePredictor has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (13 pts), loops 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 · HTDemucsTransformer.swift.sinEmbedding2D (cognitive 17) · ×1
  • HTDemucsTransformer.swift.sinEmbedding2D (cognitive 17) Sources/SourceSeparation/HTDemucs/HTDemucsTransformer.swift:34 — HTDemucsTransformer.swift.sinEmbedding2D has cognitive complexity 17 (threshold 15). Drivers by points: ternaries 3 (10 pts), loops 4 (7 pts) (nesting depth added 10). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Community1PLDA.load (cognitive 17) · ×1
  • Community1PLDA.load (cognitive 17) Sources/SpeechVAD/Community1Clustering.swift:15 — Community1PLDA.load has cognitive complexity 17 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, error handling 3 (nesting depth added 1). Most of this is not in the body itself: 8 of the 17 points are its own statements and the rest belongs to one function item inside it that branches (tensor). 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 · SortformerStateUpdater.disableLowScores (cognitive 17) · ×1
  • SortformerStateUpdater.disableLowScores (cognitive 17) Sources/SpeechVAD/SortformerStateUpdater.swift:376 — SortformerStateUpdater.disableLowScores has cognitive complexity 17 (threshold 15). Drivers by points: if/else 3 (9 pts), loops 4 (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 · SortformerStreamingSession.drainReadyChunks (cognitive 17) · ×1
  • SortformerStreamingSession.drainReadyChunks (cognitive 17) Sources/SpeechVAD/SortformerStreamingSession.swift:149 — SortformerStreamingSession.drainReadyChunks has cognitive complexity 17 (threshold 15). Drivers by points: if/else 6 (12 pts), boolean chains 3, 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 · DPMSolverMultistepScheduler.step (cognitive 17) · ×1
  • DPMSolverMultistepScheduler.step (cognitive 17) Sources/VibeVoiceTTS/Inference/DPMSolver.swift:250 — DPMSolverMultistepScheduler.step has cognitive complexity 17 (threshold 15). Drivers by points: if/else 8 (9 pts), boolean chains 6, loops 1, 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 · monitor_apple_gpu.first_numeric (cognitive 17) · ×1
  • monitor_apple_gpu.first_numeric (cognitive 17) scripts/monitor_apple_gpu.py:190 — monitor_apple_gpu.first_numeric has cognitive complexity 17 (threshold 15). Drivers by points: if/else 4 (10 pts), loops 3 (6 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 · HuggingFaceDownloader.withDownloadRetries (cognitive 16) · ×1
  • HuggingFaceDownloader.withDownloadRetries (cognitive 16) Sources/AudioCommon/HuggingFaceDownloader.swift:411 — HuggingFaceDownloader.withDownloadRetries has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (10 pts), ternaries 1 (3 pts), error handling 1 (2 pts), loops 1 (nesting depth added 9). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Qwen3Tokenizer.decode (cognitive 16) · ×1
  • Qwen3Tokenizer.decode (cognitive 16) Sources/AudioCommon/Tokenizer.swift:118 — Qwen3Tokenizer.decode has cognitive complexity 16 (threshold 15). Drivers by points: if/else 5 (10 pts), boolean chains 3, loops 2 (3 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · MelPreprocessor.buildMelFilterbank (cognitive 16) · ×1
  • MelPreprocessor.buildMelFilterbank (cognitive 16) Sources/CanaryASR/MelPreprocessor.swift:193 — MelPreprocessor.buildMelFilterbank has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 4, if/else 2 (4 pts), loops 3 (4 pts), ternaries 3 (4 pts) (nesting depth added 4). Of this number, 14 points are the body's own statements and 2 belong to 2 function items inside it that branch. To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · ChatterboxTTSModel.fromPretrained (cognitive 16) · ×1
  • ChatterboxTTSModel.fromPretrained (cognitive 16) Sources/ChatterboxTTS/ChatterboxTTSModel.swift:152 — ChatterboxTTSModel.fromPretrained has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (12 pts), loops 3 (4 pts) (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition, and where an else follows a branch that already returns, drop the trailing else and let the rest of the body continue at one level.
D2 · Cognitive Complexity · DialogueSynthesizer.synthesize (cognitive 16) · ×1
  • DialogueSynthesizer.synthesize (cognitive 16) Sources/CosyVoiceTTS/DialogueSynthesizer.swift:47 — DialogueSynthesizer.synthesize has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (15 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 · FlashSRMelPreprocessor.melSpec (cognitive 16) · ×1
  • FlashSRMelPreprocessor.melSpec (cognitive 16) Sources/FlashSR/Mel.swift:19 — FlashSRMelPreprocessor.melSpec has cognitive complexity 16 (threshold 15). Drivers by points: loops 7 (16 pts) (nesting depth added 9). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · CommonWeightLoader.verifyQuantizedLayout (cognitive 16) · ×1
  • CommonWeightLoader.verifyQuantizedLayout (cognitive 16) Sources/MLXCommon/WeightLoading.swift:135 — CommonWeightLoader.verifyQuantizedLayout has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (11 pts), boolean chains 5 (nesting depth added 4). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · LanguageGuideContext.makeMask (cognitive 16) · ×1
  • LanguageGuideContext.makeMask (cognitive 16) Sources/NemotronStreamingASR/LanguageGuide.swift:59 — LanguageGuideContext.makeMask has cognitive complexity 16 (threshold 15). Drivers by points: if/else 7 (8 pts), boolean chains 6, loops 2 (nesting depth added 1). To reduce it, split the body: this score is breadth rather than depth — many checks laid out side by side rather than nested inside one another, so inverting conditions into early returns has nothing left to flatten. Group the statements between the checks into named steps and move each step into its own function, so the body reads as a short sequence of named stages.
D2 · Cognitive Complexity · NemotronVocabulary.decodeWords (cognitive 16) · ×1
  • NemotronVocabulary.decodeWords (cognitive 16) Sources/NemotronStreamingASR/Vocabulary.swift:239 — NemotronVocabulary.decodeWords 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 · Resampler.resample (cognitive 16) · ×1
  • Resampler.resample (cognitive 16) Sources/OmniVoiceTTS/OmniVoiceCodecEncoder.swift:14 — Resampler.resample has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), loops 2 (3 pts), ternaries 1 (3 pts) (nesting depth added 7). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · OmniVoiceCodecEncoder.shouldKeep (cognitive 16) · ×1
  • OmniVoiceCodecEncoder.shouldKeep (cognitive 16) Sources/OmniVoiceTTS/OmniVoiceCodecEncoder.swift:790 — OmniVoiceCodecEncoder.shouldKeep has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), boolean chains 1 (nesting depth added 5). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · PocketTtsLayerKeys.discover (cognitive 16) · ×1
  • PocketTtsLayerKeys.discover (cognitive 16) Sources/PocketTTS/PocketTtsLayerKeys.swift:84 — PocketTtsLayerKeys.discover has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (13 pts), boolean chains 1, loops 1, match/switch 1 (nesting depth added 3). To reduce it, split the body: most of this score is breadth rather than depth — checks laid out side by side rather than stacked — so group the statements between the checks into named steps and move each step into its own function. Some of it IS depth: where a check sits inside another whose only job is to reach it, merge the two into one condition.
D2 · Cognitive Complexity · WhisperFeatureExtractor.setupMelFilterbank (cognitive 16) · ×1
  • WhisperFeatureExtractor.setupMelFilterbank (cognitive 16) Sources/Qwen3ASR/AudioPreprocessing.swift:61 — WhisperFeatureExtractor.setupMelFilterbank has cognitive complexity 16 (threshold 15). Drivers by points: loops 9 (12 pts), if/else 4 (nesting depth added 3). Of this number, 12 points are the body's own statements and 4 belong to 2 function items inside it that branch. To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · WhisperFeatureExtractor.extractFeaturesRaw (cognitive 16) · ×1
  • WhisperFeatureExtractor.extractFeaturesRaw (cognitive 16) Sources/Qwen3ASR/AudioPreprocessing.swift:347 — WhisperFeatureExtractor.extractFeaturesRaw has cognitive complexity 16 (threshold 15). Drivers by points: loops 9 (13 pts), if/else 3 (nesting depth added 4). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · TextPreprocessor.pairsForSegment (cognitive 16) · ×1
  • TextPreprocessor.pairsForSegment (cognitive 16) Sources/Qwen3ASR/TextPreprocessing.swift:198 — TextPreprocessor.pairsForSegment has cognitive complexity 16 (threshold 15). Drivers by points: if/else 10 (15 pts), loops 1 (nesting depth added 5). 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, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · Parser.parseString (cognitive 16) · ×1
  • Parser.parseString (cognitive 16) Sources/Qwen3Chat/Gemma4Tools.swift:284 — Parser.parseString has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (11 pts), boolean chains 3, loops 1 (2 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · SpeechEnhancer.enhanceChunked (cognitive 16) · ×1
  • SpeechEnhancer.enhanceChunked (cognitive 16) Sources/SpeechEnhancement/SpeechEnhancement.swift:316 — SpeechEnhancer.enhanceChunked has cognitive complexity 16 (threshold 15). Drivers by points: if/else 8 (12 pts), loops 2 (4 pts) (nesting depth added 6). To reduce it, split the body into named stages: move each independent step or branch into its own named function so the body reads as a short sequence of named calls rather than one long body.
D2 · Cognitive Complexity · AudioProcessing.swift.computeERBFilterbank (cognitive 16) · ×1
  • AudioProcessing.swift.computeERBFilterbank (cognitive 16) Sources/SpeechEnhancement/AudioProcessing.swift:27 — AudioProcessing.swift.computeERBFilterbank has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (9 pts), loops 5 (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 · LanguageIDModelConfiguration.validate (cognitive 16) · ×1
  • LanguageIDModelConfiguration.validate (cognitive 16) Sources/SpeechLanguageID/LanguageIDTypes.swift:128 — LanguageIDModelConfiguration.validate has cognitive complexity 16 (threshold 15). Drivers by points: boolean chains 12, 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 · SpeechLanguageIdentifier.identify (cognitive 16) · ×1
  • SpeechLanguageIdentifier.identify (cognitive 16) Sources/SpeechLanguageID/SpeechLanguageIdentifier.swift:166 — SpeechLanguageIdentifier.identify has cognitive complexity 16 (threshold 15). Drivers by points: if/else 9 (12 pts), loops 2 (3 pts), 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 · SeamlessM4TFrontEnd.logMelSpectrogram (cognitive 16) · ×1
  • SeamlessM4TFrontEnd.logMelSpectrogram (cognitive 16) Sources/SpeechRestoration/SeamlessM4TFrontEnd.swift:122 — SeamlessM4TFrontEnd.logMelSpectrogram has cognitive complexity 16 (threshold 15). Drivers by points: loops 7 (14 pts), if/else 2 (nesting depth added 7). To reduce it, break up the iteration: give each loop body a named function, and split a multi-phase loop into one function per phase so no single body carries the whole pipeline.
D2 · Cognitive Complexity · FireRedVADModel.extractSegments (cognitive 16) · ×1
  • FireRedVADModel.extractSegments (cognitive 16) Sources/SpeechVAD/FireRedVAD.swift:266 — FireRedVADModel.extractSegments has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (10 pts), boolean chains 2, loops 2, 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 · WeSpeakerNetwork.init (cognitive 16) · ×1
  • WeSpeakerNetwork.init (cognitive 16) Sources/SpeechVAD/WeSpeakerModel.swift:75 — WeSpeakerNetwork.init has cognitive complexity 16 (threshold 15). Drivers by points: ternaries 6 (12 pts), loops 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 · UnigramTokenizer.bpeMergeAppend (cognitive 16) · ×1
  • UnigramTokenizer.bpeMergeAppend (cognitive 16) Sources/StableAudio3MusicGen/UnigramTokenizer.swift:54 — UnigramTokenizer.bpeMergeAppend has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (12 pts), loops 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 · VibeVoiceStreamInference.loadVoiceCache (cognitive 16) · ×1
  • VibeVoiceStreamInference.loadVoiceCache (cognitive 16) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:207 — VibeVoiceStreamInference.loadVoiceCache has cognitive complexity 16 (threshold 15). Drivers by points: if/else 4 (8 pts), boolean chains 4, 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 · WeightLoader.swift.transposeConv1dWeights (cognitive 16) · ×1
  • WeightLoader.swift.transposeConv1dWeights (cognitive 16) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:180 — WeightLoader.swift.transposeConv1dWeights has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (9 pts), boolean chains 6, 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 · VoiceChatSession.pushAudio (cognitive 16) · ×1
  • VoiceChatSession.pushAudio (cognitive 16) Sources/VoiceChat/VoiceChatSession.swift:435 — VoiceChatSession.pushAudio has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), ternaries 2 (4 pts), boolean chains 2, 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 · VoiceChatSession.deferMicrophoneFrame (cognitive 16) · ×1
  • VoiceChatSession.deferMicrophoneFrame (cognitive 16) Sources/VoiceChat/VoiceChatSession.swift:1812 — VoiceChatSession.deferMicrophoneFrame has cognitive complexity 16 (threshold 15). Drivers by points: if/else 6 (8 pts), loops 2 (6 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 · VoxCPM2TTSModel.loadWeights (cognitive 16) · ×1
  • VoxCPM2TTSModel.loadWeights (cognitive 16) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:422 — VoxCPM2TTSModel.loadWeights has cognitive complexity 16 (threshold 15). Drivers by points: if/else 11 (15 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.
D3 · God Classes · FunctionTooLong · ×1
  • FunctionTooLong: AudioServer.swift.handleRealtimeWS Sources/AudioServer/AudioServer.swift:968 — FunctionTooLong — handleRealtimeWS runs 404 significant lines (blank, comment-only and punctuation-only lines excluded) in one body. The bar is 100 significant lines; this is 304 over it, 4.04× the bar. This is length, not branching: a long straight-line body scores low on complexity and is still read whole to change any part of it, so the complexity numbers beside this row neither confirm nor excuse it. To reduce it, extract each cohesive step of the body — the runs of statements that work on the same values and would earn the same name — into its own named unit, and have this one call them in order.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D4 · Code Duplication · Near-duplicate member family (5 members, 16 shared lines) · ×1
  • Near-duplicate member family (5 members, 16 shared lines) Sources/Qwen3ASR/FloatTextDecoder.swift:70 — Sources/Qwen3ASR/FloatTextDecoder.swift:70-109 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:56-105 | Sources/Qwen3Chat/Qwen35Model.swift:355-425 | Sources/Qwen3TTS/CodePredictor.swift:53-92 | Sources/Qwen3TTS/Talker.swift:61-103 — These 5 members are variants of one another: a block of 16 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 5 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 5 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 55 shared lines) · ×1
  • Near-duplicate member family (4 members, 55 shared lines) Sources/PersonaPlex/PersonaPlex.swift:127 — Sources/PersonaPlex/PersonaPlex.swift:127-584 | Sources/PersonaPlex/PersonaPlex.swift:618-992 | Sources/PersonaPlex/PersonaPlex.swift:1012-1319 | Sources/PersonaPlex/PersonaPlex.swift:1332-1572 — These 4 members are variants of one another: a block of 55 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 45 shared lines) · ×1
  • Near-duplicate member family (4 members, 45 shared lines) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:43 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:43-108 | Sources/Qwen3ASR/AudioPreprocessing.swift:61-164 | Sources/SpeechVAD/MelFeatureExtractor.swift:45-111 | Sources/SpeechVAD/SortformerMelExtractor.swift:52-127 — These 4 members are variants of one another: a block of 45 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (4 members, 21 shared lines) · ×1
  • Near-duplicate member family (4 members, 21 shared lines) Sources/Qwen3ASR/FloatTextDecoder.swift:70 — Sources/Qwen3ASR/FloatTextDecoder.swift:70-109 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:56-105 | Sources/Qwen3TTS/CodePredictor.swift:53-92 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:262-289 — These 4 members are variants of one another: a block of 21 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 4 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 4 times.
D4 · Code Duplication · Near-duplicate member family (3 members, 47 shared lines) · ×1
  • Near-duplicate member family (3 members, 47 shared lines) Sources/ChatterboxTTS/S3GenVocoder.swift:397 — Sources/ChatterboxTTS/S3GenVocoder.swift:397-486 | Sources/CosyVoiceTTS/HiFiGAN.swift:508-633 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:593-678 — These 3 members are variants of one another: a block of 47 lines reported below appears in every one of them, and the pairwise near-duplicate rows they would otherwise produce are collapsed into this row. Read them as one construct written 3 times. The repair is at the members' grain — factor the shared implementation out once and have all of them call it with their differences as parameters or as an injected step, or, where the difference is systematic, generate them from one template. Extracting the individual blocks below is not the same fix: it leaves every body in place and the next edit still has to be made 3 times.
D4 · Code Duplication · Near-duplicate member pair (47 shared lines) · ×1
  • Near-duplicate member pair (47 shared lines) Sources/Qwen3ASR/CoreMLASRModel.swift:108 — Sources/Qwen3ASR/CoreMLASRModel.swift:108-243 | Sources/Qwen3ASR/CoreMLASRModel.swift:260-363 — These two members are variants of one another: 47 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 (38 shared lines) · ×1
  • Near-duplicate member pair (38 shared lines) Sources/KokoroTTS/HindiPhonemizer.swift:49 — Sources/KokoroTTS/HindiPhonemizer.swift:49-109 | Sources/KokoroTTS/JapanesePhonemizer.swift:85-153 — These two members are variants of one another: 38 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 (35 shared lines) · ×1
  • Near-duplicate member pair (35 shared lines) Sources/CosyVoiceTTS/FlowMelExtractor.swift:83 — Sources/CosyVoiceTTS/FlowMelExtractor.swift:83-136 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:47-127 — These two members are variants of one another: 35 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 (32 shared lines) · ×1
  • Near-duplicate member pair (32 shared lines) Sources/AudioCLILib/SpeakCommand.swift:1487 — Sources/AudioCLILib/SpeakCommand.swift:1487-1542 | Sources/AudioCLILib/SpeakCommand.swift:1544-1597 — These two members are variants of one another: 32 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) Sources/Qwen3ASR/Qwen3ASR.swift:729 — Sources/Qwen3ASR/Qwen3ASR.swift:729-823 | Sources/Qwen3ASR/Qwen3ASR.swift:825-957 — 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) Sources/NemotronStreamingASR/StreamingSession.swift:46 — Sources/NemotronStreamingASR/StreamingSession.swift:46-153 | Sources/ParakeetStreamingASR/StreamingSession.swift:52-128 — 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 (25 shared lines) · ×1
  • Near-duplicate member pair (25 shared lines) scripts/qwen3_tts_coreml/convert_coreml.py:274 — scripts/qwen3_tts_coreml/convert_coreml.py:274-344 | scripts/qwen3_tts_coreml/convert_coreml.py:371-431 — These two members are variants of one another: 25 of their lines are already reported as duplicated blocks below, spread through both bodies rather than gathered into one. Read them as a single construct written twice. The repair is at the members' grain — factor the shared pipeline into one implementation the two call with their differences as parameters or as an injected step, or, where the difference is systematic (sync against async, one transport against another), generate one from the other. Extracting the individual blocks below is not the same fix: it leaves the two bodies in place and the next edit still has to be made twice.
D4 · Code Duplication · Edited copy of a member (60 corresponding lines) · ×1
  • Edited copy of a member (60 corresponding lines) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:158 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:158-217 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:416-476 — 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 (18 corresponding lines) · ×1
  • Edited copy of a member (18 corresponding lines) Sources/MLXCommon/SDPA.swift:18 — Sources/MLXCommon/SDPA.swift:18-37 | Sources/MLXCommon/SDPA.swift:42-59 — These two members are one piece of code written twice and then edited apart: 18 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (12 corresponding lines) · ×1
  • Edited copy of a member (12 corresponding lines) Sources/HibikiTranslate/HibikiWeightLoading.swift:229 — Sources/HibikiTranslate/HibikiWeightLoading.swift:229-240 | Sources/PersonaPlex/WeightLoading.swift:244-256 — 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 · Edited copy of a member (9 corresponding lines) · ×1
  • Edited copy of a member (9 corresponding lines) Sources/F5TTS/F5TTSFlow.swift:232 — Sources/F5TTS/F5TTSFlow.swift:232-301 | Sources/F5TTS/F5TTSFlow.swift:503-522 — These two members are one piece of code written twice and then edited apart: 9 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (11 corresponding lines) · ×1
  • Edited copy of a member (11 corresponding lines) Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:64 — Sources/IndexTTS2TTS/IndexTTS2SemanticCodec.swift:64-76 | Sources/IndicMioTTS/MioCodecGlobalEncoder.swift:39-51 — These two members are one piece of code written twice and then edited apart: 11 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (15 corresponding lines) · ×1
  • Edited copy of a member (15 corresponding lines) Sources/HibikiTranslate/HibikiWeightLoading.swift:206 — Sources/HibikiTranslate/HibikiWeightLoading.swift:206-220 | Sources/PersonaPlex/WeightLoading.swift:220-235 — 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 (20 corresponding lines) · ×1
  • Edited copy of a member (20 corresponding lines) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:303 — Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:303-368 | Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:427-526 — 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 (8 corresponding lines) · ×1
  • Edited copy of a member (8 corresponding lines) Sources/FlashSR/UNet.swift:72 — Sources/FlashSR/UNet.swift:72-79 | Sources/FlashSR/VAE.swift:148-156 — These two members are one piece of code written twice and then edited apart: 8 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Edited copy of a member (27 corresponding lines) · ×1
  • Edited copy of a member (27 corresponding lines) Sources/Qwen3Chat/Qwen3ChatConfig.swift:78 — Sources/Qwen3Chat/Qwen3ChatConfig.swift:78-130 | Sources/SpeechVAD/SortformerConfig.swift:275-331 — 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 (13 corresponding lines) · ×1
  • Edited copy of a member (13 corresponding lines) Sources/MLXCommon/WeightLoading.swift:66 — Sources/MLXCommon/WeightLoading.swift:66-86 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:155-194 — These two members are one piece of code written twice and then edited apart: 13 consecutive lines correspond almost exactly, broken only by small local edits. Most of that correspondence is NOT reported as duplicated blocks below — the edits cut it into fragments and only the largest of them clear the block floor, so the rows below understate it. The repair is at the members' grain — factor the shared implementation into one the two call with their differences as parameters or as an injected step, or, where the difference is systematic (an extra return value, one transport against another), generate one from the other. Left alone, the next edit has to be made twice and the two will drift further apart.
D4 · Code Duplication · Members sharing a duplicated core (13 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (13 members, 50+ identical tokens) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:114-217 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:142-229 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:132-225 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:58-148 | Sources/ParakeetASR/MelPreprocessor.swift:56-190 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:62-185 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:192-277 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:284-405 | Sources/Qwen3ASR/AudioPreprocessing.swift:169-317 | Sources/Qwen3ASR/AudioPreprocessing.swift:347-470 | Sources/SpeechVAD/MelFeatureExtractor.swift:120-227 | Sources/SpeechVAD/SortformerMelExtractor.swift:133-216 | Sources/SpeechWakeWord/KaldiFbank.swift:221-252 — These 13 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 13 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 13 times.
D4 · Code Duplication · Members sharing a duplicated core (10 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (10 members, 50+ identical tokens) Sources/AudioCLILib/TranscribeCommand.swift:206 — Sources/AudioCLILib/TranscribeCommand.swift:206-230 | Sources/AudioCLILib/TranscribeCommand.swift:232-256 | Sources/AudioCLILib/TranscribeCommand.swift:393-425 | Sources/AudioCLILib/TranscribeCommand.swift:427-465 | Sources/AudioCLILib/TranscribeCommand.swift:467-504 | Sources/AudioCLILib/TranscribeCommand.swift:506-532 | Sources/AudioCLILib/TranscribeCommand.swift:534-573 | Sources/AudioCLILib/TranscribeCommand.swift:575-598 | Sources/AudioCLILib/TranscribeCommand.swift:608-637 | Sources/AudioCLILib/TranscribeCommand.swift:639-667 — These 10 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 10 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 10 times.
D4 · Code Duplication · Members sharing a duplicated core (9 members, 50+ identical tokens) · ×1
  • Members sharing a duplicated core (9 members, 50+ identical tokens) Sources/CanaryASR/CanaryASR+Loading.swift:12 — Sources/CanaryASR/CanaryASR+Loading.swift:12-95 | Sources/MossTranscribe/MossMLXRuntime.swift:107-153 | Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:91-140 | Sources/NemotronStreamingASR/NemotronStreamingASR.swift:219-268 | Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:58-129 | Sources/OmnilingualASR/OmnilingualASR.swift:62-134 | Sources/ParakeetASR/ParakeetASR.swift:336-463 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:153-221 | Sources/SourceSeparation/SourceSeparation.swift:186-253 — These 9 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 9 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 9 times.
D4 · Code Duplication · Duplicated block (49–54 lines × 2) · ×1
  • Duplicated block (49–54 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:151 — Sources/HibikiTranslate/HibikiWeightLoading.swift:151-199 | Sources/PersonaPlex/WeightLoading.swift:163-216 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:151` 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 (39–50 lines × 2) · ×1
  • Duplicated block (39–50 lines × 2) Sources/Qwen3ASR/AudioPreprocessing.swift:264 — Sources/Qwen3ASR/AudioPreprocessing.swift:264-313 | Sources/Qwen3ASR/AudioPreprocessing.swift:422-460 — both copies are in the same file, so extract the 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–48 lines × 2) · ×1
  • Duplicated block (39–48 lines × 2) Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:566 — Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:566-613 | Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:619-657 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Audio2Face3D/Audio2Face3DMLXRuntime.swift:566` 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 (38–45 lines × 2) · ×1
  • Duplicated block (38–45 lines × 2) Sources/MossTranscribe/MossCoreMLRuntime.swift:297 — Sources/MossTranscribe/MossCoreMLRuntime.swift:297-341 | Sources/WhisperASR/WhisperASR.swift:53-90 — before extracting anything, compare `Sources/MossTranscribe/MossCoreMLRuntime.swift` and `Sources/WhisperASR/WhisperASR.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 100 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MossTranscribe/MossCoreMLRuntime.swift:297` 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 (40–42 lines × 2) · ×1
  • Duplicated block (40–42 lines × 2) Sources/DiarizationBenchmark/DiarizationBench.swift:934 — Sources/DiarizationBenchmark/DiarizationBench.swift:934-975 | Sources/SpeechVAD/DERScoring.swift:378-417 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/DiarizationBenchmark/DiarizationBench.swift:934` 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 (30–41 lines × 2) · ×1
  • Duplicated block (30–41 lines × 2) Sources/VibeVoiceTTS/Models/VibeVoice15BModel.swift:109 — Sources/VibeVoiceTTS/Models/VibeVoice15BModel.swift:109-138 | Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:617-657 — 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 (34–40 lines × 2) · ×1
  • Duplicated block (34–40 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:310 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:310-343 | Sources/PersonaPlex/TemporalTransformer.swift:335-374 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (37–40 lines × 2) · ×1
  • Duplicated block (37–40 lines × 2) Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:71 — Sources/VibeVoiceTTS/VibeVoice15BTTSModel.swift:71-107 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:88-127 — 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 (37 lines × 2) · ×1
  • Duplicated block (37 lines × 2) Sources/MossTranscribe/MossMLXRuntime.swift:117 — Sources/MossTranscribe/MossMLXRuntime.swift:117-153 | Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:104-140 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MossTranscribe/MossMLXRuntime.swift:117` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (20–36 lines × 2) · ×1
  • Duplicated block (20–36 lines × 2) Sources/Qwen3ASR/CoreMLASRModel.swift:181 — Sources/Qwen3ASR/CoreMLASRModel.swift:181-216 | Sources/Qwen3ASR/CoreMLASRModel.swift:332-351 — both copies are in the same file, so extract the 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 (30–34 lines × 2) · ×1
  • Duplicated block (30–34 lines × 2) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:188 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:188-217 | Sources/SpeechVAD/MelFeatureExtractor.swift:194-227 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/SpeechVAD/MelFeatureExtractor.swift` as WHOLE FILES: this scan already matched 17 separate duplicated blocks between them, totalling at least 267 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:188` 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 (27–34 lines × 2) · ×1
  • Duplicated block (27–34 lines × 2) Sources/SpeechVAD/FireRedVAD.swift:131 — Sources/SpeechVAD/FireRedVAD.swift:131-157 | Sources/SpeechVAD/FireRedVAD.swift:184-217 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechVAD/FireRedVAD.swift:131` 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 (29–33 lines × 3) · ×1
  • Duplicated block (29–33 lines × 3) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:189 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:189-217 | Sources/ParakeetASR/MelPreprocessor.swift:232-264 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:447-476 — before extracting anything, compare `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetASR/MelPreprocessor.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/StreamingMelPreprocessor.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. 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 (8–33 lines × 3) · ×1
  • Duplicated block (8–33 lines × 3) Sources/ChatterboxTTS/S3GenVocoder.swift:452 — Sources/ChatterboxTTS/S3GenVocoder.swift:452-475 | Sources/CosyVoiceTTS/HiFiGAN.swift:584-616 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:648-655 — 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.
D4 · Code Duplication · Duplicated block (24–32 lines × 3) · ×1
  • Duplicated block (24–32 lines × 3) Sources/Qwen3ASR/FloatTextDecoder.swift:74 — Sources/Qwen3ASR/FloatTextDecoder.swift:74-97 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:60-91 | Sources/Qwen3TTS/CodePredictor.swift:57-80 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.swift:74` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (31 lines × 2) · ×1
  • Duplicated block (31 lines × 2) Sources/ChatterboxTTS/ChatterboxFlashTokenizer.swift:80 — Sources/ChatterboxTTS/ChatterboxFlashTokenizer.swift:80-110 | Sources/ChatterboxTTS/MTLTokenizer.swift:350-380 — 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 `Sources/ChatterboxTTS/ChatterboxFlashTokenizer.swift:80` 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 (26–31 lines × 2) · ×1
  • Duplicated block (26–31 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:232 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:232-257 | Sources/PersonaPlex/TemporalTransformer.swift:261-291 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (29–30 lines × 2) · ×1
  • Duplicated block (29–30 lines × 2) Sources/HibikiTranslate/HibikiTemporalTransformer.swift:280 — Sources/HibikiTranslate/HibikiTemporalTransformer.swift:280-308 | Sources/PersonaPlex/TemporalTransformer.swift:298-327 — before extracting anything, compare `Sources/HibikiTranslate/HibikiTemporalTransformer.swift` and `Sources/PersonaPlex/TemporalTransformer.swift` as WHOLE FILES: this scan already matched 15 separate duplicated blocks between them, totalling at least 204 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (26–30 lines × 2) · ×1
  • Duplicated block (26–30 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:113 — Sources/HibikiTranslate/HibikiWeightLoading.swift:113-138 | Sources/PersonaPlex/WeightLoading.swift:119-148 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (28–30 lines × 2) · ×1
  • Duplicated block (28–30 lines × 2) Sources/NemotronStreamingASR/Vocabulary.swift:249 — Sources/NemotronStreamingASR/Vocabulary.swift:249-276 | Sources/ParakeetStreamingASR/Vocabulary.swift:48-77 — `Sources/NemotronStreamingASR/Vocabulary.swift` and `Sources/ParakeetStreamingASR/Vocabulary.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 3 separate duplicated blocks between them, totalling at least 49 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 `Sources/NemotronStreamingASR/Vocabulary.swift:249` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/NemotronStreamingASR/Vocabulary.swift:248` calls `isSpecialToken` and `Sources/ParakeetStreamingASR/Vocabulary.swift:47` 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 (27–30 lines × 2) · ×1
  • Duplicated block (27–30 lines × 2) Sources/PersonaPlex/Sampling.swift:57 — Sources/PersonaPlex/Sampling.swift:57-86 | Sources/PersonaPlex/Sampling.swift:93-119 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/Sampling.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.
D4 · Code Duplication · Duplicated block (25–29 lines × 2) · ×1
  • Duplicated block (25–29 lines × 2) Sources/Qwen3ASR/FloatTextDecoder.swift:183 — Sources/Qwen3ASR/FloatTextDecoder.swift:183-207 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:202-230 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 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 `Sources/Qwen3ASR/FloatTextDecoder.swift:183` 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 (27–29 lines × 2) · ×1
  • Duplicated block (27–29 lines × 2) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:405 — Sources/VibeVoiceTTS/Inference/WeightLoader.swift:405-431 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:480-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 `Sources/VibeVoiceTTS/Inference/WeightLoader.swift:405` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on.
D4 · Code Duplication · Duplicated block (16–28 lines × 3) · ×1
  • Duplicated block (16–28 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:207 — Sources/PersonaPlex/PersonaPlex.swift:207-234 | Sources/PersonaPlex/PersonaPlex.swift:683-698 | Sources/PersonaPlex/PersonaPlex.swift:1078-1093 — 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 `Sources/PersonaPlex/PersonaPlex.swift:207` 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 (25–28 lines × 3) · ×1
  • Duplicated block (25–28 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:329 — Sources/PersonaPlex/PersonaPlex.swift:329-356 | Sources/PersonaPlex/PersonaPlex.swift:761-785 | Sources/PersonaPlex/PersonaPlex.swift:1146-1171 — 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 `Sources/PersonaPlex/PersonaPlex.swift:329` 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 (27–28 lines × 2) · ×1
  • Duplicated block (27–28 lines × 2) Sources/SpeechVAD/DiarizationHelpers.swift:157 — Sources/SpeechVAD/DiarizationHelpers.swift:157-184 | Sources/SpeechVAD/DiarizationHelpers.swift:258-284 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechVAD/DiarizationHelpers.swift:157` 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, `Sources/SpeechVAD/DiarizationHelpers.swift:187` calls `formUnion` and `Sources/SpeechVAD/DiarizationHelpers.swift:285` 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 (14–26 lines × 3) · ×1
  • Duplicated block (14–26 lines × 3) Sources/ChatterboxTTS/S3GenVocoder.swift:442 — Sources/ChatterboxTTS/S3GenVocoder.swift:442-456 | Sources/CosyVoiceTTS/HiFiGAN.swift:566-591 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:634-647 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:442` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (18–26 lines × 3) · ×1
  • Duplicated block (18–26 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:400 — Sources/PersonaPlex/PersonaPlex.swift:400-425 | Sources/PersonaPlex/PersonaPlex.swift:824-841 | Sources/PersonaPlex/PersonaPlex.swift:1232-1253 — 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 `Sources/PersonaPlex/PersonaPlex.swift:400` 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 (24–26 lines × 2) · ×1
  • Duplicated block (24–26 lines × 2) Sources/KokoroTTS/KokoroTTS.swift:369 — Sources/KokoroTTS/KokoroTTS.swift:369-394 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:98-121 — 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/KokoroTTS/KokoroTTS.swift:367` calls `info` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:97` 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 (20–26 lines × 2) · ×1
  • Duplicated block (20–26 lines × 2) Sources/VibeVoiceTTS/Inference/WeightLoader.swift:384 — Sources/VibeVoiceTTS/Inference/WeightLoader.swift:384-403 | Sources/VibeVoiceTTS/Inference/WeightLoader.swift:437-462 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. 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 (25–26 lines × 2) · ×1
  • Duplicated block (25–26 lines × 2) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1224 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1224-1248 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1281-1306 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1281` 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, `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1222` calls `dim`, `MLXArray` and `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:1281` 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 (18–25 lines × 2) · ×1
  • Duplicated block (18–25 lines × 2) Sources/NemotronStreamingASR/NemotronStreamingASR.swift:153 — Sources/NemotronStreamingASR/NemotronStreamingASR.swift:153-170 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:94-118 — `Sources/NemotronStreamingASR/NemotronStreamingASR.swift` and `Sources/ParakeetStreamingASR/ParakeetStreamingASR.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 8 separate duplicated blocks between them, totalling at least 118 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 `Sources/NemotronStreamingASR/NemotronStreamingASR.swift:153` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (21–25 lines × 2) · ×1
  • Duplicated block (21–25 lines × 2) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:98 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:98-118 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:222-246 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 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 `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:98` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–24 lines × 4) · ×1
  • Duplicated block (17–24 lines × 4) Sources/PersonaPlex/PersonaPlex.swift:223 — Sources/PersonaPlex/PersonaPlex.swift:223-246 | Sources/PersonaPlex/PersonaPlex.swift:692-708 | Sources/PersonaPlex/PersonaPlex.swift:1087-1104 | Sources/PersonaPlex/PersonaPlex.swift:1391-1407 — 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 `Sources/PersonaPlex/PersonaPlex.swift:223` 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 (21–23 lines × 4) · ×1
  • Duplicated block (21–23 lines × 4) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:59 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:59-81 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:63-83 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:193-214 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:285-305 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (22–23 lines × 3) · ×1
  • Duplicated block (22–23 lines × 3) Sources/MADLADTranslation/MADLADTranslator.swift:78 — Sources/MADLADTranslation/MADLADTranslator.swift:78-99 | Sources/Qwen3Chat/MLXGenerator.swift:129-151 | Sources/Qwen3Chat/Qwen35CoreMLChat.swift:79-101 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `MADLADTranslationConfig` in one and `Qwen3ChatConfig` 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 before the matched lines, `Sources/Qwen3Chat/MLXGenerator.swift:126` calls `acquireDefault`, `release` and `Sources/Qwen3Chat/Qwen35CoreMLChat.swift:78` 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–23 lines × 2) · ×1
  • Duplicated block (20–23 lines × 2) Sources/ChatterboxTTS/ChatterboxFlashTokenizer.swift:120 — Sources/ChatterboxTTS/ChatterboxFlashTokenizer.swift:120-139 | Sources/ChatterboxTTS/MTLTokenizer.swift:395-417 — 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 (21–23 lines × 2) · ×1
  • Duplicated block (21–23 lines × 2) Sources/MagpieTTSCoreML/CoreMLHelpers.swift:132 — Sources/MagpieTTSCoreML/CoreMLHelpers.swift:132-152 | Sources/MagpieTTSCoreML/NpyReader.swift:196-218 — 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 (18–23 lines × 2) · ×1
  • Duplicated block (18–23 lines × 2) Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:102 — Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:102-124 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:318-335 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:102` 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 (15–22 lines × 7) · ×1
  • Duplicated block (15–22 lines × 7) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:156 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:156-174 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:180-194 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:166-180 | Sources/Qwen3ASR/AudioPreprocessing.swift:217-238 | Sources/Qwen3ASR/AudioPreprocessing.swift:388-406 | Sources/SpeechVAD/MelFeatureExtractor.swift:162-180 | Sources/SpeechVAD/SortformerMelExtractor.swift:170-188 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 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 `Sources/CosyVoiceTTS/FlowMelExtractor.swift:180` 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–22 lines × 2) · ×1
  • Duplicated block (19–22 lines × 2) Sources/AudioCommon/WAVWriter.swift:16 — Sources/AudioCommon/WAVWriter.swift:16-37 | Sources/AudioCommon/WAVWriter.swift:61-79 — both copies are in the same file, so extract the 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 `sampleRate` to `Int = 24000` in one and `Int = 44100` 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 (13–22 lines × 2) · ×1
  • Duplicated block (13–22 lines × 2) Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:585 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:585-597 | Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift:604-625 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (18–22 lines × 2) · ×1
  • Duplicated block (18–22 lines × 2) Sources/HibikiTranslate/HibikiWeightLoading.swift:89 — Sources/HibikiTranslate/HibikiWeightLoading.swift:89-106 | Sources/PersonaPlex/WeightLoading.swift:69-90 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:89` 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 (5–22 lines × 3) · ×1
  • Duplicated block (5–22 lines × 3) Sources/HiggsTTS/HiggsTTSWeightLoading.swift:25 — Sources/HiggsTTS/HiggsTTSWeightLoading.swift:25-35 | Sources/IndicMioTTS/IndicMioQwen3.swift:224-245 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:213-217 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HiggsTTS/HiggsTTSWeightLoading.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. 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–22 lines × 2) · ×1
  • Duplicated block (12–22 lines × 2) Sources/IndicMioTTS/IndicMioTTSModel.swift:56 — Sources/IndicMioTTS/IndicMioTTSModel.swift:56-77 | Sources/Qwen3Chat/Qwen3DenseChat.swift:64-75 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (15–22 lines × 2) · ×1
  • Duplicated block (15–22 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:451 — Sources/PersonaPlex/PersonaPlex.swift:451-472 | Sources/PersonaPlex/PersonaPlex.swift:1514-1528 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:451` 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–21 lines × 4) · ×1
  • Duplicated block (10–21 lines × 4) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:46 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:46-64 | Sources/MossTranscribe/MossCoreMLRuntime.swift:318-338 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:60-69 | Sources/WhisperASR/WhisperASR.swift:70-87 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/MossTranscribe/MossCoreMLRuntime.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:46` 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 × 2) · ×1
  • Duplicated block (19–21 lines × 2) Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:120 — Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift:120-138 | Sources/ParakeetStreamingASR/RNNTGreedyDecoder.swift:136-156 — `Sources/NemotronStreamingASR/RNNTGreedyDecoder.swift` and `Sources/ParakeetStreamingASR/RNNTGreedyDecoder.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 5 separate duplicated blocks between them, totalling at least 62 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (21 lines × 2) · ×1
  • Duplicated block (21 lines × 2) Sources/SpeechVAD/SileroVAD.swift:258 — Sources/SpeechVAD/SileroVAD.swift:258-278 | Sources/SpeechVAD/WeSpeaker.swift:108-128 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD.swift` and `Sources/SpeechVAD/WeSpeaker.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 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 `Sources/SpeechVAD/SileroVAD.swift:258` 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 (3–21 lines × 3) · ×1
  • Duplicated block (3–21 lines × 3) Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:314 — Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:314-334 | Sources/VibeVoiceTTS/Models/VibeVoiceStreamModel.swift:477-496 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:570-572 — 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 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–20 lines × 3) · ×1
  • Duplicated block (9–20 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:477 — Sources/PersonaPlex/PersonaPlex.swift:477-496 | Sources/PersonaPlex/PersonaPlex.swift:862-870 | Sources/PersonaPlex/PersonaPlex.swift:1264-1274 — 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 `Sources/PersonaPlex/PersonaPlex.swift:477` 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 (18–20 lines × 3) · ×1
  • Duplicated block (18–20 lines × 3) Sources/SpeechVAD/FireRedVAD.swift:71 — Sources/SpeechVAD/FireRedVAD.swift:71-90 | Sources/SpeechVAD/SileroVAD.swift:292-309 | Sources/SpeechVAD/WeSpeaker.swift:142-159 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD.swift` and `Sources/SpeechVAD/WeSpeaker.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 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 `Sources/SpeechVAD/FireRedVAD.swift:71` 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 (16–20 lines × 3) · ×1
  • Duplicated block (16–20 lines × 3) Sources/SpeechVAD/SileroWeightLoading.swift:17 — Sources/SpeechVAD/SileroWeightLoading.swift:17-35 | Sources/SpeechVAD/WeSpeakerWeightLoading.swift:17-32 | Sources/SpeechVAD/WeightLoading.swift:17-36 — 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 `Sources/SpeechVAD/SileroWeightLoading.swift:17` 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 `model` to `SileroVADNetwork` in one and `WeSpeakerNetwork` 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–20 lines × 2) · ×1
  • Duplicated block (16–20 lines × 2) Sources/AudioServer/AudioServer.swift:1273 — Sources/AudioServer/AudioServer.swift:1273-1288 | Sources/AudioServer/AudioServer.swift:1483-1502 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited.
D4 · Code Duplication · Duplicated block (17–20 lines × 2) · ×1
  • Duplicated block (17–20 lines × 2) Sources/FlashSR/Mel.swift:160 — Sources/FlashSR/Mel.swift:160-179 | Sources/MLXCommon/SlaneyMel.swift:130-146 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (18–20 lines × 2) · ×1
  • Duplicated block (18–20 lines × 2) Sources/KokoroTTS/Phonemizer.swift:292 — Sources/KokoroTTS/Phonemizer.swift:292-311 | Sources/KokoroTTS/Phonemizer.swift:327-344 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/KokoroTTS/Phonemizer.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. 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 first that the copies are not typed on the same thing: the declarations holding them bind `fallback` to `LatinPhonemizer` in one and `HindiPhonemizer` 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 (14–20 lines × 2) · ×1
  • Duplicated block (14–20 lines × 2) Sources/Qwen3ASR/AudioPreprocessing.swift:244 — Sources/Qwen3ASR/AudioPreprocessing.swift:244-263 | Sources/Qwen3ASR/AudioPreprocessing.swift:408-421 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3ASR/AudioPreprocessing.swift:244` 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 (15–19 lines × 6) · ×1
  • Duplicated block (15–19 lines × 6) Sources/CosyVoiceTTS/LLM.swift:188 — Sources/CosyVoiceTTS/LLM.swift:188-204 | Sources/Qwen3ASR/FloatTextDecoder.swift:94-109 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:87-105 | Sources/Qwen3TTS/CodePredictor.swift:77-92 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:275-289 | Sources/Qwen3TTS/Talker.swift:87-103 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3ASR/FloatTextDecoder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:188` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The `return` at the foot of the matched lines is the enclosing body's own terminal exit, not an early one: it moves with them unchanged, and each site calls the extracted unit from the position that `return` occupied — no decision has to be handed back and re-acted on. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/Qwen3ASR/FloatTextDecoder.swift:92` calls `dim` and `Sources/CosyVoiceTTS/LLM.swift:184` 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 (16–19 lines × 3) · ×1
  • Duplicated block (16–19 lines × 3) Sources/CanaryASR/CanaryASR+Loading.swift:39 — Sources/CanaryASR/CanaryASR+Loading.swift:39-57 | Sources/OmnilingualASR/OmnilingualASR.swift:86-103 | Sources/ParakeetASR/ParakeetASR.swift:378-393 — before extracting anything, compare `Sources/CanaryASR/CanaryASR+Loading.swift` and `Sources/OmnilingualASR/OmnilingualASR.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 79 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/CanaryASR+Loading.swift:39` 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 (15–19 lines × 3) · ×1
  • Duplicated block (15–19 lines × 3) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:161 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:161-175 | Sources/ParakeetASR/MelPreprocessor.swift:199-217 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:419-433 — before extracting anything, compare `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetASR/MelPreprocessor.swift` as WHOLE FILES: this scan already matched 7 separate duplicated blocks between them, totalling at least 107 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:161` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (17–19 lines × 3) · ×1
  • Duplicated block (17–19 lines × 3) Sources/Qwen3ASR/FloatTextDecoder.swift:149 — Sources/Qwen3ASR/FloatTextDecoder.swift:149-165 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:156-174 | Sources/Qwen3TTS/CodePredictor.swift:115-131 — before extracting anything, compare `Sources/Qwen3ASR/FloatTextDecoder.swift` and `Sources/Qwen3ASR/QuantizedTextDecoder.swift` as WHOLE FILES: this scan already matched 16 separate duplicated blocks between them, totalling at least 206 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (11–19 lines × 2) · ×1
  • Duplicated block (11–19 lines × 2) Sources/PersonaPlex/PersonaPlex.swift:500 — Sources/PersonaPlex/PersonaPlex.swift:500-518 | Sources/PersonaPlex/PersonaPlex.swift:1541-1551 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/PersonaPlex/PersonaPlex.swift:500` 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–19 lines × 2) · ×1
  • Duplicated block (7–19 lines × 2) Sources/VibeVoiceTTS/Models/VibeVoice15BModel.swift:141 — Sources/VibeVoiceTTS/Models/VibeVoice15BModel.swift:141-147 | Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:631-649 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/VibeVoiceTTS/VibeVoiceTTSModel.swift:631` 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 (12–18 lines × 7) · ×1
  • Duplicated block (12–18 lines × 7) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:129 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:129-141 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:149-160 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:139-150 | Sources/Qwen3ASR/AudioPreprocessing.swift:175-192 | Sources/Qwen3ASR/AudioPreprocessing.swift:353-370 | Sources/SpeechVAD/MelFeatureExtractor.swift:135-147 | Sources/SpeechVAD/SortformerMelExtractor.swift:143-155 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 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, `Sources/CosyVoiceTTS/WhisperMelExtractor.swift:155` calls `max` and `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:145` 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 (8–18 lines × 6) · ×1
  • Duplicated block (8–18 lines × 6) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:49 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:49-63 | Sources/KokoroTTS/KokoroTTS.swift:377-391 | Sources/MossTranscribe/MossCoreMLRuntime.swift:321-338 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:105-119 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:61-68 | Sources/WhisperASR/WhisperASR.swift:73-87 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/KokoroTTS/KokoroTTS.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:49` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (15–18 lines × 4) · ×1
  • Duplicated block (15–18 lines × 4) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:55 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:55-69 | Sources/Qwen3ASR/AudioPreprocessing.swift:89-106 | Sources/SpeechVAD/MelFeatureExtractor.swift:58-72 | Sources/SpeechVAD/SortformerMelExtractor.swift:74-88 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/Qwen3ASR/AudioPreprocessing.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (17–18 lines × 3) · ×1
  • Duplicated block (17–18 lines × 3) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:43 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:43-60 | Sources/IndicMioTTS/IndicMioTTSModel.swift:58-74 | Sources/WhisperASR/WhisperASR.swift:67-84 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/WhisperASR/WhisperASR.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 73 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. 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–18 lines × 3) · ×1
  • Duplicated block (7–18 lines × 3) Sources/HibikiTranslate/HibikiTranslate.swift:225 — Sources/HibikiTranslate/HibikiTranslate.swift:225-242 | Sources/PersonaPlex/PersonaPlex.swift:860-866 | Sources/PersonaPlex/PersonaPlex.swift:1262-1270 — 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 `Sources/HibikiTranslate/HibikiTranslate.swift:225` 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. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/PersonaPlex/PersonaPlex.swift:869` calls `item` and `Sources/HibikiTranslate/HibikiTranslate.swift:242` 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 (14–18 lines × 3) · ×1
  • Duplicated block (14–18 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:644 — Sources/PersonaPlex/PersonaPlex.swift:644-660 | Sources/PersonaPlex/PersonaPlex.swift:1033-1050 | Sources/PersonaPlex/PersonaPlex.swift:1351-1364 — 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 `Sources/PersonaPlex/PersonaPlex.swift:644` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (16–18 lines × 2) · ×1
  • Duplicated block (16–18 lines × 2) Sources/CosyVoiceTTS/HiFiGAN.swift:509 — Sources/CosyVoiceTTS/HiFiGAN.swift:509-526 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:594-609 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/HiFiGAN.swift:509` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–18 lines × 2) · ×1
  • Duplicated block (11–18 lines × 2) Sources/NemotronStreamingASR/NemotronMLXNetwork.swift:184 — Sources/NemotronStreamingASR/NemotronMLXNetwork.swift:184-201 | Sources/VoiceChat/VoiceChatEncoder.swift:196-206 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice.
D4 · Code Duplication · Duplicated block (17–18 lines × 2) · ×1
  • Duplicated block (17–18 lines × 2) Sources/Qwen3ASR/CoreMLEncoder.swift:158 — Sources/Qwen3ASR/CoreMLEncoder.swift:158-175 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:466-482 — 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 (13–17 lines × 6) · ×1
  • Duplicated block (13–17 lines × 6) Sources/CanaryASR/CanaryASR+Loading.swift:23 — Sources/CanaryASR/CanaryASR+Loading.swift:23-35 | Sources/MossTranscribe/MossMLXRuntime.swift:114-130 | Sources/NemotronStreamingASR/NemotronMLXRuntime.swift:101-117 | Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:78-90 | Sources/OmnilingualASR/OmnilingualASR.swift:72-84 | Sources/ParakeetASR/ParakeetASR.swift:361-374 — before extracting anything, compare `Sources/CanaryASR/CanaryASR+Loading.swift` and `Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/CanaryASR+Loading.swift:23` 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, `Sources/CanaryASR/CanaryASR+Loading.swift:21` calls `info` and `Sources/MossTranscribe/MossMLXRuntime.swift:113` 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 (12–17 lines × 3) · ×1
  • Duplicated block (12–17 lines × 3) Sources/CanaryASR/CanaryASR+Loading.swift:42 — Sources/CanaryASR/CanaryASR+Loading.swift:42-58 | Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:92-103 | Sources/OmnilingualASR/OmnilingualASR.swift:91-104 — before extracting anything, compare `Sources/CanaryASR/CanaryASR+Loading.swift` and `Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 60 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/CanaryASR+Loading.swift:42` 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 (13–17 lines × 2) · ×1
  • Duplicated block (13–17 lines × 2) Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:154 — Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:154-170 | Sources/VoiceChatBenchmark/FullDuplexToolBench.swift:338-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. 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–16 lines × 5) · ×1
  • Duplicated block (8–16 lines × 5) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:42 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:42-57 | Sources/IndicMioTTS/IndicMioTTSModel.swift:57-72 | Sources/MossTranscribe/MossCoreMLRuntime.swift:312-327 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:56-63 | Sources/WhisperASR/WhisperASR.swift:66-81 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/MossTranscribe/MossCoreMLRuntime.swift` as WHOLE FILES: this scan already matched 3 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:42` 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–16 lines × 4) · ×1
  • Duplicated block (11–16 lines × 4) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:74 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:74-84 | Sources/Qwen3ASR/AudioPreprocessing.swift:113-128 | Sources/SpeechVAD/MelFeatureExtractor.swift:77-87 | Sources/SpeechVAD/SortformerMelExtractor.swift:93-103 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/Qwen3ASR/AudioPreprocessing.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 167 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:74` 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 (8–16 lines × 3) · ×1
  • Duplicated block (8–16 lines × 3) Sources/KokoroTTS/KokoroTTS.swift:373 — Sources/KokoroTTS/KokoroTTS.swift:373-388 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:101-116 | Sources/Qwen3Chat/Qwen3DenseChat.swift:65-72 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/KokoroTTS/KokoroTTS.swift:373` 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, `Sources/KokoroTTS/KokoroTTS.swift:367` calls `info` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:97` 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 (9–16 lines × 2) · ×1
  • Duplicated block (9–16 lines × 2) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:51 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:51-66 | Sources/SupertonicTTS/SupertonicTTS.swift:61-69 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:51` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (10–16 lines × 2) · ×1
  • Duplicated block (10–16 lines × 2) Sources/MADLADTranslation/MADLADModel.swift:48 — Sources/MADLADTranslation/MADLADModel.swift:48-63 | Sources/MADLADTranslation/MADLADModel.swift:167-176 — both copies are in the same file, so extract the block into one function there and call it from each site — the copies drift apart the first time only one of them is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MADLADTranslation/MADLADModel.swift:48` 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 (15–16 lines × 2) · ×1
  • Duplicated block (15–16 lines × 2) Sources/VoiceChat/VoiceChatSession.swift:1353 — Sources/VoiceChat/VoiceChatSession.swift:1353-1368 | Sources/VoiceChat/VoiceChatSession.swift:1454-1468 — both copies are in the same file, so extract the 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–15 lines × 12) · ×1
  • Duplicated block (10–15 lines × 12) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:160 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:160-172 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:183-193 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:169-179 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:113-122 | Sources/ParakeetASR/MelPreprocessor.swift:107-121 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:117-130 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:241-250 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:330-339 | Sources/Qwen3ASR/AudioPreprocessing.swift:222-235 | Sources/Qwen3ASR/AudioPreprocessing.swift:392-404 | Sources/SpeechVAD/MelFeatureExtractor.swift:166-178 | Sources/SpeechVAD/SortformerMelExtractor.swift:174-186 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. If that is what happened, the fix is to keep one copy and have the other call it (or delete it), which resolves this row and its siblings together — extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (14–15 lines × 6) · ×1
  • Duplicated block (14–15 lines × 6) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:94 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:94-108 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:123-136 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:114-127 | Sources/Qwen3ASR/AudioPreprocessing.swift:150-164 | Sources/SpeechVAD/MelFeatureExtractor.swift:97-111 | Sources/SpeechVAD/SortformerMelExtractor.swift:113-127 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 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 `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:94` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (14–15 lines × 4) · ×1
  • Duplicated block (14–15 lines × 4) Sources/CanaryASR/CanaryASR+Loading.swift:28 — Sources/CanaryASR/CanaryASR+Loading.swift:28-41 | Sources/NemotronStreamingASR/NemotronStreamingASR.swift:233-246 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:166-179 | Sources/SourceSeparation/SourceSeparation.swift:201-215 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/CanaryASR+Loading.swift:28` 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 `modelId` to `String? = nil` in one and `String = defaultModelId` 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 (15 lines × 3) · ×1
  • Duplicated block (15 lines × 3) Sources/CosyVoiceTTS/CamPlusPlusSpeaker.swift:63 — Sources/CosyVoiceTTS/CamPlusPlusSpeaker.swift:63-77 | Sources/SpeechVAD/SileroVAD.swift:302-316 | Sources/SpeechVAD/WeSpeaker.swift:152-166 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD.swift` and `Sources/SpeechVAD/WeSpeaker.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 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 `Sources/CosyVoiceTTS/CamPlusPlusSpeaker.swift:63` 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 (12–15 lines × 3) · ×1
  • Duplicated block (12–15 lines × 3) Sources/MagpieTTS/MagpieTTS.swift:166 — Sources/MagpieTTS/MagpieTTS.swift:166-177 | Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift:326-337 | Sources/Qwen3TTS/Qwen3TTS.swift:393-407 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/MagpieTTS/MagpieTTS.swift:166` 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 (9–15 lines × 3) · ×1
  • Duplicated block (9–15 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:506 — Sources/PersonaPlex/PersonaPlex.swift:506-520 | Sources/PersonaPlex/PersonaPlex.swift:876-884 | Sources/PersonaPlex/PersonaPlex.swift:1545-1553 — 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 `Sources/PersonaPlex/PersonaPlex.swift:506` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–15 lines × 2) · ×1
  • Duplicated block (11–15 lines × 2) Sources/ChatterboxTTS/S3GenVocoder.swift:370 — Sources/ChatterboxTTS/S3GenVocoder.swift:370-380 | Sources/CosyVoiceTTS/HiFiGAN.swift:458-472 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/S3GenVocoder.swift:370` 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 `hopLen` to `Int) -> (MLXArray` in one and `Int ) -> (MLXArray` 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 (10–14 lines × 6) · ×1
  • Duplicated block (10–14 lines × 6) Sources/CanaryASR/CanaryASR+Loading.swift:26 — Sources/CanaryASR/CanaryASR+Loading.swift:26-38 | Sources/NemotronStreamingASR/NemotronStreamingASR.swift:231-243 | Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:81-90 | Sources/OmnilingualASR/OmnilingualASR.swift:75-87 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:164-176 | Sources/SourceSeparation/SourceSeparation.swift:199-212 — 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 `Sources/CanaryASR/CanaryASR+Loading.swift:26` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `modelId` to `String? = nil` in one and `String = defaultModelId` 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 (10–14 lines × 4) · ×1
  • Duplicated block (10–14 lines × 4) Sources/PersonaPlex/PersonaPlex.swift:249 — Sources/PersonaPlex/PersonaPlex.swift:249-262 | Sources/PersonaPlex/PersonaPlex.swift:711-720 | Sources/PersonaPlex/PersonaPlex.swift:1107-1116 | Sources/PersonaPlex/PersonaPlex.swift:1410-1419 — 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 `Sources/PersonaPlex/PersonaPlex.swift:249` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (11–14 lines × 4) · ×1
  • Duplicated block (11–14 lines × 4) Sources/SpeechVAD/Nemotron3MLXModel.swift:330 — Sources/SpeechVAD/Nemotron3MLXModel.swift:330-340 | Sources/SpeechVAD/ReDimNet2Speaker.swift:145-158 | Sources/SpeechVAD/SileroVAD.swift:288-299 | Sources/SpeechVAD/WeSpeaker.swift:138-149 — before extracting anything, compare `Sources/SpeechVAD/SileroVAD.swift` and `Sources/SpeechVAD/WeSpeaker.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 78 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 before the matched lines, `Sources/SpeechVAD/ReDimNet2Speaker.swift:142` calls `modelCacheDirectory` and `Sources/SpeechVAD/Nemotron3MLXModel.swift:328` does not — after which the two agree again for 3 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (10–14 lines × 3) · ×1
  • Duplicated block (10–14 lines × 3) Sources/AsrBenchmark/EngineNemotron.swift:18 — Sources/AsrBenchmark/EngineNemotron.swift:18-27 | Sources/AsrBenchmark/EngineOmnilingual.swift:18-27 | Sources/AsrBenchmark/EngineParakeet.swift:18-31 — 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. 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–14 lines × 3) · ×1
  • Duplicated block (8–14 lines × 3) Sources/IndicMioTTS/IndicMioTTSModel.swift:53 — Sources/IndicMioTTS/IndicMioTTSModel.swift:53-66 | Sources/Qwen3Chat/Gemma4Chat.swift:84-93 | Sources/Qwen3Chat/Qwen3DenseChat.swift:61-68 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 3 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 3 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndicMioTTS/IndicMioTTSModel.swift:53` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. The matched lines also register a scope-exit action (a `defer`-style statement) that runs when the function holding them returns: moved into a called unit it would run when THAT unit returns instead — before the caller uses what it releases — so keep the registration at the call site and extract only the work around it, or have the extracted unit hand the resource back for the caller to register. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (9–14 lines × 2) · ×1
  • Duplicated block (9–14 lines × 2) Sources/AudioServer/AudioServer.swift:1643 — Sources/AudioServer/AudioServer.swift:1643-1651 | Sources/AudioServer/AudioServer.swift:1652-1665 — both copies are in the same file, so extract the 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–13 lines × 7) · ×1
  • Duplicated block (10–13 lines × 7) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:66 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:66-76 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:182-191 | Sources/ParakeetASR/MelPreprocessor.swift:225-234 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:440-449 | Sources/Qwen3ASR/AudioPreprocessing.swift:103-115 | Sources/SpeechVAD/MelFeatureExtractor.swift:69-79 | Sources/SpeechVAD/SortformerMelExtractor.swift:85-95 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times.
D4 · Code Duplication · Duplicated block (7–13 lines × 5) · ×1
  • Duplicated block (7–13 lines × 5) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41-52 | Sources/KokoroTTS/KokoroTTS.swift:372-383 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:100-111 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:55-61 | Sources/SpeechWakeWord/SpeechWakeWord.swift:178-190 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/KokoroTTS/KokoroTTS.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41` 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, `Sources/KokoroTTS/KokoroTTS.swift:367` calls `info` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:97` 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 (12–13 lines × 3) · ×1
  • Duplicated block (12–13 lines × 3) Sources/AudioCLILib/SpeakCommand.swift:2062 — Sources/AudioCLILib/SpeakCommand.swift:2062-2073 | Sources/AudioCLILib/SpeakCommand.swift:2085-2096 | Sources/AudioCLILib/SpeakCommand.swift:2131-2143 — 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 `Sources/AudioCLILib/SpeakCommand.swift:2131` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–13 lines × 3) · ×1
  • Duplicated block (9–13 lines × 3) Sources/AudioServer/AudioServer.swift:152 — Sources/AudioServer/AudioServer.swift:152-161 | Sources/AudioServer/AudioServer.swift:241-253 | Sources/AudioServer/AudioServer.swift:328-336 — 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 `Sources/AudioServer/AudioServer.swift:152` 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 (8–13 lines × 3) · ×1
  • Duplicated block (8–13 lines × 3) Sources/BreezeTTS/BreezeTTSModel.swift:57 — Sources/BreezeTTS/BreezeTTSModel.swift:57-64 | Sources/F5TTS/F5TTSModel.swift:47-59 | Sources/HiggsTTS/HiggsTTSModel.swift:98-110 — 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 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–12 lines × 13) · ×1
  • Duplicated block (7–12 lines × 13) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:160 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:160-169 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:183-189 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:169-175 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:113-119 | Sources/ParakeetASR/MelPreprocessor.swift:107-118 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:117-127 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:241-247 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:330-336 | Sources/Qwen3ASR/AudioPreprocessing.swift:222-232 | Sources/Qwen3ASR/AudioPreprocessing.swift:392-401 | Sources/SpeechVAD/MelFeatureExtractor.swift:166-175 | Sources/SpeechVAD/SortformerMelExtractor.swift:174-183 | Sources/SpeechWakeWord/KaldiFbank.swift:228-234 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 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 `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:160` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately.
D4 · Code Duplication · Duplicated block (7–12 lines × 5) · ×1
  • Duplicated block (7–12 lines × 5) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:40 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:40-51 | Sources/KokoroTTS/KokoroTTS.swift:372-382 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:100-110 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:54-61 | Sources/SupertonicTTS/SupertonicTTS.swift:56-62 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/KokoroTTS/KokoroTTS.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:40` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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, `Sources/KokoroTTS/KokoroTTS.swift:367` calls `info` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:97` does not — after which the two agree again for 2 more lines. One of those two behaviours is the intended one and the other is what a copy-paste left behind, so decide which BEFORE unifying them: extracting the shared part will silently settle it, and if the copy that skips the call is the wrong one, that bug is already live.
D4 · Code Duplication · Duplicated block (11–12 lines × 5) · ×1
  • Duplicated block (11–12 lines × 5) Sources/FishAudioTTS/FishAudioDualAR.swift:125 — Sources/FishAudioTTS/FishAudioDualAR.swift:125-135 | Sources/HiggsTTS/HiggsTTSBackbone.swift:63-73 | Sources/IndicMioTTS/IndicMioQwen3.swift:58-68 | Sources/Qwen3Chat/Qwen35Model.swift:397-408 | Sources/Qwen3Chat/Qwen3DenseModel.swift:112-122 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FishAudioTTS/FishAudioDualAR.swift:125` 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 `cache` to `(MLXArray, MLXArray)?` in one and `(MLXArray, MLXArray)? = nil` in another, and the duplicated lines use it. The extracted unit therefore needs a parameter type that fits BOTH — their common supertype where they have one, or a new abstraction over them where they do not — and settling that is the step that comes BEFORE the extraction above. Where the two types are deliberately unrelated, the duplication is the price of that separation and the honest resolution is to record the decision rather than to extract.
D4 · Code Duplication · Duplicated block (11–12 lines × 3) · ×1
  • Duplicated block (11–12 lines × 3) Sources/HibikiTranslate/HibikiWeightLoading.swift:95 — Sources/HibikiTranslate/HibikiWeightLoading.swift:95-105 | Sources/PersonaPlex/MimiCodec.swift:254-265 | Sources/PersonaPlex/WeightLoading.swift:78-89 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (9–12 lines × 3) · ×1
  • Duplicated block (9–12 lines × 3) Sources/MLXCommon/WeightLoading.swift:73 — Sources/MLXCommon/WeightLoading.swift:73-81 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:174-182 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:723-734 — 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.
D4 · Code Duplication · Duplicated block (12 lines × 3) · ×1
  • Duplicated block (12 lines × 3) Sources/PersonaPlex/Configuration.swift:107 — Sources/PersonaPlex/Configuration.swift:107-118 | Sources/PersonaPlex/Configuration.swift:159-170 | Sources/PersonaPlex/Configuration.swift:298-309 — 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 `Sources/PersonaPlex/Configuration.swift:107` 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 × 2) · ×1
  • Duplicated block (9–12 lines × 2) Sources/Qwen3Chat/MLXGenerator.swift:397 — Sources/Qwen3Chat/MLXGenerator.swift:397-408 | Sources/Qwen3Chat/Qwen3DenseChat.swift:157-165 — the copies sit in sibling files of one directory, so a shared home is within easy reach: extract the block into a single shared function the call sites can all reach — a file they already depend on, or a new one alongside them — and call it from both call sites, so a change lands once. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/Qwen3Chat/MLXGenerator.swift:397` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (9–11 lines × 9) · ×1
  • Duplicated block (9–11 lines × 9) Sources/CosyVoiceTTS/LLM.swift:187 — Sources/CosyVoiceTTS/LLM.swift:187-197 | Sources/HiggsTTS/HiggsTTSBackbone.swift:58-66 | Sources/IndicMioTTS/IndicMioQwen3.swift:53-61 | Sources/Qwen3ASR/FloatTextDecoder.swift:93-102 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:86-96 | Sources/Qwen3Chat/Qwen35Model.swift:391-400 | Sources/Qwen3TTS/CodePredictor.swift:76-85 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:274-282 | Sources/Qwen3TTS/Talker.swift:86-96 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3ASR/FloatTextDecoder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Note first that the copies are not typed on the same thing: the declarations holding them bind `cache` to `(MLXArray, MLXArray)?` in one and `(MLXArray, MLXArray)? = nil ) -> (MLXArray` 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 before the matched lines, `Sources/HiggsTTS/HiggsTTSBackbone.swift:57` calls `dim` and `Sources/CosyVoiceTTS/LLM.swift:184` 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–11 lines × 7) · ×1
  • Duplicated block (7–11 lines × 7) Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:146 — Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:146-153 | Sources/CosyVoiceTTS/FlowMelExtractor.swift:168-178 | Sources/CosyVoiceTTS/WhisperMelExtractor.swift:158-164 | Sources/Qwen3ASR/AudioPreprocessing.swift:204-213 | Sources/Qwen3ASR/AudioPreprocessing.swift:377-385 | Sources/SpeechVAD/MelFeatureExtractor.swift:152-159 | Sources/SpeechVAD/SortformerMelExtractor.swift:160-167 — before extracting anything, compare `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift` and `Sources/CosyVoiceTTS/FlowMelExtractor.swift` as WHOLE FILES: this scan already matched 6 separate duplicated blocks between them, totalling at least 93 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 `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:146` 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, `Sources/CosyVoiceTTS/WhisperMelExtractor.swift:155` calls `max` and `Sources/CosyVoiceTTS/CamPlusPlusMelExtractor.swift:143` 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–11 lines × 6) · ×1
  • Duplicated block (3–11 lines × 6) Sources/CosyVoiceTTS/LLM.swift:436 — Sources/CosyVoiceTTS/LLM.swift:436-446 | Sources/Qwen3ASR/FloatTextDecoder.swift:210-217 | Sources/Qwen3ASR/QuantizedTextDecoder.swift:233-241 | Sources/Qwen3TTS/CodePredictor.swift:204-211 | Sources/Qwen3TTS/SpeechTokenizerDecoder.swift:376-378 | Sources/Qwen3TTS/Talker.swift:257-267 — before extracting anything, compare `Sources/CosyVoiceTTS/LLM.swift` and `Sources/Qwen3ASR/FloatTextDecoder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 56 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CosyVoiceTTS/LLM.swift:436` 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 (11 lines × 3) · ×1
  • Duplicated block (11 lines × 3) Sources/AudioCLILib/SpeakCommand.swift:1532 — Sources/AudioCLILib/SpeakCommand.swift:1532-1542 | Sources/AudioCLILib/SpeakCommand.swift:1587-1597 | Sources/AudioCLILib/SpeakCommand.swift:1646-1656 — 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 `Sources/AudioCLILib/SpeakCommand.swift:1532` it runs out through the closing brace of the declaration holding it — the window is that declaration's tail, not a fragment that begins part-way through something, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–11 lines × 3) · ×1
  • Duplicated block (7–11 lines × 3) Sources/HiggsTTS/HiggsTTSBackbone.swift:53 — Sources/HiggsTTS/HiggsTTSBackbone.swift:53-61 | Sources/Qwen3Chat/Qwen35Model.swift:385-395 | Sources/Qwen3Chat/Qwen3DenseModel.swift:103-109 — 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. 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 `cache` to `(MLXArray, MLXArray)?` in one and `(MLXArray, MLXArray)? = nil` 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 (10–11 lines × 3) · ×1
  • Duplicated block (10–11 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:387 — Sources/PersonaPlex/PersonaPlex.swift:387-397 | Sources/PersonaPlex/PersonaPlex.swift:812-821 | Sources/PersonaPlex/PersonaPlex.swift:1219-1229 — 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 `Sources/PersonaPlex/PersonaPlex.swift:387` 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 (4–11 lines × 5) · ×1
  • Duplicated block (4–11 lines × 5) Sources/AudioCLILib/TranscribeCommand.swift:209 — Sources/AudioCLILib/TranscribeCommand.swift:209-212 | Sources/AudioCLILib/TranscribeCommand.swift:235-238 | Sources/AudioCLILib/TranscribeCommand.swift:394-403 | Sources/AudioCLILib/TranscribeCommand.swift:429-439 | Sources/AudioCLILib/TranscribeCommand.swift:579-582 — 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 `Sources/AudioCLILib/TranscribeCommand.swift:394` 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, `Sources/AudioCLILib/TranscribeCommand.swift:582` calls `Float` and `Sources/AudioCLILib/TranscribeCommand.swift:403` 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 (8–11 lines × 2) · ×1
  • Duplicated block (8–11 lines × 2) Sources/MagpieTTS/Decoder.swift:42 — Sources/MagpieTTS/Decoder.swift:42-52 | Sources/MagpieTTS/TextEncoder.swift:19-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 `Sources/MagpieTTS/Decoder.swift:42` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `config` to `MagpieDecoderConfig` in one and `MagpieTextEncoderConfig` 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 (5–11 lines × 2) · ×1
  • Duplicated block (5–11 lines × 2) Sources/Qwen3Chat/Gemma4WeightLoading.swift:56 — Sources/Qwen3Chat/Gemma4WeightLoading.swift:56-60 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:102-112 — 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 `Sources/Qwen3Chat/Gemma4WeightLoading.swift:56` 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 × 7) · ×1
  • Duplicated block (10 lines × 7) Sources/CanaryASR/CanaryASR+Loading.swift:26 — Sources/CanaryASR/CanaryASR+Loading.swift:26-36 | Sources/NemotronStreamingASR/NemotronStreamingASR.swift:231-241 | Sources/OmnilingualASR/MLX/OmnilingualMLXModel.swift:81-90 | Sources/OmnilingualASR/OmnilingualASR.swift:75-85 | Sources/ParakeetASR/ParakeetASR.swift:364-375 | Sources/ParakeetStreamingASR/ParakeetStreamingASR.swift:164-174 | Sources/SourceSeparation/SourceSeparation.swift:199-210 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 7 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 7 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/CanaryASR/CanaryASR+Loading.swift:26` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `modelId` to `String? = nil` in one and `String = defaultModelId` 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 (10 lines × 4) · ×1
  • Duplicated block (10 lines × 4) Sources/HibikiTranslate/HibikiDepformer.swift:136 — Sources/HibikiTranslate/HibikiDepformer.swift:136-145 | Sources/HibikiTranslate/HibikiTemporalTransformer.swift:68-77 | Sources/PersonaPlex/Depformer.swift:112-121 | Sources/PersonaPlex/TemporalTransformer.swift:70-79 — before extracting anything, compare `Sources/HibikiTranslate/HibikiDepformer.swift` and `Sources/PersonaPlex/Depformer.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 125 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiDepformer.swift:136` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (7–10 lines × 4) · ×1
  • Duplicated block (7–10 lines × 4) Sources/HibikiTranslate/HibikiWeightLoading.swift:117 — Sources/HibikiTranslate/HibikiWeightLoading.swift:117-123 | Sources/HibikiTranslate/HibikiWeightLoading.swift:155-161 | Sources/PersonaPlex/WeightLoading.swift:123-132 | Sources/PersonaPlex/WeightLoading.swift:167-176 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:117` 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 (9–10 lines × 3) · ×1
  • Duplicated block (9–10 lines × 3) Sources/AudioCLILib/TranscribeCommand.swift:564 — Sources/AudioCLILib/TranscribeCommand.swift:564-572 | Sources/AudioCLILib/TranscribeCommand.swift:628-637 | Sources/AudioCLILib/TranscribeCommand.swift:658-667 — all 3 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/TranscribeCommand.swift:564` 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–10 lines × 3) · ×1
  • Duplicated block (6–10 lines × 3) Sources/MagpieTTSCoreML/LocalTransformer.swift:218 — Sources/MagpieTTSCoreML/LocalTransformer.swift:218-223 | Sources/ParakeetASR/MelPreprocessor.swift:159-168 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:160-167 — before extracting anything, compare `Sources/ParakeetASR/MelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift` as WHOLE FILES: this scan already matched 12 separate duplicated blocks between them, totalling at least 162 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place.
D4 · Code Duplication · Duplicated block (7–10 lines × 3) · ×1
  • Duplicated block (7–10 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:859 — Sources/PersonaPlex/PersonaPlex.swift:859-866 | Sources/PersonaPlex/PersonaPlex.swift:1261-1270 | Sources/PersonaPlex/PersonaPlex.swift:1530-1536 — 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 `Sources/PersonaPlex/PersonaPlex.swift:859` 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, `Sources/PersonaPlex/PersonaPlex.swift:869` calls `item` and `Sources/PersonaPlex/PersonaPlex.swift:1540` 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–10 lines × 2) · ×1
  • Duplicated block (8–10 lines × 2) Sources/FlashSR/Downloader.swift:13 — Sources/FlashSR/Downloader.swift:13-20 | Sources/MagpieTTS/Downloader.swift:19-28 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/FlashSR/Downloader.swift:13` 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. Note first that the copies are not typed on the same thing: the declarations holding them bind `variant` to `FlashSRVariant` in one and `MagpieTTSVariant = .int8` 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 × 15) · ×1
  • Duplicated block (8–9 lines × 15) Sources/PersonaPlex/PersonaPlex.swift:205 — Sources/PersonaPlex/PersonaPlex.swift:205-213 | Sources/PersonaPlex/PersonaPlex.swift:245-252 | Sources/PersonaPlex/PersonaPlex.swift:261-268 | Sources/PersonaPlex/PersonaPlex.swift:275-282 | Sources/PersonaPlex/PersonaPlex.swift:681-688 | Sources/PersonaPlex/PersonaPlex.swift:707-714 | Sources/PersonaPlex/PersonaPlex.swift:719-726 | Sources/PersonaPlex/PersonaPlex.swift:731-738 | Sources/PersonaPlex/PersonaPlex.swift:1076-1083 | Sources/PersonaPlex/PersonaPlex.swift:1103-1110 | Sources/PersonaPlex/PersonaPlex.swift:1115-1122 | Sources/PersonaPlex/PersonaPlex.swift:1127-1134 | Sources/PersonaPlex/PersonaPlex.swift:1406-1413 | Sources/PersonaPlex/PersonaPlex.swift:1418-1425 | Sources/PersonaPlex/PersonaPlex.swift:1430-1437 — all 15 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, `Sources/PersonaPlex/PersonaPlex.swift:741` calls `asType`, `eval` and `Sources/PersonaPlex/PersonaPlex.swift:273` 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 (9 lines × 5) · ×1
  • Duplicated block (9 lines × 5) Sources/CanaryASR/MelPreprocessor.swift:68 — Sources/CanaryASR/MelPreprocessor.swift:68-76 | Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:67-75 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:71-79 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:201-209 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:293-301 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (7–9 lines × 4) · ×1
  • Duplicated block (7–9 lines × 4) Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:93 — Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift:93-99 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:95-103 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:217-223 | Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift:312-319 — `Sources/NemotronStreamingASR/StreamingMelPreprocessor.swift` and `Sources/ParakeetStreamingASR/StreamingMelPreprocessor.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 16 separate duplicated blocks between them, totalling at least 216 lines. If both are selected at run time, neither can be retired in favour of the other, and the lines that DIFFER between them are the reason both exist. The move that pays here is to hoist the identical part into a shared location the whole family can reach and give what differs a parameter or a seam, so a change lands once instead of once per sibling; extracting one helper per block leaves every sibling to drift on its own.
D4 · Code Duplication · Duplicated block (6–9 lines × 3) · ×1
  • Duplicated block (6–9 lines × 3) Sources/PersonaPlex/PersonaPlex.swift:291 — Sources/PersonaPlex/PersonaPlex.swift:291-299 | Sources/PersonaPlex/PersonaPlex.swift:743-749 | Sources/PersonaPlex/PersonaPlex.swift:1442-1447 — 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 `Sources/PersonaPlex/PersonaPlex.swift:291` 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 (2–9 lines × 6) · ×1
  • Duplicated block (2–9 lines × 6) Sources/Qwen3ASR/WeightLoading.swift:244 — Sources/Qwen3ASR/WeightLoading.swift:244-245 | Sources/Qwen3ASR/WeightLoading.swift:248-249 | Sources/Qwen3ASR/WeightLoading.swift:266-267 | Sources/Qwen3ASR/WeightLoading.swift:268-269 | Sources/Qwen3TTS/TTSWeightLoading.swift:125-133 | Sources/Qwen3TTS/TTSWeightLoading.swift:200-207 — there are 6 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 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 `Sources/Qwen3TTS/TTSWeightLoading.swift:125` 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 (6–8 lines × 6) · ×1
  • Duplicated block (6–8 lines × 6) Sources/PersonaPlex/PersonaPlex.swift:201 — Sources/PersonaPlex/PersonaPlex.swift:201-208 | Sources/PersonaPlex/PersonaPlex.swift:290-296 | Sources/PersonaPlex/PersonaPlex.swift:679-684 | Sources/PersonaPlex/PersonaPlex.swift:742-747 | Sources/PersonaPlex/PersonaPlex.swift:1074-1079 | Sources/PersonaPlex/PersonaPlex.swift:1441-1446 — 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 `Sources/PersonaPlex/PersonaPlex.swift:201` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that.
D4 · Code Duplication · Duplicated block (8 lines × 5) · ×1
  • Duplicated block (8 lines × 5) Sources/NemotronStreamingASR/NemotronStreamingASR+Protocols.swift:7 — Sources/NemotronStreamingASR/NemotronStreamingASR+Protocols.swift:7-14 | Sources/OmnilingualASR/MLX/OmnilingualASRMLXModel+Protocols.swift:8-15 | Sources/OmnilingualASR/OmnilingualASR+Protocols.swift:9-16 | Sources/ParakeetASR/ParakeetASR+Protocols.swift:7-14 | Sources/ParakeetStreamingASR/ParakeetStreamingASR+Protocols.swift:8-15 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times.
D4 · Code Duplication · Duplicated block (2–8 lines × 4) · ×1
  • Duplicated block (2–8 lines × 4) Sources/AudioCLILib/DiarizeCommand.swift:423 — Sources/AudioCLILib/DiarizeCommand.swift:423-424 | Sources/AudioCLILib/DiarizeCommand.swift:444-451 | Sources/AudioCLILib/VadCommand.swift:130-137 | Sources/AudioCLILib/VadStreamCommand.swift:168-175 — there are 4 copies across 3 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/DiarizeCommand.swift:423` 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 (7 lines × 6) · ×1
  • Duplicated block (7 lines × 6) Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41 — Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41-52 | Sources/KokoroTTS/KokoroTTS.swift:372-383 | Sources/Qwen3ASR/CoreMLForcedAligner.swift:100-111 | Sources/Qwen3TTSCoreML/Qwen3TTSCoreML.swift:55-61 | Sources/SpeechWakeWord/SpeechWakeWord.swift:178-189 | Sources/SupertonicTTS/SupertonicTTS.swift:57-63 — before extracting anything, compare `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift` and `Sources/KokoroTTS/KokoroTTS.swift` as WHOLE FILES: this scan already matched 4 separate duplicated blocks between them, totalling at least 55 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/ChatterboxTTS/ChatterboxFlashCoreMLModel.swift:41` 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, `Sources/KokoroTTS/KokoroTTS.swift:367` calls `info` and `Sources/Qwen3ASR/CoreMLForcedAligner.swift:97` 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–7 lines × 4) · ×1
  • Duplicated block (3–7 lines × 4) Sources/FishAudioTTS/FishAudioTokenizer.swift:88 — Sources/FishAudioTTS/FishAudioTokenizer.swift:88-90 | Sources/Qwen3Chat/ChatTokenizer.swift:49-55 | Sources/Qwen3Chat/Gemma4Tokenizer.swift:43-48 | Sources/VoiceChat/VoiceChatTokenizer.swift:89-91 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 4 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 4 times. 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–7 lines × 2) · ×1
  • Duplicated block (6–7 lines × 2) Sources/Qwen3Chat/Qwen35CoreMLChat.swift:45 — Sources/Qwen3Chat/Qwen35CoreMLChat.swift:45-50 | Sources/SpeechCore/MemoryTier.swift:77-83 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/SpeechCore/MemoryTier.swift:77` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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 (2–6 lines × 5) · ×1
  • Duplicated block (2–6 lines × 5) Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:94 — Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:94-99 | Sources/IndicMioTTS/IndicMioWavLM.swift:430-435 | Sources/IndicMioTTS/MioCodecWaveDecoder.swift:550-555 | Sources/MLXCommon/WeightLoading.swift:250-256 | Sources/Qwen3TTS/TTSWeightLoading+Encoder.swift:87-88 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere all 5 call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made 5 times. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:94` 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, `Sources/IndexTTS2TTS/IndexTTS2S2Mel.swift:100` calls `value`, `asType` and `Sources/MLXCommon/WeightLoading.swift:256` 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–6 lines × 3) · ×1
  • Duplicated block (3–6 lines × 3) Sources/Qwen3TTS/Qwen3TTS+ICL.swift:216 — Sources/Qwen3TTS/Qwen3TTS+ICL.swift:216-218 | Sources/Qwen3TTS/Qwen3TTS.swift:241-246 | Sources/Qwen3TTS/Qwen3TTS.swift:347-352 — 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 `Sources/Qwen3TTS/Qwen3TTS.swift:241` 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, `Sources/Qwen3TTS/Qwen3TTS.swift:240` calls `checkCancellation` and `Sources/Qwen3TTS/Qwen3TTS.swift:346` 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 (5 lines × 14) · ×1
  • Duplicated block (5 lines × 14) Sources/PersonaPlex/PersonaPlex.swift:203 — Sources/PersonaPlex/PersonaPlex.swift:203-208 | Sources/PersonaPlex/PersonaPlex.swift:244-248 | Sources/PersonaPlex/PersonaPlex.swift:274-278 | Sources/PersonaPlex/PersonaPlex.swift:291-296 | Sources/PersonaPlex/PersonaPlex.swift:680-684 | Sources/PersonaPlex/PersonaPlex.swift:706-710 | Sources/PersonaPlex/PersonaPlex.swift:730-734 | Sources/PersonaPlex/PersonaPlex.swift:743-747 | Sources/PersonaPlex/PersonaPlex.swift:1075-1079 | Sources/PersonaPlex/PersonaPlex.swift:1102-1106 | Sources/PersonaPlex/PersonaPlex.swift:1126-1130 | Sources/PersonaPlex/PersonaPlex.swift:1405-1409 | Sources/PersonaPlex/PersonaPlex.swift:1429-1433 | Sources/PersonaPlex/PersonaPlex.swift:1442-1446 — all 14 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just before the matched lines, `Sources/PersonaPlex/PersonaPlex.swift:288` calls `asType`, `eval` and `Sources/PersonaPlex/PersonaPlex.swift:270` 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 × 8) · ×1
  • Duplicated block (3–5 lines × 8) Sources/AudioCLILib/TranscribeCommand.swift:211 — Sources/AudioCLILib/TranscribeCommand.swift:211-213 | Sources/AudioCLILib/TranscribeCommand.swift:237-239 | Sources/AudioCLILib/TranscribeCommand.swift:469-473 | Sources/AudioCLILib/TranscribeCommand.swift:507-511 | Sources/AudioCLILib/TranscribeCommand.swift:535-539 | Sources/AudioCLILib/TranscribeCommand.swift:581-583 | Sources/AudioCLILib/TranscribeCommand.swift:609-613 | Sources/AudioCLILib/TranscribeCommand.swift:640-644 — all 8 copies are in the same file, so extract the block into one function there and call it from every one of those sites — resolving only two of them leaves the rest to drift apart the first time one is edited. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/AudioCLILib/TranscribeCommand.swift:211` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/AudioCLILib/TranscribeCommand.swift:511` calls `Float` and `Sources/AudioCLILib/TranscribeCommand.swift:213` 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 (2–5 lines × 4) · ×1
  • Duplicated block (2–5 lines × 4) Sources/Qwen3ASR/WeightLoading.swift:234 — Sources/Qwen3ASR/WeightLoading.swift:234-238 | Sources/Qwen3ASR/WeightLoading.swift:239-240 | Sources/Qwen3TTS/TTSWeightLoading.swift:105-111 | Sources/Qwen3TTS/TTSWeightLoading.swift:183-188 — 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 `Sources/Qwen3ASR/WeightLoading.swift:234` 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, `Sources/Qwen3ASR/WeightLoading.swift:240` calls `applyQuantizedLinearWeights` and `Sources/Qwen3ASR/WeightLoading.swift:244` 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 × 5) · ×1
  • Duplicated block (3–5 lines × 5) Sources/ChatterboxTTS/ChatterboxTTSModel.swift:192 — Sources/ChatterboxTTS/ChatterboxTTSModel.swift:192-194 | Sources/FlashSR/FlashSR.swift:109-111 | Sources/Qwen3Chat/Gemma4WeightLoading.swift:34-40 | Sources/Qwen3Chat/Qwen35WeightLoading.swift:71-78 | Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift:25-29 — before extracting anything, compare `Sources/Qwen3Chat/Gemma4WeightLoading.swift` and `Sources/Qwen3Chat/Qwen3DenseWeightLoading.swift` as WHOLE FILES: this scan already matched 5 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 `Sources/ChatterboxTTS/ChatterboxTTSModel.swift:192` it begins part-way through the construct above it, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. Note that the copies do not run to the end of the range shown: their LAST lines are different code, not the same code under different names — the matched region ends inside that line. Extract the lines above it, and read the last line of each site separately. ★ These copies have DRIFTED, and that is worth reading before extracting anything: just after the matched lines, `Sources/Qwen3Chat/Gemma4WeightLoading.swift:40` calls `hasPrefix` and `Sources/ChatterboxTTS/ChatterboxTTSModel.swift:194` 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 (4–5 lines × 3) · ×1
  • Duplicated block (4–5 lines × 3) Sources/HibikiTranslate/HibikiWeightLoading.swift:206 — Sources/HibikiTranslate/HibikiWeightLoading.swift:206-210 | Sources/MagpieTTS/WeightLoader.swift:181-184 | Sources/PersonaPlex/WeightLoading.swift:220-224 — before extracting anything, compare `Sources/HibikiTranslate/HibikiWeightLoading.swift` and `Sources/PersonaPlex/WeightLoading.swift` as WHOLE FILES: this scan already matched 10 separate duplicated blocks between them, totalling at least 164 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Sources/HibikiTranslate/HibikiWeightLoading.swift:206` 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 (2–5 lines × 12) · ×1
  • Duplicated block (2–5 lines × 12) Sources/VoxCPM2TTS/VoxCPM2TTS.swift:612 — Sources/VoxCPM2TTS/VoxCPM2TTS.swift:612-614 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:615-619 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:621-625 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:626-629 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:644-645 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:650-651 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:656-657 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:662-663 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:668-669 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:674-675 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:680-681 | Sources/VoxCPM2TTS/VoxCPM2TTS.swift:687-688 — all 12 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 `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:612` 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, `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:625` calls `loadWithDiagnostics` and `Sources/VoxCPM2TTS/VoxCPM2TTS.swift:614` 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 (7 lines × 4) · ×1
  • Duplicated block (7 lines × 4) Sources/OmnilingualASR/MLX/Wav2Vec2Frontend.swift:38 — Sources/OmnilingualASR/MLX/Wav2Vec2Frontend.swift:38-44 | Sources/VoxCPM2TTS/AudioVAE.swift:168-174 | Sources/VoxCPM2TTS/AudioVAE.swift:185-191 | Sources/VoxCPM2TTS/AudioVAE.swift:202-208 — there are 4 copies across 2 file(s) — more copies than files, so at least one file holds the block twice. Extract it once into a single shared function every call site can reach and call it from all 4 sites; resolving a subset leaves the remainder to drift apart.
D4 · Code Duplication · Duplicated block (3–15 lines × 4) · ×1
  • Duplicated block (3–15 lines × 4) scripts/render_benchmark_dashboard.py:212 — scripts/render_benchmark_dashboard.py:212-214 | scripts/render_benchmark_dashboard.py:252-266 | scripts/render_benchmark_dashboard.py:286-300 | scripts/render_benchmark_dashboard.py:500-502 — 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 `scripts/render_benchmark_dashboard.py:252` 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 (34–36 lines × 2) · ×1
  • Duplicated block (34–36 lines × 2) Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:19 — Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:19-52 | Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift:29-64 — before extracting anything, compare `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift` and `Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:19` it does not close everything it opens, so those exact lines cannot be lifted as they stand — widen the region to the smallest complete statement or declaration that contains it, and extract that. 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–13 lines × 3) · ×1
  • Duplicated block (11–13 lines × 3) Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39 — Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39-51 | Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift:51-63 | Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:545-555 — before extracting anything, compare `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift` and `Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (10–11 lines × 4) · ×1
  • Duplicated block (10–11 lines × 4) Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:71 — Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:71-81 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:105-115 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:173-182 | Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:543-552 — 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 `Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:71` 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 (9 lines × 4) · ×1
  • Duplicated block (9 lines × 4) Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39 — Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39-48 | Examples/PersonaPlexDemo/PersonaPlexDemo/AudioRecorder.swift:174-182 | Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift:51-60 | Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:544-552 — before extracting anything, compare `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift` and `Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:39` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 3) · ×1
  • Duplicated block (7–9 lines × 3) Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:26 — Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:26-33 | Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift:37-45 | Examples/iOSEchoDemo/iOSEchoDemo/CompanionChatViewModel.swift:526-532 — before extracting anything, compare `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift` and `Examples/SpeechDemo/SpeechDemo/AudioRecorder.swift` as WHOLE FILES: this scan already matched 5 separate duplicated blocks between them, totalling at least 77 lines, which is the signature of one file having been copied from the other rather than of a helper waiting to be extracted. The two sit in different directories, so one cannot simply be deleted in favour of the other while both are reached separately: hoist the shared part into a location both already depend on and have each file call it, and retire whichever file turns out to have no caller of its own left. Extracting one helper per block leaves the fork in place. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/StreamingRecorder.swift:26` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it. The matched lines also transfer control out of the body holding them, which cannot survive a move into a called unit unchanged: have the extracted unit return that decision and let each site act on it.
D4 · Code Duplication · Duplicated block (7–9 lines × 2) · ×1
  • Duplicated block (7–9 lines × 2) Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246 — Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246-252 | Examples/SpeechDemo/SpeechDemo/DictateViewModel.swift:59-67 — the copies span different directories, so extracting a shared function means choosing where it lives: put it somewhere both call sites can already reach — a location they all depend on today, or a new shared one if there is none — and call it from each site; until then, every change has to be made twice. Read the line range as the matched WINDOW rather than a finished unit: at `Examples/DictateDemo/DictateDemo/DictateViewModel.swift:246` it runs out through the closing brace of the declaration holding it and carries on into the declaration that follows — the window is the tail of one member plus the head of the next, so no call can be substituted for those exact lines, and the smallest declaration that contains all of them is the type they sit in. The repeated unit is the member each site sits in: where those members' bodies are the same, move one whole member to the shared location and have the others delegate to it; where the copies are a run of near-identical overloads or wrappers that differ only in their signatures, the repetition IS the run — a one-line delegation has no helper inside it to lift — so generate the run from the set it enumerates, or accept it and keep each member's own documentation with it.
PF3 · Async & latency hygiene · Sync-over-async blocking · ×1
  • Sync-over-async blocking Sources/AsrBenchmark/AsrBench.swift:244 — `runIsolated` is async and calls .waitUntilExit() — a blocking call inside async code stalls the cooperative pool's thread — one per core — and every task scheduled on it for as long as it runs.
X17 · Uncapped recursion over a caller-supplied document · Recursive walk over a caller-supplied document has no depth cap · ×1
  • Recursive walk over a caller-supplied document has no depth cap scripts/monitor_apple_gpu.py:196 — `first_numeric` is public and takes `value: object` from its caller, and it calls itself at line 196 (`first_numeric`) with a piece of `value` (and at line 201) — and nowhere in `first_numeric` is there a depth parameter, a descent counter, or any other cap. The walk therefore spends one stack frame per LEVEL of the value it is handed, so the nesting of the caller's document — not this code — decides how deep the stack goes. Python's parsers accept far more nesting than its stack allows: `json.loads` turns 3,000 bytes of brackets into 1,500 levels and `xml.etree.ElementTree` parses tens of thousands, while a walk like this one raises `RecursionError` once it passes the interpreter's default limit of 1,000 frames. Wherever that exception lands, the work fails: a request errors, and outside any `try` the worker or the program exits with it. Raising `sys.setrecursionlimit` only moves the number the document has to beat. Thread a depth argument through `first_numeric` and reject the value past a fixed maximum, or rewrite the descent with an explicit stack.
Minor — 164 finding(s)
D34 · Knowledge Freshness · Orphaned file · ×126
  • Orphaned file Sources/SpeechEnhancement/MLXDeepFilterNet3Network.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/FlashSR/VAE.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/VadBenchmark/VadBench.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/FlashSR/Vocoder.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/SpeechVAD/Community1DiarizationPipeline.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/ChatterboxTTS/ChatterboxFlashCoreMLConfig.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file scripts/benchmark_qwen3_batch_decode.py:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/FishAudioTTS/FishAudioDualAR.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/IndexTTS2TTS/IndexTTS2NativeRuntime.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/HibikiTranslate/HibikiTemporalTransformer.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/VibeVoiceTTS/Quantization/VibeVoiceQuantization.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/VibeVoiceTTS/Inference/DPMSolver.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MagpieTTS/Transformer.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/VibeVoiceTTS/Layers/StreamingConv1d.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MAGNeTMusicGen/T5Encoder.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MagpieTTS/NanoCodec.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/HiggsTTS/HiggsTTSCodecEncoder.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/PersonaPlex/Conv.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/IndexTTS2TTS/IndexTTS2ReferenceConditioning.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MAGNeTMusicGen/EncodecDecoder.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/IndexTTS2TTS/IndexTTS2Wav2Vec2Bert.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MagpieTTS/JapaneseG2P.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/SourceSeparation/WienerFilter.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/IndexTTS2TTS/IndexTTS2RuntimeConfig.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • Orphaned file Sources/MossTranscribe/MossWhisperFeatureExtractor.swift:1 — No one still active in this repository holds living knowledge of this file: everyone who made a meaningful change to it has gone quiet, or what the current team did to it (moves, reformatting, log-level or import edits, renames) never needed understanding it. If it breaks, no one currently understands it. Attach the read to the next change that touches it: have a second person review that change, and leave behind a short comment or test recording what the file is for.
  • + 101 more in this group — see findings.md.
X10 · Duplicated predicate · Duplicated predicate · ×14
  • Duplicated predicate Sources/Qwen3Chat/MLXGenerator.swift:315 — `!inThinking && responseCount >= sampling.maxTokens` appears character-identically in 2 files — Sources/Qwen3Chat/MLXGenerator.swift, Sources/Qwen3Chat/Qwen35CoreMLChat.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 Sources/Qwen3Chat/MLXGenerator.swift:298 — `inThinking && generatedTokens.count > thinkBudget` appears character-identically in 2 files — Sources/Qwen3Chat/MLXGenerator.swift, Sources/Qwen3Chat/Qwen35CoreMLChat.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 Sources/OmniVoiceTTS/OmniVoiceCodec.swift:355 — `k.hasSuffix(".weight") || k.hasSuffix(".bias")` appears character-identically in 2 files — Sources/OmniVoiceTTS/OmniVoiceCodec.swift, Sources/OmniVoiceTTS/OmniVoiceCodecEncoder.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 Sources/HibikiTranslate/HibikiWeightLoading.swift:214 — `key.hasPrefix("depformer_emb.") || key.hasPrefix("depformer_text_emb.") || key.hasPrefix("linears.")` appears character-identically in 2 files — Sources/HibikiTranslate/HibikiWeightLoading.swift, Sources/PersonaPlex/WeightLoading.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 Sources/HibikiTranslate/HibikiWeightLoading.swift:212 — `key.hasPrefix("text_emb.") || key.hasPrefix("emb.") || key.hasPrefix("text_linear.")` appears character-identically in 2 files — Sources/HibikiTranslate/HibikiWeightLoading.swift, Sources/PersonaPlex/WeightLoading.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 Sources/VoxtralASR/VoxtralLanguageModel.swift:70 — `length == 1 && (cache != nil || position > 0)` appears character-identically in 2 files — Sources/VoxtralASR/VoxtralLanguageModel.swift, Sources/VoxtralTTS/LanguageModel.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 Sources/Qwen3ASR/Qwen3ASR.swift:1243 — `lower.contains("8bit") || lower.contains("8-bit")` appears character-identically in 2 files — Sources/Qwen3ASR/Qwen3ASR.swift, Sources/Qwen3TTS/Configuration.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 Sources/Qwen3ASR/Qwen3ASR.swift:1233 — `modelId.contains("1.7B") || modelId.contains("1.7b")` appears character-identically in 2 files — Sources/Qwen3ASR/Qwen3ASR.swift, Sources/Qwen3TTS/Configuration.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 Sources/HibikiTranslate/HibikiWeightLoading.swift:235 — `parts[4] == "linear_in" || parts[4] == "linear_out"` appears character-identically in 2 files — Sources/HibikiTranslate/HibikiWeightLoading.swift, Sources/PersonaPlex/WeightLoading.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 Sources/HibikiTranslate/HibikiWeightLoading.swift:236 — `parts[5] == "weight" || parts[5] == "scales" || parts[5] == "biases"` appears character-identically in 2 files — Sources/HibikiTranslate/HibikiWeightLoading.swift, Sources/PersonaPlex/WeightLoading.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 Sources/SpeechVAD/DiarizationPipeline.swift:340 — `positions.isEmpty || positions.last!.end < numSamples` appears character-identically in 2 files — Sources/SpeechVAD/DiarizationPipeline.swift, Sources/SpeechVAD/VADPipeline.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 Sources/AudioCommon/Tokenizer.swift:125 — `token.hasPrefix("<|") && token.hasSuffix("|>")` appears character-identically in 2 files — Sources/AudioCommon/Tokenizer.swift, Sources/Qwen3Chat/ChatTokenizer.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 Sources/NemotronStreamingASR/Vocabulary.swift:219 — `token.hasPrefix("▁") && !currentWord.isEmpty` appears character-identically in 2 files — Sources/NemotronStreamingASR/Vocabulary.swift, Sources/ParakeetStreamingASR/Vocabulary.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 Sources/MagpieTTSCoreML/Decoder.swift:282 — `xaK.count == numLayers && xaV.count == numLayers` appears character-identically in 2 files — Sources/MagpieTTSCoreML/Decoder.swift, Sources/MagpieTTSCoreML/StatefulDecoder.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.
X7 · Silent fallback defaults · Silent fallback default in catch · ×6
  • Silent fallback default in catch Sources/AudioCLILib/VoiceChatMCP.swift:1498 — `execute` turns every thrown error into `#"{"ok":false,"error":"more information required"}"#` — 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 Sources/AudioServer/AudioServer.swift:2058 — `formatJSON` 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 Sources/KyutaiSTT/KyutaiSTTModel.swift:123 — `transcribe` 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 Sources/MagpieTTS/ChineseG2P.swift:67 — `phonemize` 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 Sources/SpeechVAD/FireRedVAD.swift:222 — `runCoreML` 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 Sources/SpeechVAD/SileroVAD.swift:112 — `processChunk` 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.
D16 · Bus Factor · Off-boarding risk · ×3
  • Off-boarding risk: anonymized user #1 — If anonymized user #1 becomes unavailable, 49 significant file(s) lose their only recent owner: Sources/VoiceChat/VoiceChatSession.swift, Sources/AudioCLILib/VoiceChatMCP.swift, scripts/qwen3_tts_coreml/convert_coreml.py, Sources/AudioCommon/HuggingFaceBackgroundTransfer.swift, Sources/MagpieTTSCoreML/MagpieTTSCoreML.swift, Sources/SpeechVAD/Nemotron3Diarizer.swift, Sources/Qwen3Chat/Gemma4Chat.swift, Sources/AudioCommon/HuggingFaceTransfer.swift (+41 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #2 — If anonymized user #2 becomes unavailable, 27 significant file(s) lose their only recent owner: Sources/IndexTTS2TTS/IndexTTS2SemanticGPT.swift, Sources/ChatterboxTTS/ChatterboxFlashCoreMLGraphs.swift, Sources/AudioCommon/SystemAudioTap.swift, Sources/F5TTS/F5TTSFlow.swift, scripts/render_benchmark_dashboard.py, Sources/HibikiTranslate/HibikiTranslate.swift, Sources/HibikiTranslate/Configuration.swift, Sources/IndexTTS2TTS/IndexTTS2BigVGAN.swift (+19 more). Pair on, review, or document these before any departure.
  • Off-boarding risk: anonymized user #3 — If anonymized user #3 becomes unavailable, 19 significant file(s) lose their only recent owner: Sources/ParakeetStreamingASR/StreamingSession.swift, Sources/ParakeetStreamingASR/StreamingMelPreprocessor.swift, Sources/Qwen3ASR/AudioEncoder.swift, Sources/SpeechWakeWord/KaldiFbank.swift, Sources/KokoroTTS/LatinPhonemizer.swift, Sources/Qwen3ASR/TextPreprocessing.swift, Sources/KokoroTTS/ChinesePhonemizer.swift, Sources/PersonaPlex/Depformer.swift (+11 more). Pair on, review, or document these before any departure.
X7 · Silent fallback defaults · Silent fallback default on parse failure · ×2
  • Silent fallback default on parse failure scripts/render_benchmark_dashboard.py:93 — `mb` returns `'-'` when `(TypeError, 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 scripts/render_benchmark_dashboard.py:102 — `delta` returns `'<span class="muted">new</span>'` when `(TypeError, 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.
D16 · Bus Factor · Further sole-owners (lower concentration) · ×1
  • Further sole-owners (lower concentration) — 1 other contributor(s) are each the sole owner of a small amount of code below the off-boarding threshold — folded into the bus-factor score and metrics (96 single-owned of 558 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 558 of the 691 production source files in this repository met that bar). They are anonymized user #4 (1 file(s)) — spread or document their files in the same way, at lower priority than the named off-boarding risks above. The files folded here: Sources/Qwen3TTS/LocalModelConfiguration.swift.
D20 · ADR Quality · No ADRs found · ×1
  • No ADRs found — No ADRs found. No recognised ADR directory (`docs/adr/`, `docs/decisions/`, `adr/`, `docs/rfcs/`, an `ADR0001/` folder, or their siblings) exists anywhere in this tree. What was searched, so you can tell an empty log from a search that missed one: every directory under the tree (build output, dependencies and VCS metadata excepted), for a document that is either any non-index page inside a recognised ADR directory, whatever its name and however deeply nested (`docs/adr/use-postgres.md`, `docs/adr/2024/0001-x.md`); or a file anywhere whose name is ADR-shaped (`0001-use-postgres.md`, `adr-012-caching.md`); or, when neither turned anything up, a document carrying the decision-record signature (an "Architecture Decision Record" heading, or Status / Context / Decision / Consequences as section headings). A decision log that clears none of these — unnumbered files outside any recognised directory, without those headings — is not seen by this check and this row is then wrong. If that is your case, say so rather than renaming anything; otherwise, consider recording architectural decisions in `docs/adr/`.
D26 · Project Cohesion · Projects may be oversized for their cohesion · ×1
  • Projects may be oversized for their cohesion — 1 of 1 project(s) overshoot their size bounds, lowering Project Cohesion to 0.0/10. The most over is `(repository root)` (149773 LoC, 2163 module-visible types across 80 directories). Review these for cohesion — draw the boundary inside the module first (group each responsibility into its own package or directory and keep the cross-boundary members non-public), since splitting a published package moves types between packages and breaks consumers.
D28 · Secrets (history) · Rotate the exposed credentials · ×1
  • REDACTED
D34 · Knowledge Freshness · Further orphaned files (smaller) · ×1
  • Further orphaned files (smaller) — 126 smaller file(s) also have no living knowledge — folded into the freshness score and metrics rather than raised one row each — most significant first: Sources/SpeechEnhancement/MLXDeepFilterNet3Network.swift, Sources/FlashSR/VAE.swift, Sources/VadBenchmark/VadBench.swift, Sources/FlashSR/Vocoder.swift, Sources/SpeechVAD/Community1DiarizationPipeline.swift, Sources/ChatterboxTTS/ChatterboxFlashCoreMLConfig.swift, scripts/benchmark_qwen3_batch_decode.py, Sources/FishAudioTTS/FishAudioDualAR.swift (and 118 more) (131 orphaned of 558 analysed files in total, counted over production source files of roughly 2,400 bytes or more, excluding vendored, generated, example/demo and scaffolding-template trees and test files identified by path convention, largest first; 558 of the 691 production source files in this repository met that bar). Attach the read to the next change that touches one of them: have a second person review that change, and leave behind a short comment or test recording what the file is for, so the knowledge comes back at the cost of a change you were making anyway.
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
D36 · Supply-chain Provenance & Signing · REDACTED · ×1
  • REDACTED
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.
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 20017 CI workflow file(s) in this repository, and the scanner and linter configuration checked in beside them. A scan that runs outside CI, one configured in your forge's web UI rather than in a committed file, or a tool whose name is none of those this check carries, is not seen — if that is your case the row is wrong, and saying so is more useful than adding a second scanner.
P4 · Deployment & Rollback · No release approval gate · ×1
  • No release approval gate — The release is automated and no gate that pauses it for a human is DECLARED IN THIS REPOSITORY'S PIPELINE FILES. What was read: every file under `.github/workflows/`, `.forgejo/workflows/`, `.gitea/workflows/`, `.azuredevops/` and `.azure-pipelines/`, plus `.gitlab-ci*` and `azure-pipelines*` — with comment text stripped, so documenting a gate is not declaring one. What would have counted: GitLab's `when: manual`, CircleCI's `type: approval`, an Azure `ManualValidation@` task or an `approvals:` block, a Jenkins `input` step, a `uses:` step naming an approval action, an `environment:` paired with `reviewers` / `required_reviewers` / `protection` / `wait-timer` / `deployment_branch_policy`, a draft-release step, a `workflow_dispatch` promotion, or a release-event gate. ★ What this cannot see, because none of it is a file: a GitHub environment whose required reviewers are configured in repo SETTINGS, a branch protection rule, or an organisation deployment policy — all of them real, enforced gates that live outside the repository. If yours is one of those, this row is wrong and nothing in the tree could have told us. Otherwise: whatever the release trigger points at is published to users unreviewed, so a mistagged or unverified commit ships and the only remedy is a follow-up release.
P6 · Release Hygiene · Changelog looks stale/thin · ×1
  • Changelog looks stale/thin — The changelog this check read carries 0 versioned entries, against a bar of 3. Counted as either the distinct `x.y.z` versions it names (a link's target is not counted) or its version-shaped section headings (`## [1.2.0]`, `## V14.x.x`, `## Updates in 8.0.x`), whichever is the larger — so a log sectioned by minor series counts its sections, not its individual patch numbers. Entries recorded somewhere this check does not read — release notes generated at tag time from a generator config it did not recognise, or a log kept outside the repository — are not counted here, and this row is about what is re-findable in the tree rather than about how often you release.
Minor — 47 finding(s)
D12 · Dependency Hygiene · Outdated · ×45
  • Outdated: accelerate — `accelerate` is pinned to 1.12.0, but 1.15.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.12.0 until the declaration is edited.
  • Outdated: brotli — `brotli` is pinned to 1.2.0, but 1.2.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.2.0 until the declaration is edited.
  • Outdated: cattrs — `cattrs` is pinned to 26.2.0, but 26.2.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 26.2.0 until the declaration is edited.
  • Outdated: certifi — `certifi` is pinned to 2026.7.22, but 2026.10.23 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2026.7.22 until the declaration is edited.
  • Outdated: charset-normalizer — `charset-normalizer` is pinned to 3.5.1, but 3.5.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.5.1 until the declaration is edited.
  • Outdated: fastapi — `fastapi` is pinned to 0.141.1, but 0.162.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.141.1 until the declaration is edited.
  • Outdated: filelock — `filelock` is pinned to 4.0.1, but 4.2.4 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 4.0.1 until the declaration is edited.
  • Outdated: gradio — `gradio` is pinned to 6.17.3, but 6.31.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 6.17.3 until the declaration is edited.
  • Outdated: gradio-client — `gradio-client` is pinned to 2.5.0, but 2.7.2 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.5.0 until the declaration is edited.
  • Outdated: hf-xet — `hf-xet` is pinned to 1.6.0, but 1.7.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.6.0 until the declaration is edited.
  • Outdated: huggingface-hub — `huggingface-hub` is pinned to 0.36.2, but 2.3.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.36.2 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: iniconfig — `iniconfig` is pinned to 2.3.0, but 2.3.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.3.0 until the declaration is edited.
  • Outdated: lazy-loader — `lazy-loader` is pinned to 0.5, but 0.6 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.5 until the declaration is edited.
  • Outdated: librosa — `librosa` is pinned to 0.11.0, but 1.0.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.11.0 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: llvmlite — `llvmlite` is pinned to 0.49.0, but 0.50.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.49.0 until the declaration is edited.
  • Outdated: markupsafe — `markupsafe` is pinned to 3.0.3, but 3.0.4 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.0.3 until the declaration is edited.
  • Outdated: mpmath — `mpmath` is pinned to 1.3.0, but 1.4.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.3.0 until the declaration is edited.
  • Outdated: msgpack — `msgpack` is pinned to 1.2.2, but 1.2.4 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.2.2 until the declaration is edited.
  • Outdated: narwhals — `narwhals` is pinned to 2.26.0, but 2.28.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 2.26.0 until the declaration is edited.
  • Outdated: networkx — `networkx` is pinned to 3.6.1, but 3.7 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.6.1 until the declaration is edited.
  • Outdated: numba — `numba` is pinned to 0.67.0, but 0.68.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 0.67.0 until the declaration is edited.
  • Outdated: numpy — `numpy` is pinned to 1.26.4, but 2.5.4 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.26.4 until the declaration is edited. This crosses a major version, so it is a migration rather than a bump.
  • Outdated: onnxruntime — `onnxruntime` is pinned to 1.30.0, but 1.31.1 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 1.30.0 until the declaration is edited.
  • Outdated: orjson — `orjson` is pinned to 3.12.0, but 3.13.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.12.0 until the declaration is edited.
  • Outdated: pandas — `pandas` is pinned to 3.0.6, but 3.1.0 is the current stable release on PyPI. An exact pin never moves on its own, so this repository installs 3.0.6 until the declaration is edited.
  • + 20 more in this group — see findings.md.
D5 · Coupling · Off the main sequence · ×2
  • Off the main sequence: MLXCommon — MLXCommon: abstractness 0.00, instability 0.03, distance 0.97 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.
  • Off the main sequence: AudioCommon — AudioCommon: abstractness 0.26, instability 0.00, distance 0.74 — the shape a shared-kernel / building-block library has BY DESIGN — concrete and widely depended-on is what makes it useful, and this dimension does not penalise it (the distance is reported for completeness, not as a defect). Worth a look only if it has grown past one coherent kernel into an everything-bucket.

Appendix B — Reproduction & audit trail

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

DimensionToolVersionCommandFindingsRaw output
D28 · Secrets (history)gitleaks—gitleaks detect --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-d99d0cafe6f24eb58d4e7187edbf62f6/history.json --exit-code 0 --source .1artifacts/raw/gitleaks-history.json
D28 · Secrets (history)gitleaks—gitleaks detect --no-git --no-banner --config /opt/gitleaks-rules/watchdog-gitleaks.toml --report-format json --report-path /tmp/watchdog-gitleaks-d99d0cafe6f24eb58d4e7187edbf62f6/tree.json --exit-code 0 --source .1artifacts/raw/gitleaks-tree.json
D29 · Static Analysis (SAST)semgrep—semgrep --config /opt/semgrep-rules/security-audit.yml --config /opt/semgrep-rules/owasp-top-ten.yml --config /opt/semgrep-rules/watchdog-sast.yml --json --quiet --timeout 10 --timeout-threshold 3 --metrics off --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 .7artifacts/raw/semgrep.json
D30 · Dependency Vulnerabilitiesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .9artifacts/raw/osv-scanner.json
D31 · IaC & Container Securitytrivy—trivy: not applicable — No Infrastructure-as-Code or container manifests found (Dockerfile, Docker Compose, Terraform, Kubernetes/Helm, CloudFormation, ARM, Bicep, Ansible); nothing to scan.0—
D32 · Data Compliance (PII/GDPR)semgrep—semgrep: not applicable — No personal data was found crossing a boundary the PII/GDPR ruleset checks — nothing written to a log or console sink, placed in a URL or query string, or persisted to browser storage. That is a clean result for the LEAK surface only: this ruleset detects personal data escaping, it does not inventory the personal data a repository holds, so it is not evidence that this repository has no personal-data surface. The personal-data map (Appendix C) and the C1-C5 compliance cards are what speak to that. semgrep could not parse 48 file(s) — `Examples/DictateDemo/DictateDemo/DictateViewModel.swift`, `Sources/AsrBenchmark/Normalizer.swift`, `Sources/AudioCLILib/VoiceChatCommand.swift`, `Sources/AudioCLILib/VoiceChatDemoSupport.swift`, `Sources/AudioCLILib/VoiceChatMCP.swift`, … (+43 more) — so the PII/GDPR sweep did not cover the unparsed regions of them; rows reported elsewhere in those files are real.0—
D37 · Vulnerability-disclosure Policydisclosure—disclosure: not applicable — No vulnerability-disclosure policy file found (SECURITY.md/.markdown/.rst/.txt at root or under .github/.forgejo/.gitea/docs, .well-known/security.txt). A coordinated-disclosure policy may live off-repo, so this is not evidenced rather than failed.0—
D40 · Network Egress Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; network egress policy is a cluster-native control that may live at the platform/firewall layer, so there is nothing to assess here.0—
D41 · Kernel & Syscall Confinementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; seccomp/AppArmor/SELinux confinement is a workload-level control, so there is nothing to assess here.0—
D42 · Runtime Threat Enforcementruntime-hardening—runtime-hardening: not applicable — No Kubernetes/orchestration workloads found in the repository manifests; runtime threat-detection and admission-control policy are cluster-level controls, so there is nothing to assess here.0—
D43 · Malicious Dependenciesosv-scanner—osv-scanner --format json --recursive --experimental-disable-plugins transitivedependency/requirements --experimental-disable-plugins dotnet/csproj --experimental-disable-plugins dotnet/nugetcpm .0artifacts/raw/osv-scanner.json

Run 01a187fa-bddd-71a0-85ac-3e95d289811a · 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